annotate libpurple/account.c @ 32636:a617a949e545

Doxygen was complaining about this not being a valid whatchamadinger, so escape it.
author Mark Doliner <mark@kingant.net>
date Sun, 18 Sep 2011 20:20:02 +0000
parents cd1d9e04c587
children cd2254bf8fa9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file account.c Account API
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup core
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19696
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19696
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19696
diff changeset
6 /* purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19604
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "core.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "dbus-maybe.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "network.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "pounce.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "privacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "server.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "signals.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include "status.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 #include "xmlnode.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
44 typedef struct
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
45 {
21377
872068d10eab Mark pointed out that PurpleConnectionErrorPair is not a very good name for the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21374
diff changeset
46 PurpleConnectionErrorInfo *current_error;
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
47 } PurpleAccountPrivate;
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
48
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
49 #define PURPLE_ACCOUNT_GET_PRIVATE(account) \
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
50 ((PurpleAccountPrivate *) (account->priv))
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
51
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
52 /* TODO: Should use PurpleValue instead of this? What about "ui"? */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 typedef struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
55 PurplePrefType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 char *ui;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 union
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 int integer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 char *string;
20354
01101467094f applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20251
diff changeset
63 gboolean boolean;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 } value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
67 } PurpleAccountSetting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
69 typedef struct
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
70 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
71 PurpleAccountRequestType type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
72 PurpleAccount *account;
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
73 void *ui_handle;
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
74 char *user;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
75 gpointer userdata;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
76 PurpleAccountRequestAuthorizationCb auth_cb;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
77 PurpleAccountRequestAuthorizationCb deny_cb;
24644
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
78 guint ref;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
79 } PurpleAccountRequestInfo;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
80
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
81 static PurpleAccountUiOps *account_ui_ops = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 static GList *accounts = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 static guint save_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 static gboolean accounts_loaded = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
87 static GList *handles = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
89 static void set_current_error(PurpleAccount *account,
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
90 PurpleConnectionErrorInfo *new_err);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
91
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 /*********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 * Writing to disk *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 *********************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 const char *name;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
100 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 xmlnode *node, *child;
26967
8290e36a5a73 A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents: 26845
diff changeset
102 char buf[21];
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 name = (const char *)key;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
105 setting = (PurpleAccountSetting *)value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 node = (xmlnode *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 child = xmlnode_new_child(node, "setting");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 xmlnode_set_attrib(child, "name", name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
111 if (setting->type == PURPLE_PREF_INT) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 xmlnode_set_attrib(child, "type", "int");
26967
8290e36a5a73 A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents: 26845
diff changeset
113 g_snprintf(buf, sizeof(buf), "%d", setting->value.integer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 xmlnode_insert_data(child, buf, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
116 else if (setting->type == PURPLE_PREF_STRING && setting->value.string != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 xmlnode_set_attrib(child, "type", "string");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 xmlnode_insert_data(child, setting->value.string, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
120 else if (setting->type == PURPLE_PREF_BOOLEAN) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 xmlnode_set_attrib(child, "type", "bool");
26967
8290e36a5a73 A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents: 26845
diff changeset
122 g_snprintf(buf, sizeof(buf), "%d", setting->value.boolean);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 xmlnode_insert_data(child, buf, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 const char *ui;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 xmlnode *node, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 ui = (const char *)key;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 table = (GHashTable *)value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 node = (xmlnode *)user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 if (g_hash_table_size(table) > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 child = xmlnode_new_child(node, "settings");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 xmlnode_set_attrib(child, "ui", ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 g_hash_table_foreach(table, setting_to_xmlnode, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
147 status_attr_to_xmlnode(const PurpleStatus *status, const PurpleStatusType *type, const PurpleStatusAttr *attr)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 xmlnode *node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 const char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 char *value = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
152 PurpleStatusAttr *default_attr;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
153 PurpleValue *default_value;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
154 PurpleType attr_type;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
155 PurpleValue *attr_value;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
156
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
157 id = purple_status_attr_get_id(attr);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 g_return_val_if_fail(id, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
160 attr_value = purple_status_get_attr_value(status, id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 g_return_val_if_fail(attr_value, NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
162 attr_type = purple_value_get_type(attr_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 * If attr_value is a different type than it should be
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 * then don't write it to the file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
168 default_attr = purple_status_type_get_attr(type, id);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
169 default_value = purple_status_attr_get_value(default_attr);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
170 if (attr_type != purple_value_get_type(default_value))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 * If attr_value is the same as the default for this status
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 * then there is no need to write it to the file.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
177 if (attr_type == PURPLE_TYPE_STRING)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
179 const char *string_value = purple_value_get_string(attr_value);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
180 const char *default_string_value = purple_value_get_string(default_value);
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
181 if (purple_strequal(string_value, default_string_value))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 return NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
183 value = g_strdup(purple_value_get_string(attr_value));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
185 else if (attr_type == PURPLE_TYPE_INT)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
187 int int_value = purple_value_get_int(attr_value);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
188 if (int_value == purple_value_get_int(default_value))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 value = g_strdup_printf("%d", int_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
192 else if (attr_type == PURPLE_TYPE_BOOLEAN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
194 gboolean boolean_value = purple_value_get_boolean(attr_value);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
195 if (boolean_value == purple_value_get_boolean(default_value))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 value = g_strdup(boolean_value ?
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 "true" : "false");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 g_return_val_if_fail(value, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 node = xmlnode_new("attribute");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 xmlnode_set_attrib(node, "id", id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 xmlnode_set_attrib(node, "value", value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 g_free(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
218 status_attrs_to_xmlnode(const PurpleStatus *status)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
220 PurpleStatusType *type = purple_status_get_type(status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 xmlnode *node, *child;
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18063
diff changeset
222 GList *attrs, *attr;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 node = xmlnode_new("attributes");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
226 attrs = purple_status_type_get_attrs(type);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 for (attr = attrs; attr != NULL; attr = attr->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
229 child = status_attr_to_xmlnode(status, type, (const PurpleStatusAttr *)attr->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 if (child)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
238 status_to_xmlnode(const PurpleStatus *status)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 xmlnode *node, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 node = xmlnode_new("status");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
243 xmlnode_set_attrib(node, "type", purple_status_get_id(status));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
244 if (purple_status_get_name(status) != NULL)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
245 xmlnode_set_attrib(node, "name", purple_status_get_name(status));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
246 xmlnode_set_attrib(node, "active", purple_status_is_active(status) ? "true" : "false");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 child = status_attrs_to_xmlnode(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
255 statuses_to_xmlnode(const PurplePresence *presence)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 xmlnode *node, *child;
24973
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
258 GList *statuses;
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
259 PurpleStatus *status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 node = xmlnode_new("statuses");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
263 statuses = purple_presence_get_statuses(presence);
24973
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
264 for (; statuses != NULL; statuses = statuses->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 {
24973
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
266 status = statuses->data;
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
267 if (purple_status_type_is_saveable(purple_status_get_type(status)))
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
268 {
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
269 child = status_to_xmlnode(status);
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
270 xmlnode_insert_child(node, child);
ff883620d9d4 Thomas Gibson-Robinson noticed that the "saveable" attribute of a status type
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24644
diff changeset
271 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
278 proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 xmlnode *node, *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
281 PurpleProxyType proxy_type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 const char *value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 int int_value;
26967
8290e36a5a73 A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents: 26845
diff changeset
284 char buf[21];
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
286 proxy_type = purple_proxy_info_get_type(proxy_info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 node = xmlnode_new("proxy");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 child = xmlnode_new_child(node, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 xmlnode_insert_data(child,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
292 (proxy_type == PURPLE_PROXY_USE_GLOBAL ? "global" :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
293 proxy_type == PURPLE_PROXY_NONE ? "none" :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
294 proxy_type == PURPLE_PROXY_HTTP ? "http" :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
295 proxy_type == PURPLE_PROXY_SOCKS4 ? "socks4" :
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
296 proxy_type == PURPLE_PROXY_SOCKS5 ? "socks5" :
31929
9a7c5d242521 Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be
Daniel Atallah <daniel.atallah@gmail.com>
parents: 31846
diff changeset
297 proxy_type == PURPLE_PROXY_TOR ? "tor" :
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
298 proxy_type == PURPLE_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
299
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
300 if ((value = purple_proxy_info_get_host(proxy_info)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 child = xmlnode_new_child(node, "host");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 xmlnode_insert_data(child, value, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
306 if ((int_value = purple_proxy_info_get_port(proxy_info)) != 0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 {
26967
8290e36a5a73 A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents: 26845
diff changeset
308 g_snprintf(buf, sizeof(buf), "%d", int_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 child = xmlnode_new_child(node, "port");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 xmlnode_insert_data(child, buf, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
313 if ((value = purple_proxy_info_get_username(proxy_info)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 child = xmlnode_new_child(node, "username");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 xmlnode_insert_data(child, value, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
319 if ((value = purple_proxy_info_get_password(proxy_info)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 child = xmlnode_new_child(node, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 xmlnode_insert_data(child, value, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 static xmlnode *
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
329 current_error_to_xmlnode(PurpleConnectionErrorInfo *err)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
330 {
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
331 xmlnode *node, *child;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
332 char type_str[3];
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
333
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
334 node = xmlnode_new("current_error");
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
335
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
336 if(err == NULL)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
337 return node;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
338
21846
717176f247ab Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21813
diff changeset
339 /* It doesn't make sense to have transient errors persist across a
717176f247ab Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21813
diff changeset
340 * restart.
717176f247ab Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21813
diff changeset
341 */
717176f247ab Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21813
diff changeset
342 if(!purple_connection_error_is_fatal (err->type))
717176f247ab Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21813
diff changeset
343 return node;
717176f247ab Don't bother making transient connection errors persist across a restart.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21813
diff changeset
344
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
345 child = xmlnode_new_child(node, "type");
26967
8290e36a5a73 A patch from Scott Wolchok to replace snprintf() with g_snprintf() and
Richard Laager <rlaager@wiktel.com>
parents: 26845
diff changeset
346 g_snprintf(type_str, sizeof(type_str), "%u", err->type);
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
347 xmlnode_insert_data(child, type_str, -1);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
348
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
349 child = xmlnode_new_child(node, "description");
21813
d62d7412eca4 Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents: 21792
diff changeset
350 if(err->description) {
d62d7412eca4 Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents: 21792
diff changeset
351 char *utf8ized = purple_utf8_try_convert(err->description);
d62d7412eca4 Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents: 21792
diff changeset
352 if(utf8ized == NULL)
d62d7412eca4 Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents: 21792
diff changeset
353 utf8ized = purple_utf8_salvage(err->description);
d62d7412eca4 Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents: 21792
diff changeset
354 xmlnode_insert_data(child, utf8ized, -1);
d62d7412eca4 Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents: 21792
diff changeset
355 g_free(utf8ized);
d62d7412eca4 Ensure that an error's description actually is UTF-8 before writing it out to
Will Thompson <will.thompson@collabora.co.uk>
parents: 21792
diff changeset
356 }
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
357
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
358 return node;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
359 }
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
360
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
361 static xmlnode *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
362 account_to_xmlnode(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 {
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
364 PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
365
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 xmlnode *node, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 const char *tmp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
368 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
369 PurpleProxyInfo *proxy_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 node = xmlnode_new("account");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 child = xmlnode_new_child(node, "protocol");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
374 xmlnode_insert_data(child, purple_account_get_protocol_id(account), -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 child = xmlnode_new_child(node, "name");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
377 xmlnode_insert_data(child, purple_account_get_username(account), -1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
378
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
379 if (purple_account_get_remember_password(account) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
380 ((tmp = purple_account_get_password(account)) != NULL))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 child = xmlnode_new_child(node, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 xmlnode_insert_data(child, tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
386 if ((tmp = purple_account_get_alias(account)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 child = xmlnode_new_child(node, "alias");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 xmlnode_insert_data(child, tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
392 if ((presence = purple_account_get_presence(account)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 child = statuses_to_xmlnode(presence);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
398 if ((tmp = purple_account_get_user_info(account)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
400 /* TODO: Do we need to call purple_str_strip_char(tmp, '\r') here? */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 child = xmlnode_new_child(node, "userinfo");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 xmlnode_insert_data(child, tmp, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 if (g_hash_table_size(account->settings) > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 child = xmlnode_new_child(node, "settings");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 g_hash_table_foreach(account->settings, setting_to_xmlnode, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 if (g_hash_table_size(account->ui_settings) > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 g_hash_table_foreach(account->ui_settings, ui_setting_to_xmlnode, node);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
416 if ((proxy_info = purple_account_get_proxy_info(account)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 child = proxy_settings_to_xmlnode(proxy_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
422 child = current_error_to_xmlnode(priv->current_error);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
423 xmlnode_insert_child(node, child);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
424
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 static xmlnode *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 accounts_to_xmlnode(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 xmlnode *node, *child;
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
432 GList *cur;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 node = xmlnode_new("account");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 xmlnode_set_attrib(node, "version", "1.0");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
437 for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 child = account_to_xmlnode(cur->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 xmlnode_insert_child(node, child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 return node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 sync_accounts(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 xmlnode *node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 char *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 if (!accounts_loaded)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
454 purple_debug_error("account", "Attempted to save accounts before "
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 "they were read!\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 node = accounts_to_xmlnode();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 data = xmlnode_to_formatted_str(node, NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
461 purple_util_write_data_to_file("accounts.xml", data, -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 xmlnode_free(node);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 save_cb(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 sync_accounts();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 save_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 static void
22007
c38d72677c8a Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents: 21937
diff changeset
475 schedule_accounts_save(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 if (save_timer == 0)
18006
f2d8658b3a86 merge of '62e9d17cd37551991c5040ce6ca48e6d7578dde3'
Richard Laager <rlaager@wiktel.com>
parents: 17095
diff changeset
478 save_timer = purple_timeout_add_seconds(5, save_cb, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 /*********************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 * Reading from disk *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 *********************************************************************/
27402
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
485 static void
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
486 migrate_yahoo_japan(PurpleAccount *account)
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
487 {
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
488 /* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
489 * to use the new prpl-yahoojp. Also remove the account-specific settings
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
490 * we no longer need */
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
491
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
492 if(purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoo")) {
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
493 if(purple_account_get_bool(account, "yahoojp", FALSE)) {
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
494 const char *serverjp = purple_account_get_string(account, "serverjp", NULL);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
495 const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
496
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
497 g_return_if_fail(serverjp != NULL);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
498 g_return_if_fail(xferjp_host != NULL);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
499
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
500 purple_account_set_string(account, "server", serverjp);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
501 purple_account_set_string(account, "xfer_host", xferjp_host);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
502
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
503 purple_account_set_protocol_id(account, "prpl-yahoojp");
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
504 }
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
505
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
506 /* these should always be nuked */
27403
76a13febd641 I forgot to remove the old bool setting for Yahoo! JAPAN.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27402
diff changeset
507 purple_account_remove_setting(account, "yahoojp");
27402
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
508 purple_account_remove_setting(account, "serverjp");
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
509 purple_account_remove_setting(account, "xferjp_host");
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
510
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
511 }
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
512 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 static void
31087
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
515 migrate_icq_server(PurpleAccount *account)
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
516 {
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
517 /* Migrate the login server setting for ICQ accounts. See
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
518 * 'mtn log --last 1 --no-graph --from b6d7712e90b68610df3bd2d8cbaf46d94c8b3794'
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
519 * for details on the change. */
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
520
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
521 if(purple_strequal(purple_account_get_protocol_id(account), "prpl-icq")) {
31090
d81cca013782 warnings--
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31089
diff changeset
522 const char *tmp = purple_account_get_string(account, "server", NULL);
31089
f3e3e7fecf34 Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31087
diff changeset
523
31087
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
524 /* Non-secure server */
31089
f3e3e7fecf34 Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31087
diff changeset
525 if(purple_strequal(tmp, "login.messaging.aol.com") ||
f3e3e7fecf34 Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31087
diff changeset
526 purple_strequal(tmp, "login.oscar.aol.com"))
31087
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
527 purple_account_set_string(account, "server", "login.icq.com");
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
528
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
529 /* Secure server */
31089
f3e3e7fecf34 Tweak the login server migration for ICQ:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31087
diff changeset
530 if(purple_strequal(tmp, "slogin.oscar.aol.com"))
31087
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
531 purple_account_set_string(account, "server", "slogin.icq.com");
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
532 }
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
533 }
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
534
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
535 static void
30895
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
536 migrate_xmpp_encryption(PurpleAccount *account)
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
537 {
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
538 /* When this is removed, nuke the "old_ssl" and "require_tls" settings */
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
539 if (g_str_equal(purple_account_get_protocol_id(account), "prpl-jabber")) {
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
540 const char *sec = purple_account_get_string(account, "connection_security", "");
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
541
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
542 if (g_str_equal("", sec)) {
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
543 const char *val = "require_tls";
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
544 if (purple_account_get_bool(account, "old_ssl", FALSE))
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
545 val = "old_ssl";
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
546 else if (!purple_account_get_bool(account, "require_tls", TRUE))
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
547 val = "opportunistic_tls";
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
548
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
549 purple_account_set_string(account, "connection_security", val);
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
550 }
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
551 }
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
552 }
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
553
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
554 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
555 parse_settings(xmlnode *node, PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 const char *ui;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 /* Get the UI string, if these are UI settings */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 ui = xmlnode_get_attrib(node, "ui");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 /* Read settings, one by one */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 for (child = xmlnode_get_child(node, "setting"); child != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 child = xmlnode_get_next_twin(child))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 const char *name, *str_type;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
568 PurplePrefType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 char *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 name = xmlnode_get_attrib(child, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 if (name == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 /* Ignore this setting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 str_type = xmlnode_get_attrib(child, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 if (str_type == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 /* Ignore this setting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
581 if (purple_strequal(str_type, "string"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
582 type = PURPLE_PREF_STRING;
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
583 else if (purple_strequal(str_type, "int"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
584 type = PURPLE_PREF_INT;
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
585 else if (purple_strequal(str_type, "bool"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
586 type = PURPLE_PREF_BOOLEAN;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 /* Ignore this setting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 data = xmlnode_get_data(child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 /* Ignore this setting */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 if (ui == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
598 if (type == PURPLE_PREF_STRING)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
599 purple_account_set_string(account, name, data);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
600 else if (type == PURPLE_PREF_INT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
601 purple_account_set_int(account, name, atoi(data));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
602 else if (type == PURPLE_PREF_BOOLEAN)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
603 purple_account_set_bool(account, name,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 (*data == '0' ? FALSE : TRUE));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
606 if (type == PURPLE_PREF_STRING)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
607 purple_account_set_ui_string(account, ui, name, data);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
608 else if (type == PURPLE_PREF_INT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
609 purple_account_set_ui_int(account, ui, name, atoi(data));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
610 else if (type == PURPLE_PREF_BOOLEAN)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
611 purple_account_set_ui_bool(account, ui, name,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 (*data == '0' ? FALSE : TRUE));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 }
27402
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
617
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
618 /* we do this here because we need access to account settings to determine
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
619 * if we can/should migrate an old Yahoo! JAPAN account */
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
620 migrate_yahoo_japan(account);
31087
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
621 /* we do this here because we need access to account settings to determine
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
622 * if we can/should migrate an ICQ account's server setting */
f9664876549f Implement a migration for ICQ login servers.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30895
diff changeset
623 migrate_icq_server(account);
30895
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
624 /* we do this here because we need to do it before the user views the
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
625 * Edit Account dialog. */
8084631e2e84 jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
Paul Aurich <paul@darkrain42.org>
parents: 30865
diff changeset
626 migrate_xmpp_encryption(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
630 parse_status_attrs(xmlnode *node, PurpleStatus *status)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 GList *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 xmlnode *child;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
634 PurpleValue *attr_value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 for (child = xmlnode_get_child(node, "attribute"); child != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 child = xmlnode_get_next_twin(child))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 const char *id = xmlnode_get_attrib(child, "id");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 const char *value = xmlnode_get_attrib(child, "value");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 if (!id || !*id || !value || !*value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
645 attr_value = purple_status_get_attr_value(status, id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 if (!attr_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 list = g_list_append(list, (char *)id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
651 switch (purple_value_get_type(attr_value))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
653 case PURPLE_TYPE_STRING:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 list = g_list_append(list, (char *)value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 break;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
656 case PURPLE_TYPE_INT:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
657 case PURPLE_TYPE_BOOLEAN:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 int v;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 if (sscanf(value, "%d", &v) == 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 list = g_list_append(list, GINT_TO_POINTER(v));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 list = g_list_remove(list, id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 return list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
675 parse_status(xmlnode *node, PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 gboolean active = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 const char *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 const char *type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 GList *attrs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 /* Get the active/inactive state */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 data = xmlnode_get_attrib(node, "active");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 if (data == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 return;
17095
7ade887fd3f6 Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@wiktel.com>
parents: 16639
diff changeset
687 if (g_ascii_strcasecmp(data, "true") == 0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 active = TRUE;
17095
7ade887fd3f6 Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@wiktel.com>
parents: 16639
diff changeset
689 else if (g_ascii_strcasecmp(data, "false") == 0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 active = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 /* Get the type of the status */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 type = xmlnode_get_attrib(node, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 if (type == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 /* Read attributes into a GList */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 child = xmlnode_get_child(node, "attributes");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 if (child != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 attrs = parse_status_attrs(child,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
704 purple_account_get_status(account, type));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
707 purple_account_set_status_list(account, type, active, attrs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 g_list_free(attrs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
713 parse_statuses(xmlnode *node, PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 for (child = xmlnode_get_child(node, "status"); child != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 child = xmlnode_get_next_twin(child))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 parse_status(child, account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
725 parse_proxy_info(xmlnode *node, PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
727 PurpleProxyInfo *proxy_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 char *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
731 proxy_info = purple_proxy_info_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 /* Use the global proxy settings, by default */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
734 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 /* Read proxy type */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 child = xmlnode_get_child(node, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 {
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
740 if (purple_strequal(data, "global"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
741 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL);
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
742 else if (purple_strequal(data, "none"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
743 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_NONE);
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
744 else if (purple_strequal(data, "http"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
745 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_HTTP);
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
746 else if (purple_strequal(data, "socks4"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
747 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS4);
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
748 else if (purple_strequal(data, "socks5"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
749 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS5);
31929
9a7c5d242521 Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be
Daniel Atallah <daniel.atallah@gmail.com>
parents: 31846
diff changeset
750 else if (purple_strequal(data, "tor"))
9a7c5d242521 Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be
Daniel Atallah <daniel.atallah@gmail.com>
parents: 31846
diff changeset
751 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_TOR);
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
752 else if (purple_strequal(data, "envvar"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
753 purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_ENVVAR);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
756 purple_debug_error("account", "Invalid proxy type found when "
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 "loading account information for %s\n",
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
758 purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 /* Read proxy host */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 child = xmlnode_get_child(node, "host");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
767 purple_proxy_info_set_host(proxy_info, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 /* Read proxy port */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 child = xmlnode_get_child(node, "port");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
775 purple_proxy_info_set_port(proxy_info, atoi(data));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 /* Read proxy username */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 child = xmlnode_get_child(node, "username");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
783 purple_proxy_info_set_username(proxy_info, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 /* Read proxy password */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 child = xmlnode_get_child(node, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
791 purple_proxy_info_set_password(proxy_info, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 /* If there are no values set then proxy_info NULL */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
796 if ((purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
797 (purple_proxy_info_get_host(proxy_info) == NULL) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
798 (purple_proxy_info_get_port(proxy_info) == 0) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
799 (purple_proxy_info_get_username(proxy_info) == NULL) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
800 (purple_proxy_info_get_password(proxy_info) == NULL))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
802 purple_proxy_info_destroy(proxy_info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
806 purple_account_set_proxy_info(account, proxy_info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
809 static void
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
810 parse_current_error(xmlnode *node, PurpleAccount *account)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
811 {
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
812 guint type;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
813 char *type_str = NULL, *description = NULL;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
814 xmlnode *child;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
815 PurpleConnectionErrorInfo *current_error = NULL;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
816
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
817 child = xmlnode_get_child(node, "type");
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
818 if (child == NULL || (type_str = xmlnode_get_data(child)) == NULL)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
819 return;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
820 type = atoi(type_str);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
821 g_free(type_str);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
822
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
823 if (type > PURPLE_CONNECTION_ERROR_OTHER_ERROR)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
824 {
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
825 purple_debug_error("account",
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
826 "Invalid PurpleConnectionError value %d found when "
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
827 "loading account information for %s\n",
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
828 type, purple_account_get_username(account));
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
829 type = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
830 }
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
831
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
832 child = xmlnode_get_child(node, "description");
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
833 if (child)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
834 description = xmlnode_get_data(child);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
835 if (description == NULL)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
836 description = g_strdup("");
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
837
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
838 current_error = g_new0(PurpleConnectionErrorInfo, 1);
22500
89a036334991 Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents: 22231
diff changeset
839 PURPLE_DBUS_REGISTER_POINTER(current_error, PurpleConnectionErrorInfo);
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
840 current_error->type = type;
22108
e21cdaffbcdb Plug a small leak.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22054
diff changeset
841 current_error->description = description;
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
842
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
843 set_current_error(account, current_error);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
844 }
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
845
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
846 static PurpleAccount *
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847 parse_account(xmlnode *node)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
849 PurpleAccount *ret;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 xmlnode *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 char *protocol_id = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852 char *name = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 char *data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855 child = xmlnode_get_child(node, "protocol");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 if (child != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 protocol_id = xmlnode_get_data(child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 child = xmlnode_get_child(node, "name");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860 if (child != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 name = xmlnode_get_data(child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 if (name == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864 /* Do we really need to do this? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865 child = xmlnode_get_child(node, "username");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 if (child != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 name = xmlnode_get_data(child);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 if ((protocol_id == NULL) || (name == NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 g_free(protocol_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876
32290
73b005a20d06 Remove the _purple_oscar_convert(). It existed to migrate data from
Mark Doliner <mark@kingant.net>
parents: 31824
diff changeset
877 ret = purple_account_new(name, protocol_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
878 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 g_free(protocol_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 /* Read the password */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 child = xmlnode_get_child(node, "password");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
885 purple_account_set_remember_password(ret, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
886 purple_account_set_password(ret, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890 /* Read the alias */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 child = xmlnode_get_child(node, "alias");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 if (*data != '\0')
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
895 purple_account_set_alias(ret, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 /* Read the statuses */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 child = xmlnode_get_child(node, "statuses");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 if (child != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 parse_statuses(child, ret);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 /* Read the userinfo */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 child = xmlnode_get_child(node, "userinfo");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
910 purple_account_set_user_info(ret, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913
16390
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16068
diff changeset
914 /* Read an old buddyicon */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 child = xmlnode_get_child(node, "buddyicon");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 {
16482
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
918 const char *dirname = purple_buddy_icons_get_cache_dir();
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
919 char *filename = g_build_filename(dirname, data, NULL);
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
920 gchar *contents;
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
921 gsize len;
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
922
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
923 if (g_file_get_contents(filename, &contents, &len, NULL))
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
924 {
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
925 purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len);
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
926 }
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
927
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
928 g_free(filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 /* Read settings (both core and UI) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 for (child = xmlnode_get_child(node, "settings"); child != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 child = xmlnode_get_next_twin(child))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 parse_settings(child, ret);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 /* Read proxy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 child = xmlnode_get_child(node, "proxy");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 if (child != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 parse_proxy_info(child, ret);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
946 /* Read current error */
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
947 child = xmlnode_get_child(node, "current_error");
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
948 if (child != NULL)
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
949 {
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
950 parse_current_error(child, ret);
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
951 }
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
952
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 load_accounts(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 xmlnode *node, *child;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 accounts_loaded = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
963 node = purple_util_read_xml_from_file("accounts.xml", _("accounts"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 if (node == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 for (child = xmlnode_get_child(node, "account"); child != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 child = xmlnode_get_next_twin(child))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
971 PurpleAccount *new_acct;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 new_acct = parse_account(child);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
973 purple_accounts_add(new_acct);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976 xmlnode_free(node);
16505
1d1ddf972ac8 Ref the filenames for account buddy icons on load.
Richard Laager <rlaager@wiktel.com>
parents: 16483
diff changeset
977
16639
f9c369b4291c Fix up the private function calls to be prefixed with an underscore.
Richard Laager <rlaager@wiktel.com>
parents: 16598
diff changeset
978 _purple_buddy_icons_account_loaded_cb();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 delete_setting(void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
985 PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 g_free(setting->ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
989 if (setting->type == PURPLE_PREF_STRING)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 g_free(setting->value.string);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 g_free(setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
995 PurpleAccount *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
996 purple_account_new(const char *username, const char *protocol_id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
998 PurpleAccount *account = NULL;
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
999 PurpleAccountPrivate *priv = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1000 PurplePlugin *prpl = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1001 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1002 PurpleStatusType *status_type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 g_return_val_if_fail(username != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 g_return_val_if_fail(protocol_id != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1007 account = purple_accounts_find(username, protocol_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 if (account != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 return account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1012 account = g_new0(PurpleAccount, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1013 PURPLE_DBUS_REGISTER_POINTER(account, PurpleAccount);
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
1014 priv = g_new0(PurpleAccountPrivate, 1);
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
1015 account->priv = priv;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1016
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1017 purple_account_set_username(account, username);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1018
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1019 purple_account_set_protocol_id(account, protocol_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 g_free, delete_setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1024 g_free, (GDestroyNotify)g_hash_table_destroy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025 account->system_log = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 /* 0 is not a valid privacy setting */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1027 account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1028
26845
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
1029 purple_signal_emit(purple_accounts_get_handle(), "account-created", account);
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
1030
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1031 prpl = purple_find_prpl(protocol_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033 if (prpl == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034 return account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1036 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1037 if (prpl_info != NULL && prpl_info->status_types != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1038 purple_account_set_status_types(account, prpl_info->status_types(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1039
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1040 account->presence = purple_presence_new_for_account(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1041
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1042 status_type = purple_account_get_status_type_with_primitive(account, PURPLE_STATUS_AVAILABLE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043 if (status_type != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1044 purple_presence_set_status_active(account->presence,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1045 purple_status_type_get_id(status_type),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046 TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1048 purple_presence_set_status_active(account->presence,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 "offline",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050 TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 return account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1056 purple_account_destroy(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 {
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
1058 PurpleAccountPrivate *priv = NULL;
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
1059 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1061 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1063 purple_debug_info("account", "Destroying account %p\n", account);
26845
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
1064 purple_signal_emit(purple_accounts_get_handle(), "account-destroying", account);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1065
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1066 for (l = purple_get_conversations(); l != NULL; l = l->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1068 PurpleConversation *conv = (PurpleConversation *)l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1069
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1070 if (purple_conversation_get_account(conv) == account)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1071 purple_conversation_set_account(conv, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 g_free(account->username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 g_free(account->alias);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 g_free(account->password);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 g_free(account->user_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 g_free(account->buddy_icon_path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 g_free(account->protocol_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 g_hash_table_destroy(account->settings);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 g_hash_table_destroy(account->ui_settings);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083
31377
8714c0bfa52a It looks like this account proxy info is leaked, too.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31328
diff changeset
1084 if (account->proxy_info)
8714c0bfa52a It looks like this account proxy info is leaked, too.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31328
diff changeset
1085 purple_proxy_info_destroy(account->proxy_info);
8714c0bfa52a It looks like this account proxy info is leaked, too.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31328
diff changeset
1086
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1087 purple_account_set_status_types(account, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1088
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1089 purple_presence_destroy(account->presence);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 if(account->system_log)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1092 purple_log_free(account->system_log);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1093
28815
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1094 while (account->deny) {
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1095 g_free(account->deny->data);
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1096 account->deny = g_slist_delete_link(account->deny, account->deny);
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1097 }
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1098
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1099 while (account->permit) {
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1100 g_free(account->permit->data);
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1101 account->permit = g_slist_delete_link(account->permit, account->permit);
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1102 }
e0223ad82ca1 account: Don't leak the account->privacy / account->deny lists.
Paul Aurich <paul@darkrain42.org>
parents: 28715
diff changeset
1103
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
1104 priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
22500
89a036334991 Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents: 22231
diff changeset
1105 PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error);
28715
c4fa41bb1672 Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28712
diff changeset
1106 if (priv->current_error) {
c4fa41bb1672 Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28712
diff changeset
1107 g_free(priv->current_error->description);
c4fa41bb1672 Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28712
diff changeset
1108 g_free(priv->current_error);
c4fa41bb1672 Fixing leak is nice, but let's not crash in the process.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 28712
diff changeset
1109 }
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
1110 g_free(priv);
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
1111
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1112 PURPLE_DBUS_UNREGISTER_POINTER(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 g_free(account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1116 void
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1117 purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data)
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1118 {
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1119 g_return_if_fail(account != NULL);
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1120
17607
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1121 account->registration_cb = cb;
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1122 account->registration_cb_user_data = user_data;
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1123 }
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1124
ca0b86f3dbd2 Implemented a callback for a successful registration, supplying the username and password to the application when available, in the way explained by Sean.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17593
diff changeset
1125 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1126 purple_account_register(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1130 purple_debug_info("account", "Registering account %s\n",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1131 purple_account_get_username(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1132
24292
8282911d5e17 Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents: 23963
diff changeset
1133 _purple_connection_new(account, TRUE, purple_account_get_password(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1136 void
18920
2a9d60d7af82 Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18703
diff changeset
1137 purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data)
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1138 {
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1139 g_return_if_fail(account != NULL);
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1140
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1141 purple_debug_info("account", "Unregistering account %s\n",
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1142 purple_account_get_username(account));
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1143
24292
8282911d5e17 Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents: 23963
diff changeset
1144 _purple_connection_new_unregister(account, purple_account_get_password(account), cb, user_data);
18703
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1145 }
033b128f7c21 Added unregistering XMPP accounts. This requires a new prpl-struct entry, but I got an ok for that on the mailing list.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
1146
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1148 request_password_ok_cb(PurpleAccount *account, PurpleRequestFields *fields)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150 const char *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 gboolean remember;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1153 entry = purple_request_fields_get_string(fields, "password");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1154 remember = purple_request_fields_get_bool(fields, "remember");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 if (!entry || !*entry)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1158 purple_notify_error(account, NULL, _("Password is required to sign on."), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162 if(remember)
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1163 purple_account_set_remember_password(account, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1164
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1165 purple_account_set_password(account, entry);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1166
24292
8282911d5e17 Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents: 23963
diff changeset
1167 _purple_connection_new(account, FALSE, entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1170 static void
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1171 request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields)
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1172 {
30865
1cdae196aac8 Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30638
diff changeset
1173 /* Disable the account as the user has cancelled connecting */
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1174 purple_account_set_enabled(account, purple_core_get_ui(), FALSE);
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1175 }
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1176
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1177
16068
ac1a32ebd62c patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
1178 void
ac1a32ebd62c patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
1179 purple_account_request_password(PurpleAccount *account, GCallback ok_cb,
ac1a32ebd62c patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
1180 GCallback cancel_cb, void *user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182 gchar *primary;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 const gchar *username;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1184 PurpleRequestFieldGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1185 PurpleRequestField *field;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1186 PurpleRequestFields *fields;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 /* Close any previous password request windows */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1189 purple_request_close_with_handle(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1190
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1191 username = purple_account_get_username(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 primary = g_strdup_printf(_("Enter password for %s (%s)"), username,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1193 purple_account_get_protocol_name(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1194
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1195 fields = purple_request_fields_new();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1196 group = purple_request_field_group_new(NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1197 purple_request_fields_add_group(fields, group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1198
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1199 field = purple_request_field_string_new("password", _("Enter Password"), NULL, FALSE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1200 purple_request_field_string_set_masked(field, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1201 purple_request_field_set_required(field, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1202 purple_request_field_group_add_field(group, field);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1203
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1204 field = purple_request_field_bool_new("remember", _("Save password"), FALSE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1205 purple_request_field_group_add_field(group, field);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1206
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1207 purple_request_fields(account,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1208 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209 primary,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211 fields,
16068
ac1a32ebd62c patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
1212 _("OK"), ok_cb,
ac1a32ebd62c patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
1213 _("Cancel"), cancel_cb,
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16068
diff changeset
1214 account, NULL, NULL,
16068
ac1a32ebd62c patch from Simon Wilkinson to support Jabber/XMPP w/o passwords
Nathan Walp <nwalp@pidgin.im>
parents: 15823
diff changeset
1215 user_data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 g_free(primary);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1220 purple_account_connect(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1222 PurplePlugin *prpl;
26749
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1223 const char *password, *username;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1224 PurplePluginProtocolInfo *prpl_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1225
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1227
26749
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1228 username = purple_account_get_username(account);
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1229
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1230 if (!purple_account_get_enabled(account, purple_core_get_ui())) {
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1231 purple_debug_info("account",
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1232 "Account %s not enabled, not connecting.\n",
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1233 username);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 return;
26749
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1235 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1237 prpl = purple_find_prpl(purple_account_get_protocol_id(account));
26749
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1238 if (prpl == NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 gchar *message;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240
26749
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1241 message = g_strdup_printf(_("Missing protocol plugin for %s"), username);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1242 purple_notify_error(account, _("Connection Error"), message, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243 g_free(message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246
26749
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1247 purple_debug_info("account", "Connecting to account %s.\n", username);
a3595b330671 Don't debug print that we are connecting an account until we are reasonably
Etan Reisner <pidgin@unreliablesource.net>
parents: 25415
diff changeset
1248
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1249 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1250 password = purple_account_get_password(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 if ((password == NULL) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252 !(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL))
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1254 purple_account_request_password(account, G_CALLBACK(request_password_ok_cb), G_CALLBACK(request_password_cancel_cb), account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 else
24292
8282911d5e17 Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents: 23963
diff changeset
1256 _purple_connection_new(account, FALSE, password);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1260 purple_account_disconnect(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1262 PurpleConnection *gc;
28442
3896cbf6336a Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents: 28035
diff changeset
1263 const char *username;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1266 g_return_if_fail(!purple_account_is_disconnected(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1267
28442
3896cbf6336a Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents: 28035
diff changeset
1268 username = purple_account_get_username(account);
3896cbf6336a Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents: 28035
diff changeset
1269 purple_debug_info("account", "Disconnecting account %s (%p)\n",
3896cbf6336a Display the username in the debug log when disconnecting an account.
Paul Aurich <paul@darkrain42.org>
parents: 28035
diff changeset
1270 username ? username : "(null)", account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 account->disconnecting = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1274 gc = purple_account_get_connection(account);
24292
8282911d5e17 Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents: 23963
diff changeset
1275 _purple_connection_destroy(gc);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1276 if (!purple_account_get_remember_password(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1277 purple_account_set_password(account, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1278 purple_account_set_connection(account, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 account->disconnecting = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1284 purple_account_notify_added(PurpleAccount *account, const char *remote_user,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1285 const char *id, const char *alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1286 const char *message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1287 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1288 PurpleAccountUiOps *ui_ops;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1291 g_return_if_fail(remote_user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1293 ui_ops = purple_accounts_get_ui_ops();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 if (ui_ops != NULL && ui_ops->notify_added != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1296 ui_ops->notify_added(account, remote_user, id, alias, message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1297 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1298
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1300 purple_account_request_add(PurpleAccount *account, const char *remote_user,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1301 const char *id, const char *alias,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1302 const char *message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1304 PurpleAccountUiOps *ui_ops;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1305
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1307 g_return_if_fail(remote_user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1309 ui_ops = purple_accounts_get_ui_ops();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311 if (ui_ops != NULL && ui_ops->request_add != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1312 ui_ops->request_add(account, remote_user, id, alias, message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1314
24644
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1315 static PurpleAccountRequestInfo *
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1316 purple_account_request_info_unref(PurpleAccountRequestInfo *info)
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1317 {
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1318 if (--info->ref)
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1319 return info;
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1320
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1321 /* TODO: This will leak info->user_data, but there is no callback to just clean that up */
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1322 g_free(info->user);
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1323 g_free(info);
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1324 return NULL;
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1325 }
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1326
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1327 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1328 purple_account_request_close_info(PurpleAccountRequestInfo *info)
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1329 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1330 PurpleAccountUiOps *ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1331
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1332 ops = purple_accounts_get_ui_ops();
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1333
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1334 if (ops != NULL && ops->close_account_request != NULL)
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1335 ops->close_account_request(info->ui_handle);
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1336
24644
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1337 purple_account_request_info_unref(info);
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1338 }
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1339
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1340 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1341 purple_account_request_close_with_account(PurpleAccount *account)
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1342 {
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1343 GList *l, *l_next;
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1344
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1345 g_return_if_fail(account != NULL);
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1346
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1347 for (l = handles; l != NULL; l = l_next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1348 PurpleAccountRequestInfo *info = l->data;
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1349
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1350 l_next = l->next;
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1351
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1352 if (info->account == account) {
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1353 handles = g_list_remove(handles, info);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1354 purple_account_request_close_info(info);
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1355 }
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1356 }
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1357 }
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1358
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1359 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1360 purple_account_request_close(void *ui_handle)
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1361 {
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1362 GList *l, *l_next;
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1363
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1364 g_return_if_fail(ui_handle != NULL);
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1365
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1366 for (l = handles; l != NULL; l = l_next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1367 PurpleAccountRequestInfo *info = l->data;
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1368
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1369 l_next = l->next;
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1370
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1371 if (info->ui_handle == ui_handle) {
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1372 handles = g_list_remove(handles, info);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1373 purple_account_request_close_info(info);
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1374 }
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1375 }
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1376 }
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1377
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1378 static void
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1379 request_auth_cb(void *data)
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1380 {
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1381 PurpleAccountRequestInfo *info = data;
22054
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1382
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1383 handles = g_list_remove(handles, info);
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1384
29252
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1385 if (info->auth_cb != NULL)
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1386 info->auth_cb(info->userdata);
22054
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1387
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1388 purple_signal_emit(purple_accounts_get_handle(),
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1389 "account-authorization-granted", info->account, info->user);
22054
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1390
24644
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1391 purple_account_request_info_unref(info);
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1392 }
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1393
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1394 static void
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1395 request_deny_cb(void *data)
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1396 {
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1397 PurpleAccountRequestInfo *info = data;
22054
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1398
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1399 handles = g_list_remove(handles, info);
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1400
29252
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1401 if (info->deny_cb != NULL)
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1402 info->deny_cb(info->userdata);
22054
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1403
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1404 purple_signal_emit(purple_accounts_get_handle(),
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1405 "account-authorization-denied", info->account, info->user);
22054
658785fe1992 This makes authorization requests go away when the account is disconnected. It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22007
diff changeset
1406
24644
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1407 purple_account_request_info_unref(info);
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1408 }
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1409
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1410 void *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1411 purple_account_request_authorization(PurpleAccount *account, const char *remote_user,
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18452
diff changeset
1412 const char *id, const char *alias, const char *message, gboolean on_list,
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18452
diff changeset
1413 PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1415 PurpleAccountUiOps *ui_ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1416 PurpleAccountRequestInfo *info;
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1417 int plugin_return;
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1418
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1419 g_return_val_if_fail(account != NULL, NULL);
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1420 g_return_val_if_fail(remote_user != NULL, NULL);
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1421
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1422 ui_ops = purple_accounts_get_ui_ops();
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1423
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1424 plugin_return = GPOINTER_TO_INT(
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1425 purple_signal_emit_return_1(purple_accounts_get_handle(),
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1426 "account-authorization-requested", account, remote_user));
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1427
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1428 if (plugin_return > 0) {
29252
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1429 if (auth_cb != NULL)
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1430 auth_cb(user_data);
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1431 return NULL;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1432 } else if (plugin_return < 0) {
29252
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1433 if (deny_cb != NULL)
af038fcca10f *** Plucked rev 0707f870a510922ae86ef379b5f01efa76d01402 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28815
diff changeset
1434 deny_cb(user_data);
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1435 return NULL;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1436 }
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1437
31820
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1438 plugin_return = GPOINTER_TO_INT(
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1439 purple_signal_emit_return_1(
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1440 purple_accounts_get_handle(),
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1441 "account-authorization-requested-with-message",
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1442 account, remote_user, message
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1443 ));
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1444
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1445 switch (plugin_return)
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1446 {
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1447 case PURPLE_ACCOUNT_RESPONSE_IGNORE:
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1448 return NULL;
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1449 case PURPLE_ACCOUNT_RESPONSE_ACCEPT:
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1450 if (auth_cb != NULL)
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1451 auth_cb(user_data);
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1452 return NULL;
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1453 case PURPLE_ACCOUNT_RESPONSE_DENY:
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1454 if (deny_cb != NULL)
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1455 deny_cb(user_data);
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1456 return NULL;
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1457 }
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
1458
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1459 if (ui_ops != NULL && ui_ops->request_authorize != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1460 info = g_new0(PurpleAccountRequestInfo, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1461 info->type = PURPLE_ACCOUNT_REQUEST_AUTHORIZATION;
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1462 info->account = account;
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1463 info->auth_cb = auth_cb;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1464 info->deny_cb = deny_cb;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1465 info->userdata = user_data;
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1466 info->user = g_strdup(remote_user);
24644
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1467 info->ref = 2; /* We hold an extra ref to make sure info remains valid
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1468 if any of the callbacks are called synchronously. We
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1469 unref it after the function call */
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1470
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1471 info->ui_handle = ui_ops->request_authorize(account, remote_user, id, alias, message,
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
1472 on_list, request_auth_cb, request_deny_cb, info);
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18452
diff changeset
1473
24644
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1474 info = purple_account_request_info_unref(info);
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1475 if (info) {
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1476 handles = g_list_append(handles, info);
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1477 return info->ui_handle;
98ec72f8f3cc Use ref-counting to prevent a crash if request-auth callbacks are called
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24607
diff changeset
1478 }
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1479 }
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
1480
15478
cb3800fabd76 The accounts request API now keeps track of a returned ui_handle for authorization requests, which can be closed on demand individually or all-at-once by account. When a connection is destroyed, its associated requests are closed.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15421
diff changeset
1481 return NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1485 change_password_cb(PurpleAccount *account, PurpleRequestFields *fields)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487 const char *orig_pass, *new_pass_1, *new_pass_2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1489 orig_pass = purple_request_fields_get_string(fields, "password");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1490 new_pass_1 = purple_request_fields_get_string(fields, "new_password_1");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1491 new_pass_2 = purple_request_fields_get_string(fields, "new_password_2");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 if (g_utf8_collate(new_pass_1, new_pass_2))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1495 purple_notify_error(account, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 _("New passwords do not match."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1498 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500
22694
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1501 if ((purple_request_fields_is_field_required(fields, "password") &&
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1502 (orig_pass == NULL || *orig_pass == '\0')) ||
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1503 (purple_request_fields_is_field_required(fields, "new_password_1") &&
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1504 (new_pass_1 == NULL || *new_pass_1 == '\0')) ||
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1505 (purple_request_fields_is_field_required(fields, "new_password_2") &&
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1506 (new_pass_2 == NULL || *new_pass_2 == '\0')))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1507 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1508 purple_notify_error(account, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 _("Fill out all fields completely."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1513 purple_account_change_password(account, orig_pass, new_pass_1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1517 purple_account_request_change_password(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1519 PurpleRequestFields *fields;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1520 PurpleRequestFieldGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1521 PurpleRequestField *field;
22694
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1522 PurpleConnection *gc;
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1523 PurplePlugin *prpl = NULL;
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1524 PurplePluginProtocolInfo *prpl_info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 char primary[256];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1528 g_return_if_fail(purple_account_is_connected(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1529
22694
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1530 gc = purple_account_get_connection(account);
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1531 if (gc != NULL)
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1532 prpl = purple_connection_get_prpl(gc);
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1533 if (prpl != NULL)
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1534 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1535
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1536 fields = purple_request_fields_new();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1537
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1538 group = purple_request_field_group_new(NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1539 purple_request_fields_add_group(fields, group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1540
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1541 field = purple_request_field_string_new("password", _("Original password"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 NULL, FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1543 purple_request_field_string_set_masked(field, TRUE);
22694
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1544 if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL)))
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1545 purple_request_field_set_required(field, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1546 purple_request_field_group_add_field(group, field);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1547
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1548 field = purple_request_field_string_new("new_password_1",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549 _("New password"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 NULL, FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1551 purple_request_field_string_set_masked(field, TRUE);
22694
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1552 if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL)))
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1553 purple_request_field_set_required(field, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1554 purple_request_field_group_add_field(group, field);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1555
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1556 field = purple_request_field_string_new("new_password_2",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 _("New password (again)"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 NULL, FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1559 purple_request_field_string_set_masked(field, TRUE);
22694
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1560 if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL)))
7097bbac4234 Allow changing to or from an empty password when the protocol specifies
Stu Tomlinson <stu@nosnilmot.com>
parents: 22503
diff changeset
1561 purple_request_field_set_required(field, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1562 purple_request_field_group_add_field(group, field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1564 g_snprintf(primary, sizeof(primary), _("Change password for %s"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1565 purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567 /* I'm sticking this somewhere in the code: bologna */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1569 purple_request_fields(purple_account_get_connection(account),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571 primary,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 _("Please enter your current password and your "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573 "new password."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 fields,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 _("OK"), G_CALLBACK(change_password_cb),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576 _("Cancel"), NULL,
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16068
diff changeset
1577 account, NULL, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578 account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1582 set_user_info_cb(PurpleAccount *account, const char *user_info)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1584 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1585
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1586 purple_account_set_user_info(account, user_info);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1587 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 serv_set_info(gc, user_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1592 purple_account_request_change_user_info(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1594 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 char primary[256];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597 g_return_if_fail(account != NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1598 g_return_if_fail(purple_account_is_connected(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1599
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1600 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1601
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1602 g_snprintf(primary, sizeof(primary),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1603 _("Change user information for %s"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1604 purple_account_get_username(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1605
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1606 purple_request_input(gc, _("Set User Info"), primary, NULL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1607 purple_account_get_user_info(account),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608 TRUE, FALSE, ((gc != NULL) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1609 (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1610 _("Save"), G_CALLBACK(set_user_info_cb),
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16068
diff changeset
1611 _("Cancel"), NULL,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16068
diff changeset
1612 account, NULL, NULL,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16068
diff changeset
1613 account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1617 purple_account_set_username(PurpleAccount *account, const char *username)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618 {
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27450
diff changeset
1619 PurpleBlistUiOps *blist_ops;
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27450
diff changeset
1620
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 g_free(account->username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624 account->username = g_strdup(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 /* if the name changes, we should re-write the buddy list
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 * to disk with the new name */
28035
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27450
diff changeset
1630 blist_ops = purple_blist_get_ui_ops();
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27450
diff changeset
1631 if (blist_ops != NULL && blist_ops->save_account != NULL)
14ce47859540 Add blist ui-ops to overload the saving of data to blist.xml. Closes #9630.
hanzz@soc.pidgin.im
parents: 27450
diff changeset
1632 blist_ops->save_account(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1633 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1636 purple_account_set_password(PurpleAccount *account, const char *password)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640 g_free(account->password);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641 account->password = g_strdup(password);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1647 purple_account_set_alias(PurpleAccount *account, const char *alias)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1648 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 * Do nothing if alias and account->alias are both NULL. Or if
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 * they're the exact same string.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655 if (alias == account->alias)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1658 if ((!alias && account->alias) || (alias && !account->alias) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659 g_utf8_collate(account->alias, alias))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661 char *old = account->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1663 account->alias = g_strdup(alias);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1664 purple_signal_emit(purple_accounts_get_handle(), "account-alias-changed",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665 account, old);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666 g_free(old);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1668 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1671
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1672 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1673 purple_account_set_user_info(PurpleAccount *account, const char *user_info)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1674 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1675 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1677 g_free(account->user_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1678 account->user_info = g_strdup(user_info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1679
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1680 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1681 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1683 void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1684 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1685 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1687 g_free(account->buddy_icon_path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1688 account->buddy_icon_path = g_strdup(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1694 purple_account_set_protocol_id(PurpleAccount *account, const char *protocol_id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1695 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1697 g_return_if_fail(protocol_id != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1698
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1699 g_free(account->protocol_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700 account->protocol_id = g_strdup(protocol_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1705 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1706 purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1707 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1708 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1710 account->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1713 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1714 purple_account_set_remember_password(PurpleAccount *account, gboolean value)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1715 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718 account->remember_pass = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1721 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1723 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1724 purple_account_set_check_mail(PurpleAccount *account, gboolean value)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1727
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1728 purple_account_set_bool(account, "check-mail", value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1730
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1731 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1732 purple_account_set_enabled(PurpleAccount *account, const char *ui,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1733 gboolean value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1734 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1735 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1736 gboolean was_enabled = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1739 g_return_if_fail(ui != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1740
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1741 was_enabled = purple_account_get_enabled(account, ui);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1742
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1743 purple_account_set_ui_bool(account, ui, "auto-login", value);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1744 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 if(was_enabled && !value)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1747 purple_signal_emit(purple_accounts_get_handle(), "account-disabled", account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 else if(!was_enabled && value)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1749 purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 if ((gc != NULL) && (gc->wants_to_die == TRUE))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1752 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1754 if (value && purple_presence_is_online(account->presence))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1755 purple_account_connect(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1756 else if (!value && !purple_account_is_disconnected(account))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1757 purple_account_disconnect(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1761 purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1762 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1763 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1764
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1765 if (account->proxy_info != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1766 purple_proxy_info_destroy(account->proxy_info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1767
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 account->proxy_info = info;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1769
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1770 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1771 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1772
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 void
30149
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1774 purple_account_set_privacy_type(PurpleAccount *account, PurplePrivacyType privacy_type)
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1775 {
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1776 g_return_if_fail(account != NULL);
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1777
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1778 account->perm_deny = privacy_type;
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1779 }
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1780
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
1781 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1782 purple_account_set_status_types(PurpleAccount *account, GList *status_types)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 /* Out with the old... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 if (account->status_types != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1789 g_list_foreach(account->status_types, (GFunc)purple_status_type_destroy, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1790 g_list_free(account->status_types);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1791 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1793 /* In with the new... */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1794 account->status_types = status_types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1798 purple_account_set_status(PurpleAccount *account, const char *status_id,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 gboolean active, ...)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1800 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801 GList *attrs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802 const gchar *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 gpointer data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 va_list args;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806 va_start(args, active);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1807 while ((id = va_arg(args, const char *)) != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1809 attrs = g_list_append(attrs, (char *)id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1810 data = va_arg(args, void *);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 attrs = g_list_append(attrs, data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1813 purple_account_set_status_list(account, status_id, active, attrs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 g_list_free(attrs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 va_end(args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1818 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1819 purple_account_set_status_list(PurpleAccount *account, const char *status_id,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1820 gboolean active, GList *attrs)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1821 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1822 PurpleStatus *status;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825 g_return_if_fail(status_id != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1826
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1827 status = purple_account_get_status(account, status_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1828 if (status == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1830 purple_debug_error("account",
21937
8daec0ca3218 Infinitesimally better debug message
Mark Doliner <mark@kingant.net>
parents: 21846
diff changeset
1831 "Invalid status ID '%s' for account %s (%s)\n",
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1832 status_id, purple_account_get_username(account),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1833 purple_account_get_protocol_id(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1837 if (active || purple_status_is_independent(status))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1838 purple_status_set_active_with_attrs_list(status, active, attrs);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 * Our current statuses are saved to accounts.xml (so that when we
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842 * reconnect, we go back to the previous status).
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846
30262
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1847 struct public_alias_closure
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1848 {
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1849 PurpleAccount *account;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1850 gpointer failure_cb;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1851 };
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1852
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1853 static gboolean
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1854 set_public_alias_unsupported(gpointer data)
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1855 {
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1856 struct public_alias_closure *closure = data;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1857 PurpleSetPublicAliasFailureCallback failure_cb = closure->failure_cb;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1858
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1859 failure_cb(closure->account,
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1860 _("This protocol does not support setting a public alias."));
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1861 g_free(closure);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1862
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1863 return FALSE;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1864 }
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1865
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1866 void
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1867 purple_account_set_public_alias(PurpleAccount *account,
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1868 const char *alias, PurpleSetPublicAliasSuccessCallback success_cb,
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1869 PurpleSetPublicAliasFailureCallback failure_cb)
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1870 {
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1871 PurpleConnection *gc;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1872 PurplePlugin *prpl = NULL;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1873 PurplePluginProtocolInfo *prpl_info = NULL;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1874
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1875 g_return_if_fail(account != NULL);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1876 g_return_if_fail(purple_account_is_connected(account));
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1877
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1878 gc = purple_account_get_connection(account);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1879 prpl = purple_connection_get_prpl(gc);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1880 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1881
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1882 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, set_public_alias))
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1883 prpl_info->set_public_alias(gc, alias, success_cb, failure_cb);
30638
51d5ec7b1699 Only call failure_cb if it exists for the [gs]et_public_alias functions.
Paul Aurich <paul@darkrain42.org>
parents: 30262
diff changeset
1884 else if (failure_cb) {
30262
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1885 struct public_alias_closure *closure =
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1886 g_new0(struct public_alias_closure, 1);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1887 closure->account = account;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1888 closure->failure_cb = failure_cb;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1889 purple_timeout_add(0, set_public_alias_unsupported, closure);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1890 }
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1891 }
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1892
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1893 static gboolean
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1894 get_public_alias_unsupported(gpointer data)
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1895 {
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1896 struct public_alias_closure *closure = data;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1897 PurpleGetPublicAliasFailureCallback failure_cb = closure->failure_cb;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1898
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1899 failure_cb(closure->account,
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1900 _("This protocol does not support fetching the public alias."));
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1901 g_free(closure);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1902
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1903 return FALSE;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1904 }
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1905
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1906 void
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1907 purple_account_get_public_alias(PurpleAccount *account,
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1908 PurpleGetPublicAliasSuccessCallback success_cb,
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1909 PurpleGetPublicAliasFailureCallback failure_cb)
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1910 {
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1911 PurpleConnection *gc;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1912 PurplePlugin *prpl = NULL;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1913 PurplePluginProtocolInfo *prpl_info = NULL;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1914
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1915 g_return_if_fail(account != NULL);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1916 g_return_if_fail(purple_account_is_connected(account));
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1917
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1918 gc = purple_account_get_connection(account);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1919 prpl = purple_connection_get_prpl(gc);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1920 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1921
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1922 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_public_alias))
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1923 prpl_info->get_public_alias(gc, success_cb, failure_cb);
30638
51d5ec7b1699 Only call failure_cb if it exists for the [gs]et_public_alias functions.
Paul Aurich <paul@darkrain42.org>
parents: 30262
diff changeset
1924 else if (failure_cb) {
30262
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1925 struct public_alias_closure *closure =
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1926 g_new0(struct public_alias_closure, 1);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1927 closure->account = account;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1928 closure->failure_cb = failure_cb;
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1929 purple_timeout_add(0, get_public_alias_unsupported, closure);
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1930 }
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1931 }
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 30149
diff changeset
1932
31824
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1933 gboolean
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1934 purple_account_get_silence_suppression(const PurpleAccount *account)
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1935 {
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1936 return purple_account_get_bool(account, "silence-suppression", FALSE);
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1937 }
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1938
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1939 void
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1940 purple_account_set_silence_suppression(PurpleAccount *account, gboolean value)
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1941 {
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1942 g_return_if_fail(account != NULL);
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1943
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1944 purple_account_set_bool(account, "silence-suppression", value);
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1945 }
4f2aac5967bb Make the simple silence suppression stuff optional per-account. Fixes #13180.
jakub.adam@ktknet.cz
parents: 31820
diff changeset
1946
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1947 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1948 purple_account_clear_settings(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1949 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1950 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952 g_hash_table_destroy(account->settings);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1954 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1955 g_free, delete_setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1956 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1958 void
27402
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1959 purple_account_remove_setting(PurpleAccount *account, const char *setting)
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1960 {
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1961 g_return_if_fail(account != NULL);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1962 g_return_if_fail(setting != NULL);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1963
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1964 g_hash_table_remove(account->settings, setting);
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1965 }
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1966
87586d7bdbbd Migrate Yahoo! JAPAN accounts to the new prpl (in theory). This also adds
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27313
diff changeset
1967 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1968 purple_account_set_int(PurpleAccount *account, const char *name, int value)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1969 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1970 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1972 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1973 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1974
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1975 setting = g_new0(PurpleAccountSetting, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1976
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1977 setting->type = PURPLE_PREF_INT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1978 setting->value.integer = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 g_hash_table_insert(account->settings, g_strdup(name), setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1981
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1982 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1983 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1986 purple_account_set_string(PurpleAccount *account, const char *name,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1987 const char *value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1989 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1991 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1994 setting = g_new0(PurpleAccountSetting, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1995
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
1996 setting->type = PURPLE_PREF_STRING;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997 setting->value.string = g_strdup(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1998
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1999 g_hash_table_insert(account->settings, g_strdup(name), setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2005 purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2007 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2008
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2012 setting = g_new0(PurpleAccountSetting, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2013
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2014 setting->type = PURPLE_PREF_BOOLEAN;
20354
01101467094f applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20251
diff changeset
2015 setting->value.boolean = value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017 g_hash_table_insert(account->settings, g_strdup(name), setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022 static GHashTable *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2023 get_ui_settings_table(PurpleAccount *account, const char *ui)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 table = g_hash_table_lookup(account->ui_settings, ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029 if (table == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2031 delete_setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032 g_hash_table_insert(account->ui_settings, g_strdup(ui), table);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 return table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2036 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2039 purple_account_set_ui_int(PurpleAccount *account, const char *ui,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 const char *name, int value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2042 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2043 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2044
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046 g_return_if_fail(ui != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2048
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2049 setting = g_new0(PurpleAccountSetting, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2050
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2051 setting->type = PURPLE_PREF_INT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052 setting->ui = g_strdup(ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053 setting->value.integer = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 table = get_ui_settings_table(account, ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2057 g_hash_table_insert(table, g_strdup(name), setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2063 purple_account_set_ui_string(PurpleAccount *account, const char *ui,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 const char *name, const char *value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2065 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2066 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 g_return_if_fail(ui != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2073 setting = g_new0(PurpleAccountSetting, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2074
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2075 setting->type = PURPLE_PREF_STRING;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076 setting->ui = g_strdup(ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077 setting->value.string = g_strdup(value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 table = get_ui_settings_table(account, ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2081 g_hash_table_insert(table, g_strdup(name), setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2084 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2087 purple_account_set_ui_bool(PurpleAccount *account, const char *ui,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2088 const char *name, gboolean value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2090 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2093 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094 g_return_if_fail(ui != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2095 g_return_if_fail(name != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2096
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2097 setting = g_new0(PurpleAccountSetting, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2098
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2099 setting->type = PURPLE_PREF_BOOLEAN;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 setting->ui = g_strdup(ui);
20354
01101467094f applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20251
diff changeset
2101 setting->value.boolean = value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2103 table = get_ui_settings_table(account, ui);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105 g_hash_table_insert(table, g_strdup(name), setting);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2107 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2109
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2110 static PurpleConnectionState
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2111 purple_account_get_state(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2112 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2113 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2114
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2115 g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2116
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2117 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118 if (!gc)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2119 return PURPLE_DISCONNECTED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2120
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2121 return purple_connection_get_state(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2122 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2124 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2125 purple_account_is_connected(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2126 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2127 return (purple_account_get_state(account) == PURPLE_CONNECTED);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2131 purple_account_is_connecting(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2132 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2133 return (purple_account_get_state(account) == PURPLE_CONNECTING);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2136 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2137 purple_account_is_disconnected(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2138 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2139 return (purple_account_get_state(account) == PURPLE_DISCONNECTED);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2140 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2142 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2143 purple_account_get_username(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2144 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2145 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2147 return account->username;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2148 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2150 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2151 purple_account_get_password(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2152 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2153 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2154
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2155 return account->password;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2158 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2159 purple_account_get_alias(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2161 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2163 return account->alias;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2166 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2167 purple_account_get_user_info(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2168 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2169 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171 return account->user_info;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2172 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2175 purple_account_get_buddy_icon_path(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2176 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2179 return account->buddy_icon_path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2180 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2182 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2183 purple_account_get_protocol_id(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186 return account->protocol_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2187 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2189 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2190 purple_account_get_protocol_name(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2191 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2192 PurplePlugin *p;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2194 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2195
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2196 p = purple_find_prpl(purple_account_get_protocol_id(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2198 return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2199 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2200
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2201 PurpleConnection *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2202 purple_account_get_connection(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2203 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206 return account->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2207 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2208
29499
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2209 const gchar *
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2210 purple_account_get_name_for_display(const PurpleAccount *account)
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2211 {
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2212 PurpleBuddy *self = NULL;
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2213 PurpleConnection *gc = NULL;
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2214 const gchar *name = NULL, *username = NULL, *displayname = NULL;
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2215
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2216 name = purple_account_get_alias(account);
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2217
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2218 if (name) {
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2219 return name;
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2220 }
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2221
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2222 username = purple_account_get_username(account);
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2223 self = purple_find_buddy((PurpleAccount *)account, username);
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2224
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2225 if (self) {
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2226 const gchar *calias= purple_buddy_get_contact_alias(self);
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2227
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2228 /* We don't want to return the buddy name if the buddy/contact
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2229 * doesn't have an alias set. */
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2230 if (!purple_strequal(username, calias)) {
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2231 return calias;
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2232 }
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2233 }
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2234
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2235 gc = purple_account_get_connection(account);
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2236 displayname = purple_connection_get_display_name(gc);
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2237
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2238 if (displayname) {
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2239 return displayname;
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2240 }
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2241
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2242 return username;
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2243 }
94f85ba7e5a9 This effectively moves Etan's API addition off im.pidgin.pidgin and onto
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28442
diff changeset
2244
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2245 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2246 purple_account_get_remember_password(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2247 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2248 g_return_val_if_fail(account != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2250 return account->remember_pass;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2251 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2254 purple_account_get_check_mail(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2255 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2256 g_return_val_if_fail(account != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2257
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2258 return purple_account_get_bool(account, "check-mail", FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2261 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2262 purple_account_get_enabled(const PurpleAccount *account, const char *ui)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 g_return_val_if_fail(account != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265 g_return_val_if_fail(ui != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2266
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2267 return purple_account_get_ui_bool(account, ui, "auto-login", FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2268 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2269
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2270 PurpleProxyInfo *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2271 purple_account_get_proxy_info(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2272 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2273 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2275 return account->proxy_info;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2276 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2277
30149
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2278 PurplePrivacyType
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2279 purple_account_get_privacy_type(const PurpleAccount *account)
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2280 {
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2281 g_return_val_if_fail(account != NULL, PURPLE_PRIVACY_ALLOW_ALL);
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2282
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2283 return account->perm_deny;
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2284 }
b983db2b01f5 Add getter and setter for account->perm_deny. Patch by Stephen Whitmore.
Mark Doliner <mark@kingant.net>
parents: 30118
diff changeset
2285
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2286 PurpleStatus *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2287 purple_account_get_active_status(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2288 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2289 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2290
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2291 return purple_presence_get_active_status(account->presence);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2292 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2293
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2294 PurpleStatus *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2295 purple_account_get_status(const PurpleAccount *account, const char *status_id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2296 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2297 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2298 g_return_val_if_fail(status_id != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2299
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2300 return purple_presence_get_status(account->presence, status_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2301 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2303 PurpleStatusType *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2304 purple_account_get_status_type(const PurpleAccount *account, const char *id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2305 {
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18063
diff changeset
2306 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2307
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2308 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2309 g_return_val_if_fail(id != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2310
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2311 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2312 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2313 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2314
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
2315 if (purple_strequal(purple_status_type_get_id(status_type), id))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2316 return status_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2319 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2320 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2321
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2322 PurpleStatusType *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2323 purple_account_get_status_type_with_primitive(const PurpleAccount *account, PurpleStatusPrimitive primitive)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2324 {
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18063
diff changeset
2325 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2327 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2328
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2329 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2330 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2331 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2332
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2333 if (purple_status_type_get_primitive(status_type) == primitive)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2334 return status_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2335 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2337 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2338 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2339
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2340 PurplePresence *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2341 purple_account_get_presence(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2342 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2343 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2344
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2345 return account->presence;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2346 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2347
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2348 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2349 purple_account_is_status_active(const PurpleAccount *account,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2350 const char *status_id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2351 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2352 g_return_val_if_fail(account != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2353 g_return_val_if_fail(status_id != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2354
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2355 return purple_presence_is_status_active(account->presence, status_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2356 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2357
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18063
diff changeset
2358 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2359 purple_account_get_status_types(const PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2360 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2361 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2363 return account->status_types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2364 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2365
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2366 int
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2367 purple_account_get_int(const PurpleAccount *account, const char *name,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2368 int default_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2369 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2370 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2371
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2372 g_return_val_if_fail(account != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2373 g_return_val_if_fail(name != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2375 setting = g_hash_table_lookup(account->settings, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2376
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2377 if (setting == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2378 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2379
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2380 g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2382 return setting->value.integer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2383 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2385 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2386 purple_account_get_string(const PurpleAccount *account, const char *name,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2387 const char *default_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2388 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2389 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2390
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2391 g_return_val_if_fail(account != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2392 g_return_val_if_fail(name != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2393
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2394 setting = g_hash_table_lookup(account->settings, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2395
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2396 if (setting == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2397 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2398
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2399 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2400
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2401 return setting->value.string;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2403
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2404 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2405 purple_account_get_bool(const PurpleAccount *account, const char *name,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2406 gboolean default_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2407 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2408 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2410 g_return_val_if_fail(account != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2411 g_return_val_if_fail(name != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2413 setting = g_hash_table_lookup(account->settings, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2414
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2415 if (setting == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2416 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2417
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2418 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2419
20354
01101467094f applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20251
diff changeset
2420 return setting->value.boolean;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2421 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2423 int
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2424 purple_account_get_ui_int(const PurpleAccount *account, const char *ui,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2425 const char *name, int default_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2426 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2427 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2428 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2430 g_return_val_if_fail(account != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2431 g_return_val_if_fail(ui != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2432 g_return_val_if_fail(name != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2434 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2435 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2437 if ((setting = g_hash_table_lookup(table, name)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2438 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2439
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2440 g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2442 return setting->value.integer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2443 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2444
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2445 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2446 purple_account_get_ui_string(const PurpleAccount *account, const char *ui,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2447 const char *name, const char *default_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2448 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2449 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2450 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2452 g_return_val_if_fail(account != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2453 g_return_val_if_fail(ui != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2454 g_return_val_if_fail(name != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2455
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2456 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2457 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2459 if ((setting = g_hash_table_lookup(table, name)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2460 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2461
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2462 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2463
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2464 return setting->value.string;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2465 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2466
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2467 gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2468 purple_account_get_ui_bool(const PurpleAccount *account, const char *ui,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2469 const char *name, gboolean default_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2470 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2471 PurpleAccountSetting *setting;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2472 GHashTable *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2474 g_return_val_if_fail(account != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2475 g_return_val_if_fail(ui != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2476 g_return_val_if_fail(name != NULL, default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2478 if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2479 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2481 if ((setting = g_hash_table_lookup(table, name)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2482 return default_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2483
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2484 g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2485
20354
01101467094f applied changes from 7a436ba53de6adebccf4e920ca62d544e13b1094
Luke Schierer <lschiere@pidgin.im>
parents: 20251
diff changeset
2486 return setting->value.boolean;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2487 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2488
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2489 PurpleLog *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2490 purple_account_get_log(PurpleAccount *account, gboolean create)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2491 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2492 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2494 if(!account->system_log && create){
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2495 PurplePresence *presence;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2496 int login_time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2497
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2498 presence = purple_account_get_presence(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2499 login_time = purple_presence_get_login_time(presence);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2500
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2501 account->system_log = purple_log_new(PURPLE_LOG_SYSTEM,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2502 purple_account_get_username(account), account, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2503 (login_time != 0) ? login_time : time(NULL), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2504 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2506 return account->system_log;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2507 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2509 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2510 purple_account_destroy_log(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2511 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2512 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2513
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2514 if(account->system_log){
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2515 purple_log_free(account->system_log);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2516 account->system_log = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2517 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2518 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2519
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2520 void
32492
cd1d9e04c587 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32310
diff changeset
2521 purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy, const char *message)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2522 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2523 PurplePluginProtocolInfo *prpl_info = NULL;
28469
caa94dfa37f1 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents: 28442
diff changeset
2524 PurpleConnection *gc;
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2525 PurplePlugin *prpl = NULL;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2526
28469
caa94dfa37f1 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents: 28442
diff changeset
2527 g_return_if_fail(account != NULL);
caa94dfa37f1 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents: 28442
diff changeset
2528 g_return_if_fail(buddy != NULL);
caa94dfa37f1 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents: 28442
diff changeset
2529
caa94dfa37f1 Add assertions to purple_account_add_buddy; a NULL buddy is very bad. Refs #10115.
Paul Aurich <paul@darkrain42.org>
parents: 28442
diff changeset
2530 gc = purple_account_get_connection(account);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2531 if (gc != NULL)
29226
34594f33c72e Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28815
diff changeset
2532 prpl = purple_connection_get_prpl(gc);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2533
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2534 if (prpl != NULL)
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2535 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2536
31846
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2537 if (prpl_info != NULL) {
32492
cd1d9e04c587 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32310
diff changeset
2538 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy))
cd1d9e04c587 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32310
diff changeset
2539 prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy), message);
31846
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2540 }
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2541 }
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2542
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2543 void
32492
cd1d9e04c587 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32310
diff changeset
2544 purple_account_add_buddies(PurpleAccount *account, GList *buddies, const char *message)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2545 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2546 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2547 PurpleConnection *gc = purple_account_get_connection(account);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2548 PurplePlugin *prpl = NULL;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2549
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2550 if (gc != NULL)
29226
34594f33c72e Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28815
diff changeset
2551 prpl = purple_connection_get_prpl(gc);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2552
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2553 if (prpl != NULL)
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2554 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2555
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2556 if (prpl_info) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2557 GList *cur, *groups = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2558
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2559 /* Make a list of what group each buddy is in */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2560 for (cur = buddies; cur != NULL; cur = cur->next) {
25301
41485746e2b9 A couple of minor fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25299
diff changeset
2561 PurpleBuddy *buddy = cur->data;
41485746e2b9 A couple of minor fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25299
diff changeset
2562 groups = g_list_append(groups, purple_buddy_get_group(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2563 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2564
32492
cd1d9e04c587 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32310
diff changeset
2565 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies))
cd1d9e04c587 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32310
diff changeset
2566 prpl_info->add_buddies(gc, buddies, groups, message);
31846
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2567 else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) {
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2568 GList *curb = buddies, *curg = groups;
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2569
1bd617f2c46a Add new functions for adding buddies with an invite message. If the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31824
diff changeset
2570 while ((curb != NULL) && (curg != NULL)) {
32492
cd1d9e04c587 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32310
diff changeset
2571 prpl_info->add_buddy(gc, curb->data, curg->data, message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2572 curb = curb->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2573 curg = curg->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2574 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2575 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2577 g_list_free(groups);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2579 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2581 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2582 purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2583 PurpleGroup *group)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2584 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2585 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2586 PurpleConnection *gc = purple_account_get_connection(account);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2587 PurplePlugin *prpl = NULL;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2588
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2589 if (gc != NULL)
29226
34594f33c72e Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28815
diff changeset
2590 prpl = purple_connection_get_prpl(gc);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2591
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2592 if (prpl != NULL)
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2593 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2594
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2595 if (prpl_info && prpl_info->remove_buddy)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2596 prpl_info->remove_buddy(gc, buddy, group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2597 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2598
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2599 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2600 purple_account_remove_buddies(PurpleAccount *account, GList *buddies, GList *groups)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2601 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2602 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2603 PurpleConnection *gc = purple_account_get_connection(account);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2604 PurplePlugin *prpl = NULL;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2605
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2606 if (gc != NULL)
29226
34594f33c72e Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28815
diff changeset
2607 prpl = purple_connection_get_prpl(gc);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2608
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2609 if (prpl != NULL)
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2610 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2611
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2612 if (prpl_info) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2613 if (prpl_info->remove_buddies)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2614 prpl_info->remove_buddies(gc, buddies, groups);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2615 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2616 GList *curb = buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2617 GList *curg = groups;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2618 while ((curb != NULL) && (curg != NULL)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2619 purple_account_remove_buddy(account, curb->data, curg->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2620 curb = curb->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2621 curg = curg->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2622 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2623 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2624 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2625 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2626
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2627 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2628 purple_account_remove_group(PurpleAccount *account, PurpleGroup *group)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2629 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2630 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2631 PurpleConnection *gc = purple_account_get_connection(account);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2632 PurplePlugin *prpl = NULL;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2633
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2634 if (gc != NULL)
29226
34594f33c72e Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28815
diff changeset
2635 prpl = purple_connection_get_prpl(gc);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2636
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2637 if (prpl != NULL)
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2638 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2640 if (prpl_info && prpl_info->remove_group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2641 prpl_info->remove_group(gc, group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2642 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2644 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2645 purple_account_change_password(PurpleAccount *account, const char *orig_pw,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2646 const char *new_pw)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2647 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2648 PurplePluginProtocolInfo *prpl_info = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2649 PurpleConnection *gc = purple_account_get_connection(account);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2650 PurplePlugin *prpl = NULL;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2651
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2652 purple_account_set_password(account, new_pw);
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2653
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2654 if (gc != NULL)
29226
34594f33c72e Fix some funny indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28815
diff changeset
2655 prpl = purple_connection_get_prpl(gc);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2656
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2657 if (prpl != NULL)
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2658 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2660 if (prpl_info && prpl_info->change_passwd)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2661 prpl_info->change_passwd(gc, orig_pw, new_pw);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2662 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2663
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2664 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2665 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2666 PurpleConnection *gc;
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2667 PurplePluginProtocolInfo *prpl_info = NULL;
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2668 PurplePlugin *prpl = NULL;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2669
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2670 g_return_val_if_fail(account, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2671 g_return_val_if_fail(buddy, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2672
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2673 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2674 if (gc == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2675 return FALSE;
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2676
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25398
diff changeset
2677 prpl = purple_connection_get_prpl(gc);
22231
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2678
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2679 if (prpl != NULL)
4af9179e33df Made account.c use purple_connection_get_prpl instead of gc->prpl.
Eoin Coffey <ecoffey@soc.pidgin.im>
parents: 22108
diff changeset
2680 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2682 if (!prpl_info || !prpl_info->offline_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2683 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2684 return prpl_info->offline_message(buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2685 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2686
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2687 static void
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2688 signed_on_cb(PurpleConnection *gc,
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2689 gpointer unused)
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2690 {
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2691 PurpleAccount *account = purple_connection_get_account(gc);
21390
aa52a0a224be Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21379
diff changeset
2692 purple_account_clear_current_error(account);
30118
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2693
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2694 purple_signal_emit(purple_accounts_get_handle(), "account-signed-on",
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2695 account);
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2696 }
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2697
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2698 static void
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2699 signed_off_cb(PurpleConnection *gc,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2700 gpointer unused)
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2701 {
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2702 PurpleAccount *account = purple_connection_get_account(gc);
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2703
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2704 purple_signal_emit(purple_accounts_get_handle(), "account-signed-off",
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2705 account);
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2706 }
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2707
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2708 static void
22500
89a036334991 Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents: 22231
diff changeset
2709 set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err)
21391
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2710 {
22328
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2711 PurpleAccountPrivate *priv;
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2712 PurpleConnectionErrorInfo *old_err;
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2713
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2714 g_return_if_fail(account != NULL);
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2715
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2716 priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2717 old_err = priv->current_error;
21391
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2718
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2719 if(new_err == old_err)
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2720 return;
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2721
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2722 priv->current_error = new_err;
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2723
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2724 purple_signal_emit(purple_accounts_get_handle(),
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2725 "account-error-changed",
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2726 account, old_err, new_err);
21393
6f3f3ed7bd7f Save accounts' current errors to accounts.xml, and restore them at startup.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21391
diff changeset
2727 schedule_accounts_save();
21391
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2728
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2729 if(old_err)
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2730 g_free(old_err->description);
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2731
22500
89a036334991 Register and unregister the PurpleConnectionErrorInfo pointers with dbus, I
Etan Reisner <pidgin@unreliablesource.net>
parents: 22231
diff changeset
2732 PURPLE_DBUS_UNREGISTER_POINTER(old_err);
21391
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2733 g_free(old_err);
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2734 }
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2735
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2736 static void
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2737 connection_error_cb(PurpleConnection *gc,
21391
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2738 PurpleConnectionError type,
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2739 const gchar *description,
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2740 gpointer unused)
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2741 {
22328
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2742 PurpleAccount *account;
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2743 PurpleConnectionErrorInfo *err;
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2744
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2745 account = purple_connection_get_account(gc);
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2746
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2747 g_return_if_fail(account != NULL);
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2748
5fd8b4b4c6bd I'm going to pretend this solves all my problems, except I can't see how
Stu Tomlinson <stu@nosnilmot.com>
parents: 22231
diff changeset
2749 err = g_new0(PurpleConnectionErrorInfo, 1);
22503
e62b3625cc54 Add this back, the merge lost it.
Etan Reisner <pidgin@unreliablesource.net>
parents: 22501
diff changeset
2750 PURPLE_DBUS_REGISTER_POINTER(err, PurpleConnectionErrorInfo);
21391
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2751
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2752 err->type = type;
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2753 err->description = g_strdup(description);
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2754
4b1088076c50 Extract setting an account's current error to a static function. In the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21390
diff changeset
2755 set_current_error(account, err);
30118
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2756
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2757 purple_signal_emit(purple_accounts_get_handle(), "account-connection-error",
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
2758 account, type, description);
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2759 }
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2760
21377
872068d10eab Mark pointed out that PurpleConnectionErrorPair is not a very good name for the
Will Thompson <will.thompson@collabora.co.uk>
parents: 21374
diff changeset
2761 const PurpleConnectionErrorInfo *
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2762 purple_account_get_current_error(PurpleAccount *account)
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2763 {
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2764 PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2765 return priv->current_error;
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2766 }
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
2767
21419
9fe16ecaa4ab Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents: 21418
diff changeset
2768 void
9fe16ecaa4ab Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents: 21418
diff changeset
2769 purple_account_clear_current_error(PurpleAccount *account)
21390
aa52a0a224be Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21379
diff changeset
2770 {
21419
9fe16ecaa4ab Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents: 21418
diff changeset
2771 set_current_error(account, NULL);
21390
aa52a0a224be Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21379
diff changeset
2772 }
21419
9fe16ecaa4ab Propagating ipp to im.pidgin.cpw.resiak.disconnectreason caused
Will Thompson <will.thompson@collabora.co.uk>
parents: 21418
diff changeset
2773
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2774 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2775 purple_accounts_add(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2776 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2777 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2779 if (g_list_find(accounts, account) != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2780 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2782 accounts = g_list_append(accounts, account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2783
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2784 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2785
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2786 purple_signal_emit(purple_accounts_get_handle(), "account-added", account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2787 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2789 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2790 purple_accounts_remove(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2791 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2792 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2794 accounts = g_list_remove(accounts, account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2796 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2797
21379
30a532b14003 Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents: 21377
diff changeset
2798 /* Clearing the error ensures that account-error-changed is emitted,
30a532b14003 Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents: 21377
diff changeset
2799 * which is the end of the guarantee that the the error's pointer is
30a532b14003 Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents: 21377
diff changeset
2800 * valid.
30a532b14003 Document exactly how long the PurpleConnectionErrorInfo pointers given out by
Will Thompson <will.thompson@collabora.co.uk>
parents: 21377
diff changeset
2801 */
21390
aa52a0a224be Add purple_account_clear_current_error(), which does what it says on the tin.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21379
diff changeset
2802 purple_account_clear_current_error(account);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2803 purple_signal_emit(purple_accounts_get_handle(), "account-removed", account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2804 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2805
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2806 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2807 purple_accounts_delete(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2808 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2809 PurpleBlistNode *gnode, *cnode, *bnode;
18452
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2810 GList *iter;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2811
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2812 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2814 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2815 * Disable the account before blowing it out of the water.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2816 * Conceptually it probably makes more sense to disable the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2817 * account for all UIs rather than the just the current UI,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2818 * but it doesn't really matter.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2819 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2820 purple_account_set_enabled(account, purple_core_get_ui(), FALSE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2821
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2822 purple_notify_close_with_handle(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2823 purple_request_close_with_handle(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2824
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2825 purple_accounts_remove(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2827 /* Remove this account's buddies */
25299
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2828 for (gnode = purple_blist_get_root();
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2829 gnode != NULL;
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2830 gnode = purple_blist_node_get_sibling_next(gnode))
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2831 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2832 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2833 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2834
25299
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2835 cnode = purple_blist_node_get_first_child(gnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2836 while (cnode) {
25299
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2837 PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2838
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2839 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
25299
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2840 bnode = purple_blist_node_get_first_child(cnode);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2841 while (bnode) {
25299
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2842 PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2843
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2844 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2845 PurpleBuddy *b = (PurpleBuddy *)bnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2846
25299
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2847 if (purple_buddy_get_account(b) == account)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2848 purple_blist_remove_buddy(b);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2849 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2850 bnode = bnode_next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2851 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2852 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2853 PurpleChat *c = (PurpleChat *)cnode;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2854
25299
5ebfa814b9e8 Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents: 24292
diff changeset
2855 if (purple_chat_get_account(c) == account)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2856 purple_blist_remove_chat(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2857 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2858 cnode = cnode_next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2859 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2860 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2861
18452
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2862 /* Remove any open conversation for this account */
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2863 for (iter = purple_get_conversations(); iter; ) {
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2864 PurpleConversation *conv = iter->data;
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2865 iter = iter->next;
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2866 if (purple_conversation_get_account(conv) == account)
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2867 purple_conversation_destroy(conv);
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2868 }
45865fb3f4f9 Do not crash if you delete an account with an open conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18118
diff changeset
2869
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2870 /* Remove this account's pounces */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2871 purple_pounce_destroy_all_by_account(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2872
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2873 /* This will cause the deletion of an old buddy icon. */
16390
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16068
diff changeset
2874 purple_buddy_icons_set_account_icon(account, NULL, 0);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2875
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2876 purple_account_destroy(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2877 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2879 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2880 purple_accounts_reorder(PurpleAccount *account, gint new_index)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2881 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2882 gint index;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2885 g_return_if_fail(account != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2886 g_return_if_fail(new_index <= g_list_length(accounts));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2887
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2888 index = g_list_index(accounts, account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2890 if (index == -1) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2891 purple_debug_error("account",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2892 "Unregistered account (%s) discovered during reorder!\n",
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2893 purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2894 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2895 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2896
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 l = g_list_nth(accounts, index);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899 if (new_index > index)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2900 new_index--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 /* Remove the old one. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903 accounts = g_list_delete_link(accounts, l);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2904
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2905 /* Insert it where it should go. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906 accounts = g_list_insert(accounts, account, new_index);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908 schedule_accounts_save();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2909 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2910
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2911 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2912 purple_accounts_get_all(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2913 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2914 return accounts;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2915 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2917 GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2918 purple_accounts_get_all_active(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2919 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2920 GList *list = NULL;
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2921 GList *all = purple_accounts_get_all();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2923 while (all != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2924 PurpleAccount *account = all->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2925
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2926 if (purple_account_get_enabled(account, purple_core_get_ui()))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2927 list = g_list_append(list, account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2929 all = all->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2930 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2931
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2932 return list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2933 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2934
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2935 PurpleAccount *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2936 purple_accounts_find(const char *name, const char *protocol_id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2937 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2938 PurpleAccount *account = NULL;
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2939 GList *l;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2940 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2942 g_return_val_if_fail(name != NULL, NULL);
29791
fff648ea95ae Minor optimization / incorrect use prevention
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29741
diff changeset
2943 g_return_val_if_fail(protocol_id != NULL, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2944
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2945 for (l = purple_accounts_get_all(); l != NULL; l = l->next) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2946 account = (PurpleAccount *)l->data;
29791
fff648ea95ae Minor optimization / incorrect use prevention
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29741
diff changeset
2947 if (!purple_strequal(account->protocol_id, protocol_id))
fff648ea95ae Minor optimization / incorrect use prevention
Daniel Atallah <daniel.atallah@gmail.com>
parents: 29741
diff changeset
2948 continue;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2949
32131
7eeaf38e27b0 disapproval of revision '3a12ece5b629e6de76faec79315514e70ccb32bb'
Paul Aurich <paul@darkrain42.org>
parents: 32130
diff changeset
2950 who = g_strdup(purple_normalize(account, name));
25385
a6e3cb32cdd2 Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents: 25368
diff changeset
2951 if (purple_strequal(purple_normalize(account, purple_account_get_username(account)), who)) {
21792
f5d8acf1c5f4 Normalize the names appropriately when searching for accounts. This should
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21778
diff changeset
2952 g_free(who);
23963
d1797f30960f An optimization for purple_accounts_find() to eliminate a malloc/free per
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22694
diff changeset
2953 return account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2954 }
32131
7eeaf38e27b0 disapproval of revision '3a12ece5b629e6de76faec79315514e70ccb32bb'
Paul Aurich <paul@darkrain42.org>
parents: 32130
diff changeset
2955 g_free(who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2956 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2957
23963
d1797f30960f An optimization for purple_accounts_find() to eliminate a malloc/free per
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22694
diff changeset
2958 return NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2959 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2961 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2962 purple_accounts_restore_current_statuses()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2963 {
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
2964 GList *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2965 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2967 /* If we're not connected to the Internet right now, we bail on this */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2968 if (!purple_network_is_available())
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2969 {
27313
627d23bfdb05 Increase the logging level of some debugging messages that seemed to be a
mauro.brasil@tqi.com.br
parents: 26967
diff changeset
2970 purple_debug_warning("account", "Network not connected; skipping reconnect\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2971 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2972 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2973
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2974 for (l = purple_accounts_get_all(); l != NULL; l = l->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2975 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2976 account = (PurpleAccount *)l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2977 if (purple_account_get_enabled(account, purple_core_get_ui()) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2978 (purple_presence_is_online(account->presence)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2979 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2980 purple_account_connect(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2981 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2982 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2983 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2985 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2986 purple_accounts_set_ui_ops(PurpleAccountUiOps *ops)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2987 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2988 account_ui_ops = ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2990
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2991 PurpleAccountUiOps *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2992 purple_accounts_get_ui_ops(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2993 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994 return account_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2995 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2997 void *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
2998 purple_accounts_get_handle(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2999 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3000 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3002 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3005 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3006 purple_accounts_init(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3007 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3008 void *handle = purple_accounts_get_handle();
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3009 void *conn_handle = purple_connections_get_handle();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3010
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3011 purple_signal_register(handle, "account-connecting",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3012 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3013 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3014 PURPLE_SUBTYPE_ACCOUNT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3015
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3016 purple_signal_register(handle, "account-disabled",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3017 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3018 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3019 PURPLE_SUBTYPE_ACCOUNT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3020
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3021 purple_signal_register(handle, "account-enabled",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3022 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3023 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3024 PURPLE_SUBTYPE_ACCOUNT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3025
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3026 purple_signal_register(handle, "account-setting-info",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3027 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3028 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3029 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3030 purple_value_new(PURPLE_TYPE_STRING));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3031
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3032 purple_signal_register(handle, "account-set-info",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3033 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3034 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3035 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3036 purple_value_new(PURPLE_TYPE_STRING));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3037
26845
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3038 purple_signal_register(handle, "account-created",
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3039 purple_marshal_VOID__POINTER, NULL, 1,
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3040 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3041
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3042 purple_signal_register(handle, "account-destroying",
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3043 purple_marshal_VOID__POINTER, NULL, 1,
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3044 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));
76a1598ecf1c Add account-(created|destroying) signals.
Paul Aurich <paul@darkrain42.org>
parents: 26776
diff changeset
3045
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3046 purple_signal_register(handle, "account-added",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3047 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3048 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3049
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3050 purple_signal_register(handle, "account-removed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3051 purple_marshal_VOID__POINTER, NULL, 1,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3052 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3053
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3054 purple_signal_register(handle, "account-status-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3055 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3056 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3057 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3058 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3059 PURPLE_SUBTYPE_STATUS),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3060 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3061 PURPLE_SUBTYPE_STATUS));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3062
26776
83e6e710cbf3 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents: 26622
diff changeset
3063 purple_signal_register(handle, "account-actions-changed",
83e6e710cbf3 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents: 26622
diff changeset
3064 purple_marshal_VOID__POINTER, NULL, 1,
83e6e710cbf3 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents: 26622
diff changeset
3065 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));
83e6e710cbf3 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <paul@darkrain42.org>
parents: 26622
diff changeset
3066
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3067 purple_signal_register(handle, "account-alias-changed",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3068 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3069 purple_value_new(PURPLE_TYPE_SUBTYPE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3070 PURPLE_SUBTYPE_ACCOUNT),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3071 purple_value_new(PURPLE_TYPE_STRING));
20152
0cb113dfb096 Disable the account when the user cancels entering the password so the account isn't stuck in a weird unconnected state. Fixes #1791
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20074
diff changeset
3072
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3073 purple_signal_register(handle, "account-authorization-requested",
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3074 purple_marshal_INT__POINTER_POINTER,
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3075 purple_value_new(PURPLE_TYPE_INT), 2,
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3076 purple_value_new(PURPLE_TYPE_SUBTYPE,
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3077 PURPLE_SUBTYPE_ACCOUNT),
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3078 purple_value_new(PURPLE_TYPE_STRING));
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3079
31820
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
3080 purple_signal_register(handle, "account-authorization-requested-with-message",
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
3081 purple_marshal_INT__POINTER_POINTER_POINTER,
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
3082 purple_value_new(PURPLE_TYPE_INT), 3,
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
3083 purple_value_new(PURPLE_TYPE_SUBTYPE,
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
3084 PURPLE_SUBTYPE_ACCOUNT),
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
3085 purple_value_new(PURPLE_TYPE_STRING),
28e27a37e4b4 Patch from Stefan Ott to add the account-authorization-requested-with-message
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31377
diff changeset
3086 purple_value_new(PURPLE_TYPE_STRING));
20178
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3087 purple_signal_register(handle, "account-authorization-denied",
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3088 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3089 purple_value_new(PURPLE_TYPE_SUBTYPE,
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3090 PURPLE_SUBTYPE_ACCOUNT),
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3091 purple_value_new(PURPLE_TYPE_STRING));
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3092
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3093 purple_signal_register(handle, "account-authorization-granted",
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3094 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3095 purple_value_new(PURPLE_TYPE_SUBTYPE,
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3096 PURPLE_SUBTYPE_ACCOUNT),
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3097 purple_value_new(PURPLE_TYPE_STRING));
8e3ef71c4362 Authorization signals. Modified patch from cockroach. Closes #1061.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20152
diff changeset
3098
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3099 purple_signal_register(handle, "account-error-changed",
21373
cbf197042bad Add the old error to the account-error-changed signal.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21370
diff changeset
3100 purple_marshal_VOID__POINTER_POINTER_POINTER,
cbf197042bad Add the old error to the account-error-changed signal.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21370
diff changeset
3101 NULL, 3,
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3102 purple_value_new(PURPLE_TYPE_SUBTYPE,
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3103 PURPLE_SUBTYPE_ACCOUNT),
21373
cbf197042bad Add the old error to the account-error-changed signal.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21370
diff changeset
3104 purple_value_new(PURPLE_TYPE_POINTER),
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3105 purple_value_new(PURPLE_TYPE_POINTER));
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3106
30118
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3107 purple_signal_register(handle, "account-signed-on",
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3108 purple_marshal_VOID__POINTER, NULL, 1,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3109 purple_value_new(PURPLE_TYPE_SUBTYPE,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3110 PURPLE_SUBTYPE_ACCOUNT));
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3111
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3112 purple_signal_register(handle, "account-signed-off",
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3113 purple_marshal_VOID__POINTER, NULL, 1,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3114 purple_value_new(PURPLE_TYPE_SUBTYPE,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3115 PURPLE_SUBTYPE_ACCOUNT));
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3116
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3117 purple_signal_register(handle, "account-connection-error",
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3118 purple_marshal_VOID__POINTER_INT_POINTER, NULL, 3,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3119 purple_value_new(PURPLE_TYPE_SUBTYPE,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3120 PURPLE_SUBTYPE_ACCOUNT),
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3121 purple_value_new(PURPLE_TYPE_ENUM),
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3122 purple_value_new(PURPLE_TYPE_STRING));
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3123
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3124 purple_signal_connect(conn_handle, "signed-on", handle,
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3125 PURPLE_CALLBACK(signed_on_cb), NULL);
30118
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3126 purple_signal_connect(conn_handle, "signed-off", handle,
4d0ccbc905aa account: Add copies of connection signed-(on|off) and connection-error.
yonas.yanfa@gmail.com
parents: 29791
diff changeset
3127 PURPLE_CALLBACK(signed_off_cb), NULL);
21370
0aa18e21a595 Connect to connection-error in account.c so that the account error is actually
Will Thompson <will.thompson@collabora.co.uk>
parents: 21366
diff changeset
3128 purple_signal_connect(conn_handle, "connection-error", handle,
0aa18e21a595 Connect to connection-error in account.c so that the account error is actually
Will Thompson <will.thompson@collabora.co.uk>
parents: 21366
diff changeset
3129 PURPLE_CALLBACK(connection_error_cb), NULL);
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3130
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3131 load_accounts();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3133 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3134
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3135 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3136 purple_accounts_uninit(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3137 {
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3138 gpointer handle = purple_accounts_get_handle();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3139 if (save_timer != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15594
diff changeset
3141 purple_timeout_remove(save_timer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3142 save_timer = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3143 sync_accounts();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3144 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3145
27439
1ae69ca12971 Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents: 27429
diff changeset
3146 for (; accounts; accounts = g_list_delete_link(accounts, accounts))
1ae69ca12971 Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents: 27429
diff changeset
3147 purple_account_destroy(accounts->data);
1ae69ca12971 Unregister the account signals after destroying accounts.
Paul Aurich <paul@darkrain42.org>
parents: 27429
diff changeset
3148
21366
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3149 purple_signals_disconnect_by_handle(handle);
8858a42ca237 Make PurpleAccount keep track of the last connection error suffered (or not, if
Will Thompson <will.thompson@collabora.co.uk>
parents: 21244
diff changeset
3150 purple_signals_unregister_by_instance(handle);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3151 }