Sun, 23 Feb 2014 01:43:21 +0530
Use g_free as UiOps structures GBoxed free function
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1 | /* purple |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
2 | * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
3 | * Purple is the legal property of its developers, whose names are too numerous |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
5 | * source distribution. |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
6 | * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
8 | * it under the terms of the GNU General Public License as published by |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
10 | * (at your option) any later version. |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
11 | * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
15 | * GNU General Public License for more details. |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
16 | * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
20 | */ |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
21 | #include "internal.h" |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
22 | #include "accounts.h" |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
23 | #include "core.h" |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
24 | #include "dbus-maybe.h" |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
25 | #include "debug.h" |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
26 | #include "enums.h" |
|
34582
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
27 | #include "network.h" |
|
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
28 | #include "pounce.h" |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
29 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
30 | static PurpleAccountUiOps *account_ui_ops = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
31 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
32 | static GList *accounts = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
33 | 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
|
34 | 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
|
35 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
36 | /********************************************************************* |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
37 | * Writing to disk * |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
38 | *********************************************************************/ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
39 | static PurpleXmlNode * |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
40 | accounts_to_xmlnode(void) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
41 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
42 | PurpleXmlNode *node, *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
43 | GList *cur; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
44 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
45 | 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
|
46 | 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
|
47 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
48 | for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
49 | { |
|
35178
7c775624f964
Move (_)purple_account_to_xmlnode to internal.h
Ankit Vani <a@nevitus.org>
parents:
35176
diff
changeset
|
50 | child = _purple_account_to_xmlnode(cur->data); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
51 | purple_xmlnode_insert_child(node, child); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
52 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
53 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
54 | return node; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
55 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
56 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
57 | static void |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
58 | sync_accounts(void) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
59 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
60 | PurpleXmlNode *node; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
61 | char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
62 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
63 | if (!accounts_loaded) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
64 | { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
65 | 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
|
66 | "they were read!\n"); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
67 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
68 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
69 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
70 | 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
|
71 | data = purple_xmlnode_to_formatted_str(node, NULL); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
72 | purple_util_write_data_to_file("accounts.xml", data, -1); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
73 | 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
|
74 | 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
|
75 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
76 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
77 | static gboolean |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
78 | save_cb(gpointer data) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
79 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
80 | sync_accounts(); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
81 | save_timer = 0; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
82 | return FALSE; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
83 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
84 | |
|
34582
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
85 | void |
|
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
86 | 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
|
87 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
88 | if (save_timer == 0) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
89 | save_timer = purple_timeout_add_seconds(5, save_cb, NULL); |
|
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 | /********************************************************************* |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
93 | * Reading from disk * |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
94 | *********************************************************************/ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
95 | static void |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
96 | migrate_yahoo_japan(PurpleAccount *account) |
|
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 | /* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
99 | * to use the new prpl-yahoojp. Also remove the account-specific settings |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
100 | * we no longer need */ |
|
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 | if(purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoo")) { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
103 | if(purple_account_get_bool(account, "yahoojp", FALSE)) { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
104 | const char *serverjp = purple_account_get_string(account, "serverjp", NULL); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
105 | const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
106 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
107 | g_return_if_fail(serverjp != NULL); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
108 | g_return_if_fail(xferjp_host != NULL); |
|
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 | purple_account_set_string(account, "server", serverjp); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
111 | purple_account_set_string(account, "xfer_host", xferjp_host); |
|
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 | purple_account_set_protocol_id(account, "prpl-yahoojp"); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
114 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
115 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
116 | /* these should always be nuked */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
117 | purple_account_remove_setting(account, "yahoojp"); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
118 | purple_account_remove_setting(account, "serverjp"); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
119 | purple_account_remove_setting(account, "xferjp_host"); |
|
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 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
122 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
123 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
124 | static void |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
125 | migrate_icq_server(PurpleAccount *account) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
126 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
127 | /* Migrate the login server setting for ICQ accounts. See |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
128 | * 'mtn log --last 1 --no-graph --from b6d7712e90b68610df3bd2d8cbaf46d94c8b3794' |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
129 | * for details on the change. */ |
|
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 | if(purple_strequal(purple_account_get_protocol_id(account), "prpl-icq")) { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
132 | const char *tmp = purple_account_get_string(account, "server", NULL); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
133 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
134 | /* Non-secure server */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
135 | if(purple_strequal(tmp, "login.messaging.aol.com") || |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
136 | purple_strequal(tmp, "login.oscar.aol.com")) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
137 | purple_account_set_string(account, "server", "login.icq.com"); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
138 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
139 | /* Secure server */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
140 | if(purple_strequal(tmp, "slogin.oscar.aol.com")) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
141 | purple_account_set_string(account, "server", "slogin.icq.com"); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
142 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
143 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
144 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
145 | static void |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
146 | 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
|
147 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
148 | /* 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
|
149 | 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
|
150 | 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
|
151 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
152 | 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
|
153 | 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
|
154 | 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
|
155 | val = "old_ssl"; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
156 | 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
|
157 | val = "opportunistic_tls"; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
158 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
159 | 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
|
160 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
161 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
162 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
163 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
164 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
165 | 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
|
166 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
167 | const char *ui; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
168 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
169 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
170 | /* Get the UI string, if these are UI settings */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
171 | ui = purple_xmlnode_get_attrib(node, "ui"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
172 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
173 | /* 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
|
174 | 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
|
175 | 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
|
176 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
177 | 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
|
178 | PurplePrefType type; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
179 | char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
180 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
181 | 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
|
182 | if (name == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
183 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
184 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
185 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
186 | 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
|
187 | if (str_type == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
188 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
189 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
190 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
191 | 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
|
192 | type = PURPLE_PREF_STRING; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
193 | 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
|
194 | type = PURPLE_PREF_INT; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
195 | 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
|
196 | type = PURPLE_PREF_BOOLEAN; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
197 | else |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
198 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
199 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
200 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
201 | 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
|
202 | if (data == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
203 | /* Ignore this setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
204 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
205 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
206 | if (ui == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
207 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
208 | if (type == PURPLE_PREF_STRING) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
209 | purple_account_set_string(account, name, data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
210 | else if (type == PURPLE_PREF_INT) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
211 | purple_account_set_int(account, name, atoi(data)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
212 | else if (type == PURPLE_PREF_BOOLEAN) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
213 | purple_account_set_bool(account, name, |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
214 | (*data == '0' ? FALSE : TRUE)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
215 | } else { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
216 | if (type == PURPLE_PREF_STRING) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
217 | purple_account_set_ui_string(account, ui, name, data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
218 | else if (type == PURPLE_PREF_INT) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
219 | purple_account_set_ui_int(account, ui, name, atoi(data)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
220 | else if (type == PURPLE_PREF_BOOLEAN) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
221 | purple_account_set_ui_bool(account, ui, name, |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
222 | (*data == '0' ? FALSE : TRUE)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
223 | } |
|
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 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
226 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
227 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
228 | /* we do this here because we need access to account settings to determine |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
229 | * if we can/should migrate an old Yahoo! JAPAN account */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
230 | migrate_yahoo_japan(account); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
231 | /* we do this here because we need access to account settings to determine |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
232 | * if we can/should migrate an ICQ account's server setting */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
233 | migrate_icq_server(account); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
234 | /* 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
|
235 | * Edit Account dialog. */ |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
236 | migrate_xmpp_encryption(account); |
|
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 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
239 | static GList * |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
240 | parse_status_attrs(PurpleXmlNode *node, PurpleStatus *status) |
|
34579
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 | GList *list = NULL; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
243 | PurpleXmlNode *child; |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
244 | GValue *attr_value; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
245 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
246 | for (child = purple_xmlnode_get_child(node, "attribute"); child != NULL; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
247 | 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
|
248 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
249 | const char *id = purple_xmlnode_get_attrib(child, "id"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
250 | const char *value = purple_xmlnode_get_attrib(child, "value"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
251 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
252 | if (!id || !*id || !value || !*value) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
253 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
254 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
255 | attr_value = purple_status_get_attr_value(status, id); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
256 | if (!attr_value) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
257 | continue; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
258 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
259 | list = g_list_append(list, (char *)id); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
260 | |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
261 | switch (G_VALUE_TYPE(attr_value)) |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
262 | { |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
263 | case G_TYPE_STRING: |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
264 | list = g_list_append(list, (char *)value); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
265 | break; |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
266 | case G_TYPE_INT: |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
267 | case G_TYPE_BOOLEAN: |
|
34579
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 | int v; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
270 | if (sscanf(value, "%d", &v) == 1) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
271 | list = g_list_append(list, GINT_TO_POINTER(v)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
272 | else |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
273 | list = g_list_remove(list, id); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
274 | break; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
275 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
276 | default: |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
277 | break; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
278 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
279 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
280 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
281 | return list; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
282 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
283 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
284 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
285 | parse_status(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
|
286 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
287 | gboolean active = FALSE; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
288 | const char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
289 | const char *type; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
290 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
291 | GList *attrs = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
292 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
293 | /* Get the active/inactive state */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
294 | data = purple_xmlnode_get_attrib(node, "active"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
295 | if (data == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
296 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
297 | if (g_ascii_strcasecmp(data, "true") == 0) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
298 | active = TRUE; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
299 | else if (g_ascii_strcasecmp(data, "false") == 0) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
300 | active = FALSE; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
301 | else |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
302 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
303 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
304 | /* Get the type of the status */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
305 | type = purple_xmlnode_get_attrib(node, "type"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
306 | if (type == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
307 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
308 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
309 | /* Read attributes into a GList */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
310 | child = purple_xmlnode_get_child(node, "attributes"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
311 | if (child != NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
312 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
313 | attrs = parse_status_attrs(child, |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
314 | purple_account_get_status(account, type)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
315 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
316 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
317 | purple_account_set_status_list(account, type, active, attrs); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
318 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
319 | g_list_free(attrs); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
320 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
321 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
322 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
323 | parse_statuses(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
|
324 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
325 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
326 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
327 | for (child = purple_xmlnode_get_child(node, "status"); child != NULL; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
328 | 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
|
329 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
330 | parse_status(child, account); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
331 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
332 | } |
|
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 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
335 | 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
|
336 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
337 | 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
|
338 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
339 | char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
340 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
341 | 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
|
342 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
343 | /* Use the global proxy settings, by default */ |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
344 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
345 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
346 | /* 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
|
347 | 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
|
348 | 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
|
349 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
350 | if (purple_strequal(data, "global")) |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
351 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
352 | else if (purple_strequal(data, "none")) |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
353 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_NONE); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
354 | else if (purple_strequal(data, "http")) |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
355 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_HTTP); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
356 | else if (purple_strequal(data, "socks4")) |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
357 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_SOCKS4); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
358 | else if (purple_strequal(data, "socks5")) |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
359 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_SOCKS5); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
360 | else if (purple_strequal(data, "tor")) |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
361 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_TOR); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
362 | else if (purple_strequal(data, "envvar")) |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
363 | purple_proxy_info_set_proxy_type(proxy_info, PURPLE_PROXY_USE_ENVVAR); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
364 | else |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
365 | { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
366 | purple_debug_error("accounts", "Invalid proxy type found when " |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
367 | "loading account information for %s\n", |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
368 | purple_account_get_username(account)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
369 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
370 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
371 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
372 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
373 | /* 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
|
374 | 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
|
375 | 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
|
376 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
377 | purple_proxy_info_set_host(proxy_info, data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
378 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
379 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
380 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
381 | /* 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
|
382 | 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
|
383 | 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
|
384 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
385 | 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
|
386 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
387 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
388 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
389 | /* 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
|
390 | 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
|
391 | 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
|
392 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
393 | 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
|
394 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
395 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
396 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
397 | /* 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
|
398 | 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
|
399 | 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
|
400 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
401 | 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
|
402 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
403 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
404 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
405 | /* If there are no values set then proxy_info NULL */ |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35178
diff
changeset
|
406 | if ((purple_proxy_info_get_proxy_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) && |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
407 | (purple_proxy_info_get_host(proxy_info) == NULL) && |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
408 | (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
|
409 | (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
|
410 | (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
|
411 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
412 | purple_proxy_info_destroy(proxy_info); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
413 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
414 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
415 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
416 | purple_account_set_proxy_info(account, proxy_info); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
417 | } |
|
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 | static void |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
420 | 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
|
421 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
422 | guint type; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
423 | 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
|
424 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
425 | PurpleConnectionErrorInfo *current_error = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
426 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
427 | 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
|
428 | 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
|
429 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
430 | type = atoi(type_str); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
431 | g_free(type_str); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
432 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
433 | if (type > PURPLE_CONNECTION_ERROR_OTHER_ERROR) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
434 | { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
435 | purple_debug_error("accounts", |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
436 | "Invalid PurpleConnectionError value %d found when " |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
437 | "loading account information for %s\n", |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
438 | type, purple_account_get_username(account)); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
439 | 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
|
440 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
441 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
442 | child = purple_xmlnode_get_child(node, "description"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
443 | if (child) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
444 | description = purple_xmlnode_get_data(child); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
445 | if (description == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
446 | description = g_strdup(""); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
447 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
448 | current_error = g_new0(PurpleConnectionErrorInfo, 1); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
449 | PURPLE_DBUS_REGISTER_POINTER(current_error, PurpleConnectionErrorInfo); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
450 | current_error->type = type; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
451 | current_error->description = description; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
452 | |
|
34767
38a5613c3e26
Prepended functions private to a subsystem but used over multiple files by underscore
Ankit Vani <a@nevitus.org>
parents:
34765
diff
changeset
|
453 | _purple_account_set_current_error(account, current_error); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
454 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
455 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
456 | static PurpleAccount * |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
457 | 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
|
458 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
459 | PurpleAccount *ret; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
460 | PurpleXmlNode *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
461 | char *protocol_id = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
462 | char *name = NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
463 | char *data; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
464 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
465 | child = purple_xmlnode_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
|
466 | 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
|
467 | 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
|
468 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
469 | 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
|
470 | 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
|
471 | 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
|
472 | if (name == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
473 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
474 | /* 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
|
475 | 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
|
476 | 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
|
477 | 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
|
478 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
479 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
480 | 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
|
481 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
482 | g_free(protocol_id); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
483 | g_free(name); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
484 | return NULL; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
485 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
486 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
487 | ret = purple_account_new(name, protocol_id); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
488 | g_free(name); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
489 | g_free(protocol_id); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
490 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
491 | /* 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
|
492 | 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
|
493 | 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
|
494 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
495 | if (*data != '\0') |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34588
diff
changeset
|
496 | purple_account_set_private_alias(ret, data); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
497 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
498 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
499 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
500 | /* Read the statuses */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
501 | child = purple_xmlnode_get_child(node, "statuses"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
502 | if (child != NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
503 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
504 | parse_statuses(child, ret); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
505 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
506 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
507 | /* 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
|
508 | 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
|
509 | 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
|
510 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
511 | 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
|
512 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
513 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
514 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
515 | /* Read an old buddyicon */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
516 | child = purple_xmlnode_get_child(node, "buddyicon"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
517 | 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
|
518 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
519 | const char *dirname = purple_buddy_icons_get_cache_dir(); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
520 | char *filename = g_build_filename(dirname, data, NULL); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
521 | gchar *contents; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
522 | gsize len; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
523 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
524 | if (g_file_get_contents(filename, &contents, &len, NULL)) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
525 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
526 | purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
527 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
528 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
529 | g_free(filename); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
530 | g_free(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
531 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
532 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
533 | /* 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
|
534 | 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
|
535 | 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
|
536 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
537 | parse_settings(child, ret); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
538 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
539 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
540 | /* Read proxy */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
541 | 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
|
542 | if (child != NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
543 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
544 | 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
|
545 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
546 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
547 | /* 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
|
548 | 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
|
549 | if (child != NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
550 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
551 | 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
|
552 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
553 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
554 | /* Read the password */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
555 | child = purple_xmlnode_get_child(node, "password"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
556 | if (child != NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
557 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
558 | const char *keyring_id = purple_xmlnode_get_attrib(child, "keyring_id"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
559 | const char *mode = purple_xmlnode_get_attrib(child, "mode"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
560 | gboolean result; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
561 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
562 | 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
|
563 | result = purple_keyring_import_password(ret, keyring_id, mode, data, NULL); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
564 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
565 | if (result == TRUE || purple_keyring_get_inuse() == NULL) { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
566 | purple_account_set_remember_password(ret, TRUE); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
567 | } else { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
568 | purple_debug_error("accounts", "Failed to import password.\n"); |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
569 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
570 | purple_str_wipe(data); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
571 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
572 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
573 | return ret; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
574 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
575 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
576 | static void |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
577 | load_accounts(void) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
578 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
579 | PurpleXmlNode *node, *child; |
|
34579
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
580 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
581 | accounts_loaded = TRUE; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
582 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
583 | node = purple_util_read_xml_from_file("accounts.xml", _("accounts")); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
584 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
585 | if (node == NULL) |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
586 | return; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
587 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
588 | for (child = purple_xmlnode_get_child(node, "account"); child != NULL; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
589 | 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
|
590 | { |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
591 | PurpleAccount *new_acct; |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
592 | new_acct = parse_account(child); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
593 | purple_accounts_add(new_acct); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
594 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
595 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34889
diff
changeset
|
596 | 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
|
597 | |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
598 | _purple_buddy_icons_account_loaded_cb(); |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
599 | } |
|
e718d0eea155
Moved some local functions from account.c to accounts.c
Ankit Vani <a@nevitus.org>
parents:
34574
diff
changeset
|
600 | |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
601 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
602 | purple_accounts_add(PurpleAccount *account) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
603 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
604 | g_return_if_fail(account != NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
605 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
606 | if (g_list_find(accounts, account) != NULL) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
607 | return; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
608 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
609 | accounts = g_list_append(accounts, account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
610 | |
|
34582
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
611 | purple_accounts_schedule_save(); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
612 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
613 | purple_signal_emit(purple_accounts_get_handle(), "account-added", account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
614 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
615 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
616 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
617 | purple_accounts_remove(PurpleAccount *account) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
618 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
619 | g_return_if_fail(account != NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
620 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
621 | accounts = g_list_remove(accounts, account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
622 | |
|
34582
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
623 | purple_accounts_schedule_save(); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
624 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
625 | /* Clearing the error ensures that account-error-changed is emitted, |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
626 | * which is the end of the guarantee that the the error's pointer is |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
627 | * valid. |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
628 | */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
629 | purple_account_clear_current_error(account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
630 | purple_signal_emit(purple_accounts_get_handle(), "account-removed", account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
631 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
632 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
633 | static void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
634 | purple_accounts_delete_set(PurpleAccount *account, GError *error, gpointer data) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
635 | { |
|
34588
1379416703af
Removed purple_account_destroy function declaration, use g_object_unref() instead.
Ankit Vani <a@nevitus.org>
parents:
34582
diff
changeset
|
636 | g_object_unref(G_OBJECT(account)); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
637 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
638 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
639 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
640 | purple_accounts_delete(PurpleAccount *account) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
641 | { |
|
34864
0e292d8887de
Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents:
34812
diff
changeset
|
642 | PurpleBlistNode *gnode, *cnode, *bnode; |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
643 | GList *iter; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
644 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
645 | g_return_if_fail(account != NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
646 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
647 | /* |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
648 | * 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
|
649 | * 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
|
650 | * 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
|
651 | * but it doesn't really matter. |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
652 | */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
653 | purple_account_set_enabled(account, purple_core_get_ui(), FALSE); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
654 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
655 | purple_notify_close_with_handle(account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
656 | purple_request_close_with_handle(account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
657 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
658 | purple_accounts_remove(account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
659 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
660 | /* Remove this account's buddies */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
661 | for (gnode = purple_blist_get_root(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
662 | gnode != NULL; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
663 | gnode = purple_blist_node_get_sibling_next(gnode)) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
664 | { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
665 | if (!PURPLE_IS_GROUP(gnode)) |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
666 | continue; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
667 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
668 | cnode = purple_blist_node_get_first_child(gnode); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
669 | while (cnode) { |
|
34864
0e292d8887de
Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents:
34812
diff
changeset
|
670 | PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
671 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
672 | if(PURPLE_IS_CONTACT(cnode)) { |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
673 | bnode = purple_blist_node_get_first_child(cnode); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
674 | while (bnode) { |
|
34864
0e292d8887de
Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents:
34812
diff
changeset
|
675 | PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
676 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
677 | if (PURPLE_IS_BUDDY(bnode)) { |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
678 | PurpleBuddy *b = (PurpleBuddy *)bnode; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
679 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
680 | if (purple_buddy_get_account(b) == account) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
681 | purple_blist_remove_buddy(b); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
682 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
683 | bnode = bnode_next; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
684 | } |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34656
diff
changeset
|
685 | } else if (PURPLE_IS_CHAT(cnode)) { |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
686 | PurpleChat *c = (PurpleChat *)cnode; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
687 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
688 | if (purple_chat_get_account(c) == account) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
689 | purple_blist_remove_chat(c); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
690 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
691 | cnode = cnode_next; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
692 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
693 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
694 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
695 | /* Remove any open conversation for this account */ |
|
34656
adbcbe04077c
Refactored remaining libpurple to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34645
diff
changeset
|
696 | for (iter = purple_conversations_get_all(); iter; ) { |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
697 | PurpleConversation *conv = iter->data; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
698 | iter = iter->next; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
699 | 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
|
700 | g_object_unref(conv); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
701 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
702 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
703 | /* Remove this account's pounces */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
704 | purple_pounce_destroy_all_by_account(account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
705 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
706 | /* This will cause the deletion of an old buddy icon. */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
707 | purple_buddy_icons_set_account_icon(account, NULL, 0); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
708 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
709 | /* 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
|
710 | * 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
|
711 | */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
712 | purple_keyring_set_password(account, NULL, |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
713 | purple_accounts_delete_set, NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
714 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
715 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
716 | void |
| 34889 | 717 | purple_accounts_reorder(PurpleAccount *account, guint new_index) |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
718 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
719 | gint index; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
720 | GList *l; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
721 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
722 | g_return_if_fail(account != NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
723 | g_return_if_fail(new_index <= g_list_length(accounts)); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
724 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
725 | index = g_list_index(accounts, account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
726 | |
| 34889 | 727 | if (index < 0) { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
728 | purple_debug_error("accounts", |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
729 | "Unregistered account (%s) discovered during reorder!\n", |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
730 | purple_account_get_username(account)); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
731 | return; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
732 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
733 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
734 | l = g_list_nth(accounts, index); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
735 | |
| 34889 | 736 | if (new_index > (guint)index) |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
737 | new_index--; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
738 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
739 | /* Remove the old one. */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
740 | accounts = g_list_delete_link(accounts, l); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
741 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
742 | /* Insert it where it should go. */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
743 | accounts = g_list_insert(accounts, account, new_index); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
744 | |
|
34582
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
745 | purple_accounts_schedule_save(); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
746 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
747 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
748 | GList * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
749 | purple_accounts_get_all(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
750 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
751 | return accounts; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
752 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
753 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
754 | GList * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
755 | purple_accounts_get_all_active(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
756 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
757 | GList *list = NULL; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
758 | GList *all = purple_accounts_get_all(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
759 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
760 | while (all != NULL) { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
761 | PurpleAccount *account = all->data; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
762 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
763 | if (purple_account_get_enabled(account, purple_core_get_ui())) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
764 | list = g_list_append(list, account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
765 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
766 | all = all->next; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
767 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
768 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
769 | return list; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
770 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
771 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
772 | PurpleAccount * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
773 | purple_accounts_find(const char *name, const char *protocol_id) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
774 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
775 | PurpleAccount *account = NULL; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
776 | GList *l; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
777 | char *who; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
778 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
779 | g_return_val_if_fail(name != NULL, NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
780 | g_return_val_if_fail(protocol_id != NULL, NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
781 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
782 | for (l = purple_accounts_get_all(); l != NULL; l = l->next) { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
783 | account = (PurpleAccount *)l->data; |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
784 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
785 | if (!purple_strequal(purple_account_get_protocol_id(account), protocol_id)) |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
786 | continue; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
787 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
788 | who = g_strdup(purple_normalize(account, name)); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
789 | if (purple_strequal(purple_normalize(account, purple_account_get_username(account)), who)) { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
790 | g_free(who); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
791 | return account; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
792 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
793 | g_free(who); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
794 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
795 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
796 | return NULL; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
797 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
798 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
799 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
800 | purple_accounts_restore_current_statuses() |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
801 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
802 | GList *l; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
803 | PurpleAccount *account; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
804 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
805 | /* If we're not connected to the Internet right now, we bail on this */ |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
806 | if (!purple_network_is_available()) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
807 | { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35091
diff
changeset
|
808 | purple_debug_warning("accounts", "Network not connected; skipping reconnect\n"); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
809 | return; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
810 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
811 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
812 | for (l = purple_accounts_get_all(); l != NULL; l = l->next) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
813 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
814 | account = (PurpleAccount *)l->data; |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
815 | |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
816 | if (purple_account_get_enabled(account, purple_core_get_ui()) && |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
817 | (purple_presence_is_online(purple_account_get_presence(account)))) |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
818 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
819 | purple_account_connect(account); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
820 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
821 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
822 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
823 | |
| 35572 | 824 | static PurpleAccountUiOps * |
| 825 | purple_account_ui_ops_copy(PurpleAccountUiOps *ops) | |
| 826 | { | |
| 827 | PurpleAccountUiOps *ops_new; | |
| 828 | ||
| 829 | g_return_val_if_fail(ops != NULL, NULL); | |
| 830 | ||
| 831 | ops_new = g_new(PurpleAccountUiOps, 1); | |
| 832 | *ops_new = *ops; | |
| 833 | ||
| 834 | return ops_new; | |
| 835 | } | |
| 836 | ||
| 837 | GType | |
| 838 | purple_account_ui_ops_get_type(void) | |
| 839 | { | |
| 840 | static GType type = 0; | |
| 841 | ||
| 842 | if (type == 0) { | |
| 843 | type = g_boxed_type_register_static("PurpleAccountUiOps", | |
| 844 | (GBoxedCopyFunc)purple_account_ui_ops_copy, | |
|
35597
7fcfcf147b99
Use g_free as UiOps structures GBoxed free function
Ankit Vani <a@nevitus.org>
parents:
35572
diff
changeset
|
845 | (GBoxedFreeFunc)g_free); |
| 35572 | 846 | } |
| 847 | ||
| 848 | return type; | |
| 849 | } | |
| 850 | ||
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
851 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
852 | purple_accounts_set_ui_ops(PurpleAccountUiOps *ops) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
853 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
854 | account_ui_ops = ops; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
855 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
856 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
857 | PurpleAccountUiOps * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
858 | purple_accounts_get_ui_ops(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
859 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
860 | return account_ui_ops; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
861 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
862 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
863 | void * |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
864 | purple_accounts_get_handle(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
865 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
866 | static int handle; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
867 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
868 | return &handle; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
869 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
870 | |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
871 | static void |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
872 | signed_on_cb(PurpleConnection *gc, |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
873 | gpointer unused) |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
874 | { |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
875 | PurpleAccount *account = purple_connection_get_account(gc); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
876 | purple_account_clear_current_error(account); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
877 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
878 | purple_signal_emit(purple_accounts_get_handle(), "account-signed-on", |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
879 | account); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
880 | } |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
881 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
882 | static void |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
883 | signed_off_cb(PurpleConnection *gc, |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
884 | gpointer unused) |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
885 | { |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
886 | PurpleAccount *account = purple_connection_get_account(gc); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
887 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
888 | purple_signal_emit(purple_accounts_get_handle(), "account-signed-off", |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
889 | account); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
890 | } |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
891 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
892 | static void |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
893 | connection_error_cb(PurpleConnection *gc, |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
894 | PurpleConnectionError type, |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
895 | const gchar *description, |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
896 | gpointer unused) |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
897 | { |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
898 | PurpleAccount *account; |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
899 | PurpleConnectionErrorInfo *err; |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
900 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
901 | account = purple_connection_get_account(gc); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
902 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
903 | g_return_if_fail(account != NULL); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
904 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
905 | err = g_new0(PurpleConnectionErrorInfo, 1); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
906 | PURPLE_DBUS_REGISTER_POINTER(err, PurpleConnectionErrorInfo); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
907 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
908 | err->type = type; |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
909 | err->description = g_strdup(description); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
910 | |
|
34767
38a5613c3e26
Prepended functions private to a subsystem but used over multiple files by underscore
Ankit Vani <a@nevitus.org>
parents:
34765
diff
changeset
|
911 | _purple_account_set_current_error(account, err); |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
912 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
913 | purple_signal_emit(purple_accounts_get_handle(), "account-connection-error", |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
914 | account, type, description); |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
915 | } |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
916 | |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
917 | static void |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
918 | password_migration_cb(PurpleAccount *account) |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
919 | { |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
920 | /* account may be NULL (means: all) */ |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
921 | |
|
34582
67a520874aa9
Exposed some functions to the header files to resolve dependencies.
Ankit Vani <a@nevitus.org>
parents:
34581
diff
changeset
|
922 | purple_accounts_schedule_save(); |
|
34581
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
923 | } |
|
b4e0236019e6
Fixed more PurpleAccount stuff.
Ankit Vani <a@nevitus.org>
parents:
34580
diff
changeset
|
924 | |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
925 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
926 | purple_accounts_init(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
927 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
928 | void *handle = purple_accounts_get_handle(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
929 | 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
|
930 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
931 | purple_signal_register(handle, "account-connecting", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
932 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
933 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
934 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
935 | purple_signal_register(handle, "account-disabled", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
936 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
937 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
938 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
939 | purple_signal_register(handle, "account-enabled", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
940 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
941 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
942 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
943 | purple_signal_register(handle, "account-setting-info", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
944 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
945 | PURPLE_TYPE_ACCOUNT, G_TYPE_STRING); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
946 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
947 | purple_signal_register(handle, "account-set-info", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
948 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
949 | PURPLE_TYPE_ACCOUNT, G_TYPE_STRING); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
950 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
951 | purple_signal_register(handle, "account-created", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
952 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
953 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
954 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
955 | purple_signal_register(handle, "account-destroying", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
956 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
957 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
958 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
959 | purple_signal_register(handle, "account-added", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
960 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
961 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
962 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
963 | purple_signal_register(handle, "account-removed", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
964 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
965 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
966 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
967 | purple_signal_register(handle, "account-status-changed", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
968 | purple_marshal_VOID__POINTER_POINTER_POINTER, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
969 | G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
970 | PURPLE_TYPE_STATUS, PURPLE_TYPE_STATUS); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
971 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
972 | purple_signal_register(handle, "account-actions-changed", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
973 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
974 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
975 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
976 | purple_signal_register(handle, "account-alias-changed", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
977 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
978 | PURPLE_TYPE_ACCOUNT, G_TYPE_STRING); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
979 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
980 | purple_signal_register(handle, "account-authorization-requested", |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
981 | purple_marshal_INT__POINTER_POINTER_POINTER, |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
982 | G_TYPE_INT, 4, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
983 | G_TYPE_STRING, G_TYPE_STRING); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
984 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
985 | purple_signal_register(handle, "account-authorization-denied", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
986 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 3, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
987 | PURPLE_TYPE_ACCOUNT, G_TYPE_STRING, G_TYPE_STRING); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
988 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
989 | purple_signal_register(handle, "account-authorization-granted", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
990 | purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 3, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
991 | PURPLE_TYPE_ACCOUNT, G_TYPE_STRING, G_TYPE_STRING); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
992 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
993 | purple_signal_register(handle, "account-error-changed", |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
994 | purple_marshal_VOID__POINTER_POINTER_POINTER, |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
995 | G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
996 | PURPLE_TYPE_CONNECTION_ERROR_INFO, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
997 | PURPLE_TYPE_CONNECTION_ERROR_INFO); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
998 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
999 | purple_signal_register(handle, "account-signed-on", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
1000 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
1001 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1002 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1003 | purple_signal_register(handle, "account-signed-off", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
1004 | purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
1005 | PURPLE_TYPE_ACCOUNT); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1006 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1007 | purple_signal_register(handle, "account-connection-error", |
|
34812
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
1008 | purple_marshal_VOID__POINTER_INT_POINTER, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
1009 | G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT, |
|
3d6f7d9dc21d
Refactored account, buddylist, certificate to use GType and GValue instead of PurpleType and PurpleValue
Ankit Vani <a@nevitus.org>
parents:
34767
diff
changeset
|
1010 | PURPLE_TYPE_CONNECTION_ERROR, G_TYPE_STRING); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1011 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1012 | purple_signal_connect(conn_handle, "signed-on", handle, |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1013 | PURPLE_CALLBACK(signed_on_cb), NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1014 | purple_signal_connect(conn_handle, "signed-off", handle, |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1015 | PURPLE_CALLBACK(signed_off_cb), NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1016 | purple_signal_connect(conn_handle, "connection-error", handle, |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1017 | PURPLE_CALLBACK(connection_error_cb), NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1018 | purple_signal_connect(purple_keyring_get_handle(), "password-migration", handle, |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1019 | PURPLE_CALLBACK(password_migration_cb), NULL); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1020 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1021 | load_accounts(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1022 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1023 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1024 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1025 | void |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1026 | purple_accounts_uninit(void) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1027 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1028 | gpointer handle = purple_accounts_get_handle(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1029 | if (save_timer != 0) |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1030 | { |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1031 | purple_timeout_remove(save_timer); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1032 | save_timer = 0; |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1033 | sync_accounts(); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1034 | } |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1035 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1036 | for (; accounts; accounts = g_list_delete_link(accounts, accounts)) |
|
34588
1379416703af
Removed purple_account_destroy function declaration, use g_object_unref() instead.
Ankit Vani <a@nevitus.org>
parents:
34582
diff
changeset
|
1037 | g_object_unref(G_OBJECT(accounts->data)); |
|
34574
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1038 | |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1039 | purple_signals_disconnect_by_handle(handle); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1040 | purple_signals_unregister_by_instance(handle); |
|
19850cd1b2de
Begun GObjectification of PurpleAccount. Moved things around, see details.
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1041 | } |