Tue, 06 Aug 2024 00:37:03 -0500
Remove the notify API
Testing Done:
Ran the turtles.
Reviewed at https://reviews.imfreedom.org/r/3351/
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
1 | /* |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
4 | * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
7 | * source distribution. |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
8 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
12 | * any later version. |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
13 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
17 | * more details. |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
18 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42557
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
21 | */ |
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
22 | |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
24 | |
|
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" |
|
42557
e868bfcc092a
Only include headers when they're necessary for header files
Gary Kramlich <grim@reaperworld.com>
parents:
42234
diff
changeset
|
29 | #include "prefs.h" |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
30 | #include "purpleaccountmanager.h" |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
31 | #include "purpleconversationmanager.h" |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
32 | #include "purplecredentialmanager.h" |
|
41007
90d2dee9b3dc
Fix the includes for the purpleenums rename
Gary Kramlich <grim@reaperworld.com>
parents:
40992
diff
changeset
|
33 | #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
|
34 | #include "purpleprivate.h" |
| 42725 | 35 | #include "signals.h" |
| 36 | #include "util.h" | |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
37 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
38 | 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
|
39 | 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
|
40 | |
|
40505
e2c4be9e3aa6
fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
41 | static void |
|
41960
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41958
diff
changeset
|
42 | purple_accounts_network_changed_cb(G_GNUC_UNUSED GNetworkMonitor *m, |
|
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41958
diff
changeset
|
43 | gboolean available, |
|
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41958
diff
changeset
|
44 | G_GNUC_UNUSED gpointer data) |
|
40505
e2c4be9e3aa6
fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
45 | { |
|
e2c4be9e3aa6
fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
46 | if(available) { |
|
42647
b6c3acaddc83
Replace purple_accounts_restore_statuses with purple_account_manager_set_online
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
47 | PurpleAccountManager *manager = NULL; |
|
b6c3acaddc83
Replace purple_accounts_restore_statuses with purple_account_manager_set_online
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
48 | |
|
b6c3acaddc83
Replace purple_accounts_restore_statuses with purple_account_manager_set_online
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
49 | manager = purple_account_manager_get_default(); |
|
b6c3acaddc83
Replace purple_accounts_restore_statuses with purple_account_manager_set_online
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
50 | purple_account_manager_set_online(manager, TRUE); |
|
40505
e2c4be9e3aa6
fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
51 | } |
|
e2c4be9e3aa6
fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
52 | } |
|
e2c4be9e3aa6
fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
53 | |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
54 | /********************************************************************* |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
55 | * Writing to disk * |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
56 | *********************************************************************/ |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
57 | static void |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
58 | accounts_to_xmlnode_helper(PurpleAccount *account, gpointer data) { |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
59 | PurpleXmlNode *node = data, *child = NULL; |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
60 | |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
61 | child = _purple_account_to_xmlnode(account); |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
62 | purple_xmlnode_insert_child(node, child); |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
63 | } |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
64 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
65 | static PurpleXmlNode * |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
66 | accounts_to_xmlnode(void) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
67 | { |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
68 | PurpleAccountManager *manager = purple_account_manager_get_default(); |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
69 | PurpleXmlNode *node = NULL; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
70 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
71 | 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
|
72 | 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
|
73 | |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
74 | 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
|
75 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
76 | return node; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
77 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
78 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
79 | static void |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
80 | sync_accounts(void) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
81 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
82 | PurpleXmlNode *node; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
83 | char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
84 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
85 | if (!accounts_loaded) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
86 | { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
87 | 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
|
88 | "they were read!\n"); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
89 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
90 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
91 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
92 | 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
|
93 | 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
|
94 | 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
|
95 | 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
|
96 | 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
|
97 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
98 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
99 | static gboolean |
|
41960
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41958
diff
changeset
|
100 | save_cb(G_GNUC_UNUSED gpointer data) |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
101 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
102 | sync_accounts(); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
103 | save_timer = 0; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
104 | return FALSE; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
105 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
106 | |
|
34582
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
107 | void |
|
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
108 | 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
|
109 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
110 | if (save_timer == 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37679
diff
changeset
|
111 | 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
|
112 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
113 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
114 | static void |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
115 | 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
|
116 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
117 | /* 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
|
118 | 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
|
119 | 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
|
120 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
121 | 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
|
122 | 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
|
123 | 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
|
124 | val = "old_ssl"; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
125 | 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
|
126 | val = "opportunistic_tls"; |
|
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 | 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
|
129 | } |
|
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 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
132 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
133 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
134 | 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
|
135 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
136 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
137 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
138 | /* 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
|
139 | 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
|
140 | 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
|
141 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
142 | 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
|
143 | PurplePrefType type; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
144 | char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
145 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
146 | 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
|
147 | if (name == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
148 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
149 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
150 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
151 | 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
|
152 | if (str_type == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
153 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
154 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
155 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
156 | 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
|
157 | type = PURPLE_PREF_STRING; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
158 | 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
|
159 | type = PURPLE_PREF_INT; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
160 | 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
|
161 | type = PURPLE_PREF_BOOLEAN; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
162 | else |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
163 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
164 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
165 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
166 | 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
|
167 | if (data == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
168 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
169 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
170 | |
|
41393
f4faf0d6ab26
Remove the account ui settings as it was only used for whether or not an account was enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41392
diff
changeset
|
171 | if (type == PURPLE_PREF_STRING) |
|
f4faf0d6ab26
Remove the account ui settings as it was only used for whether or not an account was enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41392
diff
changeset
|
172 | purple_account_set_string(account, name, data); |
|
f4faf0d6ab26
Remove the account ui settings as it was only used for whether or not an account was enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41392
diff
changeset
|
173 | else if (type == PURPLE_PREF_INT) |
|
f4faf0d6ab26
Remove the account ui settings as it was only used for whether or not an account was enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41392
diff
changeset
|
174 | purple_account_set_int(account, name, atoi(data)); |
|
f4faf0d6ab26
Remove the account ui settings as it was only used for whether or not an account was enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41392
diff
changeset
|
175 | else if (type == PURPLE_PREF_BOOLEAN) |
|
f4faf0d6ab26
Remove the account ui settings as it was only used for whether or not an account was enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41392
diff
changeset
|
176 | purple_account_set_bool(account, name, |
|
f4faf0d6ab26
Remove the account ui settings as it was only used for whether or not an account was enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41392
diff
changeset
|
177 | (*data == '0' ? FALSE : TRUE)); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
178 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
179 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
180 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
181 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
182 | /* 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
|
183 | * Edit Account dialog. */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
184 | migrate_xmpp_encryption(account); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
185 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
186 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
187 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
188 | 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
|
189 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
190 | 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
|
191 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
192 | char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
193 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
194 | 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
|
195 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
196 | /* Use the global proxy settings, by default */ |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
197 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_USE_GLOBAL); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
198 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
199 | /* 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
|
200 | 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
|
201 | 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
|
202 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
203 | if (purple_strequal(data, "global")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
204 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_USE_GLOBAL); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
205 | else if (purple_strequal(data, "none")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
206 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_NONE); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
207 | else if (purple_strequal(data, "http")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
208 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_HTTP); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
209 | else if (purple_strequal(data, "socks4")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
210 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_SOCKS4); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
211 | else if (purple_strequal(data, "socks5")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
212 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_SOCKS5); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
213 | else if (purple_strequal(data, "tor")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
214 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_TOR); |
|
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, "envvar")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
216 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TYPE_USE_ENVVAR); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
217 | else |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
218 | { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
219 | purple_debug_error("accounts", "Invalid proxy type found when " |
|
41976
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41960
diff
changeset
|
220 | "loading account information for %s\n", |
|
42805
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42731
diff
changeset
|
221 | purple_account_get_username(account)); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
222 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
223 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
224 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
225 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
226 | /* 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
|
227 | 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
|
228 | 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
|
229 | { |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
230 | purple_proxy_info_set_hostname(proxy_info, data); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
231 | g_free(data); |
|
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 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
234 | /* 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
|
235 | 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
|
236 | 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
|
237 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
238 | 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
|
239 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
240 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
241 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
242 | /* 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
|
243 | 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
|
244 | 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
|
245 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
246 | 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
|
247 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
248 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
249 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
250 | /* 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
|
251 | 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
|
252 | 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
|
253 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
254 | 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
|
255 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
256 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
257 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
258 | /* If there are no values set then proxy_info NULL */ |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
259 | if ((purple_proxy_info_get_proxy_type(proxy_info) == PURPLE_PROXY_TYPE_USE_GLOBAL) && |
|
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
260 | (purple_proxy_info_get_hostname(proxy_info) == NULL) && |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
261 | (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
|
262 | (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
|
263 | (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
|
264 | { |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
265 | g_clear_object(&proxy_info); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
266 | return; |
|
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 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
269 | purple_account_set_proxy_info(account, proxy_info); |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
270 | |
|
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
271 | g_clear_object(&proxy_info); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
272 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
273 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
274 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
275 | 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
|
276 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
277 | guint type; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
278 | 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
|
279 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
280 | PurpleConnectionErrorInfo *current_error = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
281 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
282 | 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
|
283 | 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
|
284 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
285 | type = atoi(type_str); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
286 | g_free(type_str); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
287 | |
|
41976
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41960
diff
changeset
|
288 | if(type > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
289 | purple_debug_error("accounts", |
|
41976
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41960
diff
changeset
|
290 | "Invalid PurpleConnectionError value %d found when " |
|
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41960
diff
changeset
|
291 | "loading account information for %s\n", |
|
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41960
diff
changeset
|
292 | type, |
|
42805
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42731
diff
changeset
|
293 | purple_account_get_username(account)); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
294 | 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
|
295 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
296 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
297 | child = purple_xmlnode_get_child(node, "description"); |
|
41717
ce790d508898
Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
298 | if(child) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
299 | description = purple_xmlnode_get_data(child); |
|
41717
ce790d508898
Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
300 | } |
|
ce790d508898
Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
301 | current_error = purple_connection_error_info_new(type, |
|
ce790d508898
Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
302 | (description != NULL) ? description : ""); |
|
ce790d508898
Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
303 | g_free(description); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
304 | |
|
42049
16d2e16bd24f
Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents:
42009
diff
changeset
|
305 | purple_account_set_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
|
306 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
307 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
308 | static PurpleAccount * |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
309 | 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
|
310 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
311 | PurpleAccount *ret; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
312 | PurpleXmlNode *child; |
|
41204
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
313 | gchar *id = NULL; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
314 | char *protocol_id = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
315 | char *name = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
316 | char *data; |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41318
diff
changeset
|
317 | gboolean enabled = FALSE; |
|
41773
c4acd02fdf73
Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41733
diff
changeset
|
318 | gboolean require_password = FALSE; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
319 | |
|
41204
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
320 | 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
|
321 | if(child != NULL) { |
|
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
322 | 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
|
323 | } |
|
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
324 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
325 | 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
|
326 | 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
|
327 | 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
|
328 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
329 | 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
|
330 | 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
|
331 | 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
|
332 | if (name == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
333 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
334 | /* 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
|
335 | 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
|
336 | 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
|
337 | 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
|
338 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
339 | |
|
41773
c4acd02fdf73
Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41733
diff
changeset
|
340 | child = purple_xmlnode_get_child(node, "require_password"); |
|
c4acd02fdf73
Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41733
diff
changeset
|
341 | if(child != NULL) { |
|
42104
08966165974c
Fix leaks when loading accounts
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42049
diff
changeset
|
342 | data = purple_xmlnode_get_data(child); |
|
08966165974c
Fix leaks when loading accounts
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42049
diff
changeset
|
343 | require_password = atoi(data); |
|
08966165974c
Fix leaks when loading accounts
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42049
diff
changeset
|
344 | g_free(data); |
|
41773
c4acd02fdf73
Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41733
diff
changeset
|
345 | } |
|
c4acd02fdf73
Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41733
diff
changeset
|
346 | |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41318
diff
changeset
|
347 | child = purple_xmlnode_get_child(node, "enabled"); |
|
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41318
diff
changeset
|
348 | if(child != NULL) { |
|
42104
08966165974c
Fix leaks when loading accounts
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42049
diff
changeset
|
349 | data = purple_xmlnode_get_data(child); |
|
08966165974c
Fix leaks when loading accounts
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42049
diff
changeset
|
350 | enabled = atoi(data); |
|
08966165974c
Fix leaks when loading accounts
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42049
diff
changeset
|
351 | g_free(data); |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41318
diff
changeset
|
352 | } |
|
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41318
diff
changeset
|
353 | |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
354 | 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
|
355 | { |
|
41204
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
356 | g_free(id); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
357 | g_free(protocol_id); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
358 | g_free(name); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
359 | return NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
360 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
361 | |
|
41204
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
362 | /* 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
|
363 | * 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
|
364 | */ |
|
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
365 | 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
|
366 | "id", id, |
|
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
367 | "username", name, |
|
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
368 | "protocol-id", protocol_id, |
|
41773
c4acd02fdf73
Add a require-password property to PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
41733
diff
changeset
|
369 | "require-password", require_password, |
|
41204
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
370 | NULL); |
|
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
371 | |
|
41830
5bc664b848a5
Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
372 | purple_account_set_enabled_plain(ret, enabled); |
|
5bc664b848a5
Work around an issue where accounts were attempting to connect when they were deserialized
Gary Kramlich <grim@reaperworld.com>
parents:
41798
diff
changeset
|
373 | |
|
41204
c38a5a2a8d43
Add an id property to PurpleAccount and make sure it persists
Gary Kramlich <grim@reaperworld.com>
parents:
41181
diff
changeset
|
374 | g_free(id); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
375 | g_free(name); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
376 | g_free(protocol_id); |
|
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 alias */ |
|
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, "alias"); |
|
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 | { |
|
41976
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41960
diff
changeset
|
382 | if (*data != '\0') { |
|
42805
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42731
diff
changeset
|
383 | PurpleContactInfo *info = NULL; |
|
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42731
diff
changeset
|
384 | |
|
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42731
diff
changeset
|
385 | info = purple_account_get_contact_info(ret); |
|
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42731
diff
changeset
|
386 | purple_contact_info_set_alias(info, data); |
|
41976
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41960
diff
changeset
|
387 | } |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
388 | g_free(data); |
|
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 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
391 | /* 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
|
392 | 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
|
393 | 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
|
394 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
395 | 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
|
396 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
397 | } |
|
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 | /* 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
|
400 | 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
|
401 | 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
|
402 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
403 | parse_settings(child, ret); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
404 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
405 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
406 | /* Read proxy */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
407 | 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
|
408 | if (child != NULL) |
|
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 | 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
|
411 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
412 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
413 | /* 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
|
414 | 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
|
415 | if (child != NULL) |
|
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 | 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
|
418 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
419 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
420 | return ret; |
|
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 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
423 | static void |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
424 | load_accounts(void) { |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
425 | 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
|
426 | PurpleXmlNode *node, *child; |
|
34579
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 | accounts_loaded = TRUE; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
429 | |
|
39438
e85334959b23
Move more libpurple files to ~/.config.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39352
diff
changeset
|
430 | 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
|
431 | |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
432 | if(node == NULL) { |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
433 | return; |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
434 | } |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
435 | |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
436 | manager = purple_account_manager_get_default(); |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
437 | |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
438 | for(child = purple_xmlnode_get_child(node, "account"); child != NULL; |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
439 | 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
|
440 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
441 | PurpleAccount *new_acct; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
442 | new_acct = parse_account(child); |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
443 | |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
444 | purple_account_manager_add(manager, new_acct); |
|
42234
95aec1611d01
A few account manager changes
Gary Kramlich <grim@reaperworld.com>
parents:
42175
diff
changeset
|
445 | g_clear_object(&new_acct); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
446 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
447 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
448 | 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
|
449 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
450 | |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
451 | static void |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
452 | 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
|
453 | PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj); |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
454 | 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
|
455 | GError *error = NULL; |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
456 | gboolean r = FALSE; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
457 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
458 | 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
|
459 | if(r != TRUE) { |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
460 | purple_debug_warning("accounts", |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
461 | "Failed to remove password for account %s: %s", |
|
42805
3e77e81168a5
Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42731
diff
changeset
|
462 | purple_account_get_username(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
|
463 | (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
|
464 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
465 | g_clear_error(&error); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
466 | } |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40570
diff
changeset
|
467 | |
|
41898
c1b117cf84ce
Fix cleanup of acconut password on deletion
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41894
diff
changeset
|
468 | g_object_unref(account); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
469 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
470 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
471 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
472 | purple_accounts_delete(PurpleAccount *account) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
473 | { |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
474 | PurpleAccountManager *manager = NULL; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
475 | PurpleConversationManager *conv_manager = NULL; |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
476 | PurpleCredentialManager *cred_manager = NULL; |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
477 | GList *iter = NULL; |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
478 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
479 | g_return_if_fail(account != NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
480 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
481 | /* |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
482 | * 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
|
483 | * 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
|
484 | * 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
|
485 | * but it doesn't really matter. |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
486 | */ |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41318
diff
changeset
|
487 | purple_account_set_enabled(account, FALSE); |
|
34574
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 | purple_request_close_with_handle(account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
490 | |
|
41181
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
491 | manager = purple_account_manager_get_default(); |
|
e859c41d8996
Create the PurpleAccountManager API
Gary Kramlich <grim@reaperworld.com>
parents:
41031
diff
changeset
|
492 | 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
|
493 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
494 | /* Remove any open conversation for this account */ |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
495 | conv_manager = purple_conversation_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
496 | iter = purple_conversation_manager_get_all(conv_manager); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
497 | while(iter != NULL) { |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
498 | PurpleConversation *conv = iter->data; |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
499 | |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
500 | 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
|
501 | g_object_unref(conv); |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
502 | } |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
503 | |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
504 | 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
|
505 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
506 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
507 | /* 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
|
508 | * 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
|
509 | */ |
|
40992
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
510 | cred_manager = purple_credential_manager_get_default(); |
|
3a973a9c5a64
migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40863
diff
changeset
|
511 | 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
|
512 | purple_accounts_delete_set, |
|
41898
c1b117cf84ce
Fix cleanup of acconut password on deletion
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41894
diff
changeset
|
513 | g_object_ref(account)); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
514 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
515 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
516 | void * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
517 | purple_accounts_get_handle(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
518 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
519 | static int handle; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
520 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
521 | return &handle; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
522 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
523 | |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
524 | static void |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
525 | connection_error_cb(PurpleConnection *gc, |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
526 | PurpleConnectionError type, |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
527 | const gchar *description, |
|
41960
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41958
diff
changeset
|
528 | G_GNUC_UNUSED gpointer unused) |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
529 | { |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
530 | PurpleAccount *account; |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
531 | PurpleConnectionErrorInfo *err; |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
532 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
533 | account = purple_connection_get_account(gc); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
534 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
535 | g_return_if_fail(account != NULL); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
536 | |
|
41717
ce790d508898
Minor cleanup to account cleanup and connection error handling
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41685
diff
changeset
|
537 | err = purple_connection_error_info_new(type, description); |
|
42049
16d2e16bd24f
Export Account::error
Gary Kramlich <grim@reaperworld.com>
parents:
42009
diff
changeset
|
538 | purple_account_set_error(account, err); |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
539 | } |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
540 | |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
541 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
542 | purple_accounts_init(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
543 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
544 | void *handle = purple_accounts_get_handle(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
545 | 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
|
546 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
547 | purple_signal_connect(conn_handle, "connection-error", handle, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41240
diff
changeset
|
548 | G_CALLBACK(connection_error_cb), NULL); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
549 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
550 | load_accounts(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
551 | |
|
40505
e2c4be9e3aa6
fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents:
40441
diff
changeset
|
552 | 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
|
553 | "network-changed", |
|
40512
05663def7b82
Fix some easy compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents:
40505
diff
changeset
|
554 | 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
|
555 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
556 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
557 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
558 | purple_accounts_uninit(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
559 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
560 | gpointer handle = purple_accounts_get_handle(); |
|
42175
4185b4043214
Use g_clear_handle_id everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42104
diff
changeset
|
561 | if(save_timer != 0) { |
|
4185b4043214
Use g_clear_handle_id everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42104
diff
changeset
|
562 | g_clear_handle_id(&save_timer, g_source_remove); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
563 | sync_accounts(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
564 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
565 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
566 | purple_signals_disconnect_by_handle(handle); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
567 | } |