libpurple/protocols/gg/gg.c

Sun, 30 Oct 2011 21:53:14 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sun, 30 Oct 2011 21:53:14 +0000
branch
soc.2008.masterpassword
changeset 34023
6bc30809f7fe
parent 34022
c49f6e9ea27d
parent 32685
140518f18665
child 34028
a3050b6df38e
permissions
-rw-r--r--

propagate from branch 'im.pidgin.pidgin' (head e275f5e7b257ee56363a918879d8af746c519d8d)
to branch 'im.pidgin.soc.2008.masterpassword' (head c49f6e9ea27d2da03e0e9cf9693c21349ef041c0)

11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
1 /**
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2 * @file gg.c Gadu-Gadu protocol plugin
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
4 * purple
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
5 *
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
6 * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us>
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
7 *
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
8 * Some parts of the code are adapted or taken from the previous implementation
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
9 * of this plugin written by Arkadiusz Miskiewicz <misiek@pld.org.pl>
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
10 * Some parts Copyright (C) 2009 Krzysztof Klinikowski <grommasher@gmail.com>
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
11 *
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
12 * Thanks to Google's Summer of Code Program.
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
13 *
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
14 * This program is free software; you can redistribute it and/or modify
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
15 * it under the terms of the GNU General Public License as published by
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
16 * the Free Software Foundation; either version 2 of the License, or
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
17 * (at your option) any later version.
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
18 *
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
19 * This program is distributed in the hope that it will be useful,
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
22 * GNU General Public License for more details.
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
23 *
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
24 * You should have received a copy of the GNU General Public License
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
25 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18629
diff changeset
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
27 */
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
28
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
29 #include "internal.h"
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
30
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
31 #include "plugin.h"
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
32 #include "version.h"
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
33 #include "notify.h"
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
34 #include "status.h"
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
35 #include "blist.h"
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
36 #include "accountopt.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
37 #include "debug.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
38 #include "util.h"
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
39 #include "request.h"
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
40 #include "xmlnode.h"
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
41
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
42 #include "gg.h"
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
43 #include "confer.h"
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
44 #include "search.h"
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
45 #include "buddylist.h"
13627
44233a1064f9 [gaim-migrate @ 16013]
Evan Schoenberg <evands@pidgin.im>
parents: 13573
diff changeset
46 #include "gg-utils.h"
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
47
32674
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
48 #ifdef _WIN32
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
49 # include "win32-resolver.h"
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
50 #endif
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
51
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
52 static PurplePlugin *my_protocol = NULL;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
53
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
54 /* Prototypes */
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
55 static void ggp_set_status(PurpleAccount *account, PurpleStatus *status);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
56 static int ggp_to_gg_status(PurpleStatus *status, char **msg);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
57
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
58 /* ---------------------------------------------------------------------- */
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
59 /* ----- EXTERNAL CALLBACKS --------------------------------------------- */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
60 /* ---------------------------------------------------------------------- */
9950
ac8bc7606554 [gaim-migrate @ 10846]
Tim Ringenbach <marv@pidgin.im>
parents: 9944
diff changeset
61
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
62
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
63 /* ----- HELPERS -------------------------------------------------------- */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
64
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
65 /**
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
66 * Set up libgadu's proxy.
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
67 *
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
68 * @param account Account for which to set up the proxy.
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
69 *
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
70 * @return Zero if proxy setup is valid, otherwise -1.
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
71 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
72 static int ggp_setup_proxy(PurpleAccount *account)
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
73 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
74 PurpleProxyInfo *gpi;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
75
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
76 gpi = purple_proxy_get_setup(account);
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
77
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
78 if ((purple_proxy_info_get_type(gpi) != PURPLE_PROXY_NONE) &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
79 (purple_proxy_info_get_host(gpi) == NULL ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
80 purple_proxy_info_get_port(gpi) <= 0)) {
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
81
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
82 gg_proxy_enabled = 0;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
83 purple_notify_error(NULL, NULL, _("Invalid proxy settings"),
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
84 _("Either the host name or port number specified for your given proxy type is invalid."));
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
85 return -1;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
86 } else if (purple_proxy_info_get_type(gpi) != PURPLE_PROXY_NONE) {
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
87 gg_proxy_enabled = 1;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
88 gg_proxy_host = g_strdup(purple_proxy_info_get_host(gpi));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
89 gg_proxy_port = purple_proxy_info_get_port(gpi);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
90 gg_proxy_username = g_strdup(purple_proxy_info_get_username(gpi));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
91 gg_proxy_password = g_strdup(purple_proxy_info_get_password(gpi));
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
92 } else {
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
93 gg_proxy_enabled = 0;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
94 }
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
95
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
96 return 0;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
97 }
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
98
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
99 static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
100 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
101 PurpleConnection *gc = _gc;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
102 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
103 GGPToken *token = info->token;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
104 GGPTokenCallback cb;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
105
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
106 struct gg_token *t = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
107
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
108 purple_debug_info("gg", "token_handler: token->req: check = %d; state = %d;\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
109 token->req->check, token->req->state);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
110
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
111 if (gg_token_watch_fd(token->req) == -1 || token->req->state == GG_STATE_ERROR) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
112 purple_debug_error("gg", "token error (1): %d\n", token->req->error);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
113 purple_input_remove(token->inpa);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
114 gg_token_free(token->req);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
115 token->req = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
116
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
117 purple_notify_error(purple_connection_get_account(gc),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
118 _("Token Error"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
119 _("Unable to fetch the token.\n"), NULL);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
120 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
121 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
122
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
123 if (token->req->state != GG_STATE_DONE) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
124 purple_input_remove(token->inpa);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
125 token->inpa = purple_input_add(token->req->fd,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
126 (token->req->check == 1)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
127 ? PURPLE_INPUT_WRITE
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
128 : PURPLE_INPUT_READ,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
129 ggp_async_token_handler, gc);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
130 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
131 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
132
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
133 if (!(t = token->req->data) || !token->req->body) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
134 purple_debug_error("gg", "token error (2): %d\n", token->req->error);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
135 purple_input_remove(token->inpa);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
136 gg_token_free(token->req);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
137 token->req = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
138
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
139 purple_notify_error(purple_connection_get_account(gc),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
140 _("Token Error"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
141 _("Unable to fetch the token.\n"), NULL);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
142 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
143 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
144
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
145 purple_input_remove(token->inpa);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
146
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
147 token->id = g_strdup(t->tokenid);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
148 token->size = token->req->body_size;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
149 token->data = g_new0(char, token->size);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
150 memcpy(token->data, token->req->body, token->size);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
151
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
152 purple_debug_info("gg", "TOKEN! tokenid = %s; size = %d\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
153 token->id, token->size);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
154
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
155 gg_token_free(token->req);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
156 token->req = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
157 token->inpa = 0;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
158
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
159 cb = token->cb;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
160 token->cb = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
161 cb(gc);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
162 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
163
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
164 static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
165 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
166 PurpleAccount *account;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
167 struct gg_http *req;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
168 GGPInfo *info;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
169
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
170 account = purple_connection_get_account(gc);
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
171
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
172 if (ggp_setup_proxy(account) == -1)
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
173 return;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
174
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
175 info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
176
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
177 if ((req = gg_token(1)) == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
178 purple_notify_error(account,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
179 _("Token Error"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
180 _("Unable to fetch the token.\n"), NULL);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
181 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
182 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
183
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
184 info->token = g_new(GGPToken, 1);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
185 info->token->cb = cb;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
186
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
187 info->token->req = req;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
188 info->token->inpa = purple_input_add(req->fd, PURPLE_INPUT_READ,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
189 ggp_async_token_handler, gc);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
190 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
191 /* }}} */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
192
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
193 /* ---------------------------------------------------------------------- */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
194
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
195 /**
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
196 * Request buddylist from the server.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
197 * Buddylist is received in the ggp_callback_recv().
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
198 *
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
199 * @param Current action handler.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
200 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
201 static void ggp_action_buddylist_get(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
202 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
203 PurpleConnection *gc = (PurpleConnection *)action->context;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
204 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
205
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
206 purple_debug_info("gg", "Downloading...\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
207
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
208 gg_userlist_request(info->session, GG_USERLIST_GET, NULL);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
209 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
210
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
211 /**
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
212 * Upload the buddylist to the server.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
213 *
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
214 * @param action Current action handler.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
215 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
216 static void ggp_action_buddylist_put(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
217 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
218 PurpleConnection *gc = (PurpleConnection *)action->context;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
219 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
220
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
221 char *buddylist = ggp_buddylist_dump(purple_connection_get_account(gc));
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
222
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
223 purple_debug_info("gg", "Uploading...\n");
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
224
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
225 if (buddylist == NULL)
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
226 return;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
227
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
228 gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
229 g_free(buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
230 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
231
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
232 /**
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
233 * Delete buddylist from the server.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
234 *
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
235 * @param action Current action handler.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
236 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
237 static void ggp_action_buddylist_delete(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
238 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
239 PurpleConnection *gc = (PurpleConnection *)action->context;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
240 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
241
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
242 purple_debug_info("gg", "Deleting...\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
243
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
244 gg_userlist_request(info->session, GG_USERLIST_PUT, NULL);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
245 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
246
21496
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
247 static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *filename)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
248 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
249 PurpleAccount *account = purple_connection_get_account(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
250
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
251 char *buddylist = ggp_buddylist_dump(account);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
252
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
253 purple_debug_info("gg", "Saving...\n");
21496
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
254 purple_debug_info("gg", "file = %s\n", filename);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
255
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
256 if (buddylist == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
257 purple_notify_info(account, _("Save Buddylist..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
258 _("Your buddylist is empty, nothing was written to the file."),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
259 NULL);
2792
f40db99e87c7 [gaim-migrate @ 2805]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2791
diff changeset
260 return;
f40db99e87c7 [gaim-migrate @ 2805]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2791
diff changeset
261 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
262
21496
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
263 if(purple_util_write_data_to_file_absolute(filename, buddylist, -1)) {
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
264 purple_notify_info(account, _("Save Buddylist..."),
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
265 _("Buddylist saved successfully!"), NULL);
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
266 } else {
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
267 gchar *primary = g_strdup_printf(
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
268 _("Couldn't write buddy list for %s to %s"),
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
269 purple_account_get_username(account), filename);
21497
8187406f2043 May as well use an existing string as the title for the error notification.
Will Thompson <resiak@pidgin.im>
parents: 21496
diff changeset
270 purple_notify_error(account, _("Save Buddylist..."),
21496
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
271 primary, NULL);
32972bf7cd4e Actually properly fix this gg "write my buddy list to a file" callback by just
Will Thompson <resiak@pidgin.im>
parents: 21485
diff changeset
272 g_free(primary);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
273 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
274
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
275 g_free(buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
276 }
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
277
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
278 static void ggp_callback_buddylist_load_ok(PurpleConnection *gc, gchar *file)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
279 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
280 PurpleAccount *account = purple_connection_get_account(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
281 GError *error = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
282 char *buddylist = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
283 gsize length;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
284
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
285 purple_debug_info("gg", "file_name = %s\n", file);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
286
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
287 if (!g_file_get_contents(file, &buddylist, &length, &error)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
288 purple_notify_error(account,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
289 _("Couldn't load buddylist"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
290 _("Couldn't load buddylist"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
291 error->message);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
292
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
293 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
294 "Couldn't load buddylist. file = %s; error = %s\n",
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
295 file, error->message);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
296
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
297 g_error_free(error);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
298
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
299 return;
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
300 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
301
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
302 ggp_buddylist_load(gc, buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
303 g_free(buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
304
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
305 purple_notify_info(account,
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
306 _("Load Buddylist..."),
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
307 _("Buddylist loaded successfully!"), NULL);
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
308 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
309 /* }}} */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
310
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
311 /*
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
312 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
313 /* static void ggp_action_buddylist_save(PurplePluginAction *action) {{{ */
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
314 static void ggp_action_buddylist_save(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
315 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
316 PurpleConnection *gc = (PurpleConnection *)action->context;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
317
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
318 purple_request_file(action, _("Save buddylist..."), NULL, TRUE,
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
319 G_CALLBACK(ggp_callback_buddylist_save_ok), NULL,
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
320 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
321 gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
322 }
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
323
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
324 static void ggp_action_buddylist_load(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
325 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
326 PurpleConnection *gc = (PurpleConnection *)action->context;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
327
23379
536450c4f7f9 Mark a string as translatable in prpl-gg. References #5693.
Will Thompson <resiak@pidgin.im>
parents: 23325
diff changeset
328 purple_request_file(action, _("Load buddylist from file..."), NULL,
536450c4f7f9 Mark a string as translatable in prpl-gg. References #5693.
Will Thompson <resiak@pidgin.im>
parents: 23325
diff changeset
329 FALSE,
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
330 G_CALLBACK(ggp_callback_buddylist_load_ok), NULL,
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
331 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
332 gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
333 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
334
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
335 static void ggp_callback_register_account_ok(PurpleConnection *gc,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
336 PurpleRequestFields *fields)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
337 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
338 PurpleAccount *account;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
339 GGPInfo *info = purple_connection_get_protocol_data(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
340 struct gg_http *h = NULL;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
341 struct gg_pubdir *s;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
342 uin_t uin;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
343 gchar *email, *p1, *p2, *t;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
344 GGPToken *token = info->token;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
345
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
346 email = charset_convert(purple_request_fields_get_string(fields, "email"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
347 "UTF-8", "CP1250");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
348 p1 = charset_convert(purple_request_fields_get_string(fields, "password1"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
349 "UTF-8", "CP1250");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
350 p2 = charset_convert(purple_request_fields_get_string(fields, "password2"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
351 "UTF-8", "CP1250");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
352 t = charset_convert(purple_request_fields_get_string(fields, "token"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
353 "UTF-8", "CP1250");
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
354
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
355 account = purple_connection_get_account(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
356
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
357 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL ||
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
358 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
359 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
360 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
361 _("You must fill in all registration fields"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
362 goto exit_err;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
363 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
364
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
365 if (g_utf8_collate(p1, p2) != 0) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
366 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
367 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
368 _("Passwords do not match"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
369 goto exit_err;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
370 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
371
22622
1ecb840b5101 Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <markdoliner@pidgin.im>
parents: 22546
diff changeset
372 purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
373 token->id, t);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
374 h = gg_register3(email, p1, token->id, t, 0);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
375 if (h == NULL || !(s = h->data) || !s->success) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
376 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
377 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
378 _("Unable to register new account. An unknown error occurred."));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
379 goto exit_err;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
380 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
381
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
382 uin = s->uin;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
383 purple_debug_info("gg", "registered uin: %d\n", uin);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
384
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
385 g_free(t);
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
386 t = g_strdup_printf("%u", uin);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
387 purple_account_set_username(account, t);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
388 /* Save the password if remembering passwords for the account */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
389 purple_account_set_password(account, p1);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
390
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
391 purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
392 _("Registration completed successfully!"), NULL);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
393
18997
072dcd2ed1b3 Gadu-Gadu now calls the registration_cb for the account if it is set after performing a registration
Evan Schoenberg <evands@pidgin.im>
parents: 18629
diff changeset
394 if(account->registration_cb)
072dcd2ed1b3 Gadu-Gadu now calls the registration_cb for the account if it is set after performing a registration
Evan Schoenberg <evands@pidgin.im>
parents: 18629
diff changeset
395 (account->registration_cb)(account, TRUE, account->registration_cb_user_data);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
396 /* TODO: the currently open Accounts Window will not be updated withthe
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
397 * new username and etc, we need to somehow have it refresh at this
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
398 * point
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
399 */
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
400
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
401 /* Need to disconnect or actually log in. For now, we disconnect. */
24569
5dbd0617a27d Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents: 24043
diff changeset
402 purple_account_disconnect(account);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
403
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
404 exit_err:
18997
072dcd2ed1b3 Gadu-Gadu now calls the registration_cb for the account if it is set after performing a registration
Evan Schoenberg <evands@pidgin.im>
parents: 18629
diff changeset
405 if(account->registration_cb)
072dcd2ed1b3 Gadu-Gadu now calls the registration_cb for the account if it is set after performing a registration
Evan Schoenberg <evands@pidgin.im>
parents: 18629
diff changeset
406 (account->registration_cb)(account, FALSE, account->registration_cb_user_data);
072dcd2ed1b3 Gadu-Gadu now calls the registration_cb for the account if it is set after performing a registration
Evan Schoenberg <evands@pidgin.im>
parents: 18629
diff changeset
407
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
408 gg_register_free(h);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
409 g_free(email);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
410 g_free(p1);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
411 g_free(p2);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
412 g_free(t);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
413 g_free(token->id);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
414 g_free(token);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
415 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
416
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
417 static void ggp_callback_register_account_cancel(PurpleConnection *gc,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
418 PurpleRequestFields *fields)
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
419 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
420 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
421 GGPToken *token = info->token;
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
422
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32675
diff changeset
423 purple_account_disconnect(purple_connection_get_account(gc));
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
424
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
425 g_free(token->id);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
426 g_free(token->data);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
427 g_free(token);
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
428
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
429 }
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
430
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
431 static void ggp_register_user_dialog(PurpleConnection *gc)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
432 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
433 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
434 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
435 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
436 PurpleRequestField *field;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
437
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
438 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
439 GGPToken *token = info->token;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
440
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
441
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
442 account = purple_connection_get_account(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
443
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
444 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
445 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
446 purple_request_fields_add_group(fields, group);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
447
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
448 field = purple_request_field_string_new("email",
23325
a374a26fe217 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents: 23295
diff changeset
449 _("Email"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
450 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
451 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
452
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
453 field = purple_request_field_string_new("password1",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
454 _("Password"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
455 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
456 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
457
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
458 field = purple_request_field_string_new("password2",
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
459 _("Password (again)"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
460 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
461 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
462
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
463 field = purple_request_field_string_new("token",
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
464 _("Enter captcha text"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
465 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
466 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
467
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
468 /* original size: 60x24 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
469 field = purple_request_field_image_new("token_img",
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
470 _("Captcha"), token->data, token->size);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
471 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
472
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
473 purple_request_fields(account,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
474 _("Register New Gadu-Gadu Account"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
475 _("Register New Gadu-Gadu Account"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
476 _("Please, fill in the following fields"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
477 fields,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
478 _("OK"), G_CALLBACK(ggp_callback_register_account_ok),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
479 _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel),
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
480 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
481 gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
482 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
483
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
484 /* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
485
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
486 static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
487 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
488 GGPInfo *info = purple_connection_get_protocol_data(gc);
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
489 GGPSearchForm *form = user_data;
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
490 guint32 seq;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
491
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
492 form->page_number++;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
493
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
494 ggp_search_remove(info->searches, form->seq);
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
495 purple_debug_info("gg", "ggp_callback_show_next(): Removed seq %u\n",
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
496 form->seq);
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
497
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
498 seq = ggp_search_start(gc, form);
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
499 ggp_search_add(info->searches, seq, form);
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
500 purple_debug_info("gg", "ggp_callback_show_next(): Added seq %u\n",
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
501 seq);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
502 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
503
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
504 static void ggp_callback_add_buddy(PurpleConnection *gc, GList *row, gpointer user_data)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
505 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
506 purple_blist_request_add_buddy(purple_connection_get_account(gc),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
507 g_list_nth_data(row, 0), NULL, NULL);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
508 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
509
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
510 static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data)
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
511 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
512 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
513 PurpleConversation *conv;
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
514 char *name;
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
515
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
516 account = purple_connection_get_account(gc);
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
517
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
518 name = g_list_nth_data(row, 0);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
519 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
520 purple_conversation_present(conv);
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
521 }
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
522
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
523 static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
524 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
525 GGPInfo *info = purple_connection_get_protocol_data(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
526 GGPSearchForm *form;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
527 guint32 seq;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
528
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
529 form = ggp_search_form_new(GGP_SEARCH_TYPE_FULL);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
530
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
531 form->user_data = info;
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
532 form->lastname = g_strdup(
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
533 purple_request_fields_get_string(fields, "lastname"));
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
534 form->firstname = g_strdup(
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
535 purple_request_fields_get_string(fields, "firstname"));
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
536 form->nickname = g_strdup(
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
537 purple_request_fields_get_string(fields, "nickname"));
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
538 form->city = g_strdup(
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
539 purple_request_fields_get_string(fields, "city"));
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
540 form->birthyear = g_strdup(
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
541 purple_request_fields_get_string(fields, "year"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
542
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
543 switch (purple_request_fields_get_choice(fields, "gender")) {
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
544 case 1:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
545 form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
546 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
547 case 2:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
548 form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
549 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
550 default:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
551 form->gender = NULL;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
552 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
553 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
554
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
555 form->active = purple_request_fields_get_bool(fields, "active")
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
556 ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
557
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
558 seq = ggp_search_start(gc, form);
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
559 ggp_search_add(info->searches, seq, form);
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
560 purple_debug_info("gg", "ggp_callback_find_buddies(): Added seq %u\n",
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
561 seq);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
562 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
563
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
564 static void ggp_find_buddies(PurplePluginAction *action)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
565 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
566 PurpleConnection *gc = (PurpleConnection *)action->context;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
567
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
568 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
569 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
570 PurpleRequestField *field;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
571
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
572 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
573 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
574 purple_request_fields_add_group(fields, group);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
575
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
576 field = purple_request_field_string_new("lastname",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
577 _("Last name"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
578 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
579 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
580
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
581 field = purple_request_field_string_new("firstname",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
582 _("First name"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
583 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
584 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
585
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
586 field = purple_request_field_string_new("nickname",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
587 _("Nickname"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
588 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
589 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
590
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
591 field = purple_request_field_string_new("city",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
592 _("City"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
593 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
594 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
595
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
596 field = purple_request_field_string_new("year",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
597 _("Year of birth"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
598 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
599
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
600 field = purple_request_field_choice_new("gender", _("Gender"), 0);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
601 purple_request_field_choice_add(field, _("Male or female"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
602 purple_request_field_choice_add(field, _("Male"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
603 purple_request_field_choice_add(field, _("Female"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
604 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
605
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
606 field = purple_request_field_bool_new("active",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
607 _("Only online"), FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
608 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
609
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
610 purple_request_fields(gc,
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
611 _("Find buddies"),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
612 _("Find buddies"),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
613 _("Please, enter your search criteria below"),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
614 fields,
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
615 _("OK"), G_CALLBACK(ggp_callback_find_buddies),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
616 _("Cancel"), NULL,
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
617 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
618 gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
619 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
620
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
621 /* ----- CHANGE PASSWORD ---------------------------------------------------- */
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
622
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
623 typedef struct
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
624 {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
625 guint inpa;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
626 struct gg_http *http_req;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
627 gchar *new_password;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
628 PurpleAccount *account;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
629 } ggp_change_passwd_request;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
630
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
631 static void ggp_callback_change_passwd_handler(gpointer _req, gint fd,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
632 PurpleInputCondition cond)
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
633 {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
634 ggp_change_passwd_request *req = _req;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
635 const char *messagesTitle =
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
636 _("Change password for the Gadu-Gadu account");
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
637
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
638 purple_input_remove(req->inpa);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
639
32649
b497d33010e3 Gadu-Gadu: use correct libgadu api functions to change password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32648
diff changeset
640 if (gg_change_passwd_watch_fd(req->http_req) == -1 ||
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
641 req->http_req->state == GG_STATE_ERROR)
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
642 goto exit_error;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
643
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
644 if (req->http_req->state != GG_STATE_DONE)
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
645 {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
646 req->inpa = ggp_http_input_add(req->http_req,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
647 ggp_callback_change_passwd_handler, req);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
648 return;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
649 }
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
650
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
651 if (req->http_req->data != NULL &&
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
652 ((struct gg_pubdir*)req->http_req->data)->success == 1)
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
653 {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
654 purple_account_set_password(req->account, req->new_password);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
655 purple_notify_info(req->account, messagesTitle,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
656 _("Password was changed successfully!"), NULL);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
657 goto exit_cleanup;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
658 }
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
659
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
660 exit_error:
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
661 purple_notify_error(req->account, messagesTitle,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
662 _("Unable to change password. Error occurred.\n"), NULL);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
663
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
664 exit_cleanup:
32649
b497d33010e3 Gadu-Gadu: use correct libgadu api functions to change password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32648
diff changeset
665 gg_change_passwd_free(req->http_req);
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
666 g_free(req->new_password);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
667 g_free(req);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
668 }
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
669
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
670 static void ggp_callback_change_passwd_ok(PurpleConnection *gc,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
671 PurpleRequestFields *fields)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
672 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
673 PurpleAccount *account;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
674 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
675 struct gg_http *h;
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
676 gchar *cur, *p1, *p2, *t, *mail;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
677 const char *messagesTitle =
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
678 _("Change password for the Gadu-Gadu account");
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
679
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
680 cur = g_strdup(purple_request_fields_get_string(fields,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
681 "password_cur"));
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
682 p1 = g_strdup(purple_request_fields_get_string(fields, "password1"));
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
683 p2 = g_strdup(purple_request_fields_get_string(fields, "password2"));
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
684 t = g_strdup(purple_request_fields_get_string(fields, "token"));
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
685 mail = g_strdup(purple_request_fields_get_string(fields, "email"));
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
686
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
687 account = purple_connection_get_account(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
688
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
689 if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL ||
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
690 mail == NULL || *cur == '\0' || *p1 == '\0' || *p2 == '\0' ||
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
691 *t == '\0' || *mail == '\0') {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
692 purple_notify_error(account, messagesTitle,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
693 _("Fill in the fields."), NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
694 goto exit_err;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
695 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
696
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
697 if (g_utf8_collate(p1, p2) != 0) {
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
698 purple_notify_error(account, messagesTitle,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
699 _("New passwords do not match."), NULL);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
700 goto exit_err;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
701 }
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
702
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
703 if (strlen(p1) > 15) {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
704 purple_notify_error(account, messagesTitle,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
705 _("New password should be at most 15 characters long."),
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
706 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
707 goto exit_err;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
708 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
709
34022
c49f6e9ea27d Make all the prpls build.
Paul Aurich <darkrain42@pidgin.im>
parents: 27642
diff changeset
710 if (g_utf8_collate(cur, purple_connection_get_password(gc)) != 0) {
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
711 purple_notify_error(account, messagesTitle,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
712 _("Your current password is different from the one that"
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
713 " you specified."), NULL);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
714 goto exit_err;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
715 }
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
716
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
717 if (!purple_email_is_valid(mail)) {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
718 purple_notify_error(account, messagesTitle,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
719 _("Invalid email address"), NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
720 goto exit_err;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
721 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
722
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
723 purple_debug_info("gg", "Changing password with email \"%s\"...\n",
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
724 mail);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
725
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
726 h = gg_change_passwd4(ggp_get_uin(account), mail,
34023
6bc30809f7fe propagate from branch 'im.pidgin.pidgin' (head e275f5e7b257ee56363a918879d8af746c519d8d)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34022 32685
diff changeset
727 purple_connection_get_password(gc), p1, info->token->id, t,
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
728 1);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
729
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
730 if (h == NULL)
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
731 purple_notify_error(account, messagesTitle,
14754
621ecdbdaf9a [gaim-migrate @ 17444]
Paul Schulz
parents: 14604
diff changeset
732 _("Unable to change password. Error occurred.\n"),
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
733 NULL);
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
734 else
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
735 {
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
736 ggp_change_passwd_request *req =
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
737 g_new(ggp_change_passwd_request, 1);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
738 req->http_req = h;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
739 req->new_password = g_strdup(p1);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
740 req->account = account;
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
741
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
742 req->inpa = ggp_http_input_add(h,
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
743 ggp_callback_change_passwd_handler, req);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
744 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
745
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
746 exit_err:
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
747 g_free(cur);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
748 g_free(p1);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
749 g_free(p2);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
750 g_free(t);
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
751 g_free(mail);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
752 g_free(info->token->id);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
753 g_free(info->token->data);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
754 g_free(info->token);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
755 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
756
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
757 static void ggp_change_passwd_dialog(PurpleConnection *gc)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
758 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
759 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
760 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
761 PurpleRequestField *field;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
762
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
763 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
764 GGPToken *token = info->token;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
765
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
766 char *msg;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
767
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
768 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
769 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
770 purple_request_fields_add_group(fields, group);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
771
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
772 field = purple_request_field_string_new("password_cur",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
773 _("Current password"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
774 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
775 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
776
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
777 field = purple_request_field_string_new("password1",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
778 _("Password"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
779 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
780 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
781
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
782 field = purple_request_field_string_new("password2",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
783 _("Password (retype)"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
784 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
785 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
786
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
787 field = purple_request_field_string_new("email",
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
788 _("Email Address"), "", FALSE);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
789 purple_request_field_string_set_masked(field, FALSE);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
790 purple_request_field_group_add_field(group, field);
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
791
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
792 field = purple_request_field_string_new("token",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
793 _("Enter current token"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
794 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
795 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
796
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
797 /* original size: 60x24 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
798 field = purple_request_field_image_new("token_img",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
799 _("Current token"), token->data, token->size);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
800 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
801
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
802 msg = g_strdup_printf("%s %d",
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
803 _("Please, enter your current password and your new password "
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
804 "for UIN: "), ggp_get_uin(purple_connection_get_account(gc)));
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
805
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
806 purple_request_fields(gc,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
807 _("Change Gadu-Gadu Password"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
808 _("Change Gadu-Gadu Password"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
809 msg,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
810 fields, _("OK"), G_CALLBACK(ggp_callback_change_passwd_ok),
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
811 _("Cancel"), NULL,
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
812 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
813 gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
814
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
815 g_free(msg);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
816 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
817
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
818 static void ggp_change_passwd(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
819 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
820 PurpleConnection *gc = (PurpleConnection *)action->context;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
821
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
822 ggp_token_request(gc, ggp_change_passwd_dialog);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
823 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
824
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
825 /* ----- CHANGE STATUS BROADCASTING ------------------------------------------------ */
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
826
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
827 static void ggp_action_change_status_broadcasting_ok(PurpleConnection *gc, PurpleRequestFields *fields)
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
828 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
829 GGPInfo *info = purple_connection_get_protocol_data(gc);
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
830 int selected_field;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
831 PurpleAccount *account = purple_connection_get_account(gc);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
832 PurpleStatus *status;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
833
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
834 selected_field = purple_request_fields_get_choice(fields, "status_broadcasting");
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
835
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
836 if (selected_field == 0)
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
837 info->status_broadcasting = TRUE;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
838 else
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
839 info->status_broadcasting = FALSE;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
840
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
841 status = purple_account_get_active_status(account);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
842
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
843 ggp_set_status(account, status);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
844 }
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
845
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
846 static void ggp_action_change_status_broadcasting(PurplePluginAction *action)
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
847 {
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
848 PurpleConnection *gc = (PurpleConnection *)action->context;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
849 GGPInfo *info = purple_connection_get_protocol_data(gc);
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
850
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
851 PurpleRequestFields *fields;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
852 PurpleRequestFieldGroup *group;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
853 PurpleRequestField *field;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
854
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
855 fields = purple_request_fields_new();
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
856 group = purple_request_field_group_new(NULL);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
857 purple_request_fields_add_group(fields, group);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
858
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
859 field = purple_request_field_choice_new("status_broadcasting", _("Show status to:"), 0);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
860 purple_request_field_choice_add(field, _("All people"));
31551
4fbcf0444939 Make terminology more consistent with the rest of our strings. Refs #13358.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31550
diff changeset
861 purple_request_field_choice_add(field, _("Only buddies"));
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
862 purple_request_field_group_add_field(group, field);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
863
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
864 if (info->status_broadcasting)
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
865 purple_request_field_choice_set_default_value(field, 0);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
866 else
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
867 purple_request_field_choice_set_default_value(field, 1);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
868
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
869 purple_request_fields(gc,
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
870 _("Change status broadcasting"),
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
871 _("Change status broadcasting"),
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
872 _("Please, select who can see your status"),
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
873 fields,
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
874 _("OK"), G_CALLBACK(ggp_action_change_status_broadcasting_ok),
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
875 _("Cancel"), NULL,
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
876 purple_connection_get_account(gc), NULL, NULL,
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
877 gc);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
878 }
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
879
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
880 /* ----- CONFERENCES ---------------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
881
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
882 static void ggp_callback_add_to_chat_ok(PurpleBuddy *buddy, PurpleRequestFields *fields)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
883 {
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
884 PurpleConnection *conn;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
885 PurpleRequestField *field;
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 17455
diff changeset
886 GList *sel;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
887
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
888 conn = purple_account_get_connection(purple_buddy_get_account(buddy));
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
889
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
890 g_return_if_fail(conn != NULL);
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
891
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
892 field = purple_request_fields_get_field(fields, "name");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
893 sel = purple_request_field_list_get_selected(field);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
894
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
895 if (sel == NULL) {
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
896 purple_debug_error("gg", "No chat selected\n");
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
897 return;
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
898 }
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
899
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
900 ggp_confer_participants_add_uin(conn, sel->data,
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
901 ggp_str_to_uin(purple_buddy_get_name(buddy)));
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
902 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
903
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
904 static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
905 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
906 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
907 PurpleConnection *gc;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
908 GGPInfo *info;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
909
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
910 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
911 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
912 PurpleRequestField *field;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
913
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
914 GList *l;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
915 gchar *msg;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
916
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
917 buddy = (PurpleBuddy *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
918 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
919 info = purple_connection_get_protocol_data(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
920
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
921 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
922 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
923 purple_request_fields_add_group(fields, group);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
924
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
925 field = purple_request_field_list_new("name", "Chat name");
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
926 for (l = info->chats; l != NULL; l = l->next) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
927 GGPChat *chat = l->data;
32531
5c85c02694e1 Remove deprecated purple_request_field_list_add().
Andrew Victor <andrew.victor@mxit.com>
parents: 32338
diff changeset
928 purple_request_field_list_add_icon(field, chat->name, NULL, chat->name);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
929 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
930 purple_request_field_group_add_field(group, field);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
931
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
932 msg = g_strdup_printf(_("Select a chat for buddy: %s"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
933 purple_buddy_get_alias(buddy));
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
934 purple_request_fields(gc,
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
935 _("Add to chat..."),
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
936 _("Add to chat..."),
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
937 msg,
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
938 fields,
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
939 _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok),
16490
68c22924d66b 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 <evands@pidgin.im>
parents: 15884
diff changeset
940 _("Cancel"), NULL,
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
941 purple_connection_get_account(gc), NULL, NULL,
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
942 buddy);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
943 g_free(msg);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
944 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
945
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
946 /* ----- BLOCK BUDDIES -------------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
947
31938
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
948 static void ggp_add_deny(PurpleConnection *gc, const char *who)
11410
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
949 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
950 GGPInfo *info = purple_connection_get_protocol_data(gc);
31938
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
951 uin_t uin = ggp_str_to_uin(who);
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
952
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
953 purple_debug_info("gg", "ggp_add_deny: %u\n", uin);
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
954
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
955 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL);
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
956 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED);
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
957 }
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
958
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
959 static void ggp_rem_deny(PurpleConnection *gc, const char *who)
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
960 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
961 GGPInfo *info = purple_connection_get_protocol_data(gc);
31938
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
962 uin_t uin = ggp_str_to_uin(who);
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
963
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
964 purple_debug_info("gg", "ggp_rem_deny: %u\n", uin);
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
965
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
966 gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED);
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
967 gg_add_notify_ex(info->session, uin, GG_USER_NORMAL);
11410
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
968 }
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
969
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
970 /* ---------------------------------------------------------------------- */
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
971 /* ----- INTERNAL CALLBACKS --------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
972 /* ---------------------------------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
973
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
974 struct gg_fetch_avatar_data
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
975 {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
976 PurpleConnection *gc;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
977 gchar *uin;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
978 gchar *avatar_url;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
979 };
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
980
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
981
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
982 static void gg_fetch_avatar_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
983 const gchar *data, size_t len, const gchar *error_message) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
984 struct gg_fetch_avatar_data *d = user_data;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
985 PurpleAccount *account;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
986 PurpleBuddy *buddy;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
987 gpointer buddy_icon_data;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
988
31952
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
989 purple_debug_info("gg", "gg_fetch_avatar_cb: got avatar image for %s\n",
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
990 d->uin);
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
991
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
992 /* FIXME: This shouldn't be necessary */
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
993 if (!PURPLE_CONNECTION_IS_VALID(d->gc)) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
994 g_free(d->uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
995 g_free(d->avatar_url);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
996 g_free(d);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
997 g_return_if_reached();
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
998 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
999
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1000 account = purple_connection_get_account(d->gc);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1001 buddy = purple_find_buddy(account, d->uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1002
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1003 if (buddy == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1004 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1005
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1006 buddy_icon_data = g_memdup(data, len);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1007
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1008 purple_buddy_icons_set_for_user(account, purple_buddy_get_name(buddy),
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1009 buddy_icon_data, len, d->avatar_url);
31952
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
1010 purple_debug_info("gg", "gg_fetch_avatar_cb: UIN %s should have avatar "
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
1011 "now\n", d->uin);
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1012
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1013 out:
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1014 g_free(d->uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1015 g_free(d->avatar_url);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1016 g_free(d);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1017 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1018
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1019 static void gg_get_avatar_url_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1020 const gchar *url_text, size_t len, const gchar *error_message) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1021 struct gg_fetch_avatar_data *data;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1022 PurpleConnection *gc = user_data;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1023 PurpleAccount *account;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1024 PurpleBuddy *buddy;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1025 const char *uin;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1026 const char *is_blank;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1027 const char *checksum;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1028
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1029 gchar *bigavatar = NULL;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1030 xmlnode *xml = NULL;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1031 xmlnode *xmlnode_users;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1032 xmlnode *xmlnode_user;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1033 xmlnode *xmlnode_avatars;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1034 xmlnode *xmlnode_avatar;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1035 xmlnode *xmlnode_bigavatar;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1036
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1037 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1038 account = purple_connection_get_account(gc);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1039
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1040 if (error_message != NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1041 purple_debug_error("gg", "gg_get_avatars_cb error: %s\n", error_message);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1042 else if (len > 0 && url_text && *url_text) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1043 xml = xmlnode_from_str(url_text, -1);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1044 if (xml == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1045 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1046
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1047 xmlnode_users = xmlnode_get_child(xml, "users");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1048 if (xmlnode_users == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1049 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1050
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1051 xmlnode_user = xmlnode_get_child(xmlnode_users, "user");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1052 if (xmlnode_user == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1053 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1054
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1055 uin = xmlnode_get_attrib(xmlnode_user, "uin");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1056
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1057 xmlnode_avatars = xmlnode_get_child(xmlnode_user, "avatars");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1058 if (xmlnode_avatars == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1059 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1060
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1061 xmlnode_avatar = xmlnode_get_child(xmlnode_avatars, "avatar");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1062 if (xmlnode_avatar == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1063 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1064
29182
f11475f964ac Fix Gadu-Gadu avatars. The server's response format has changed. Fixes #11050.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27642
diff changeset
1065 xmlnode_bigavatar = xmlnode_get_child(xmlnode_avatar, "originBigAvatar");
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1066 if (xmlnode_bigavatar == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1067 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1068
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1069 is_blank = xmlnode_get_attrib(xmlnode_avatar, "blank");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1070 bigavatar = xmlnode_get_data(xmlnode_bigavatar);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1071
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1072 purple_debug_info("gg", "gg_get_avatar_url_cb: UIN %s, IS_BLANK %s, "
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1073 "URL %s\n",
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1074 uin ? uin : "(null)", is_blank ? is_blank : "(null)",
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1075 bigavatar ? bigavatar : "(null)");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1076
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1077 if (uin != NULL && bigavatar != NULL) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1078 buddy = purple_find_buddy(account, uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1079 if (buddy == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1080 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1081
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1082 checksum = purple_buddy_icons_get_checksum_for_user(buddy);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1083
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1084 if (purple_strequal(is_blank, "1")) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1085 purple_buddy_icons_set_for_user(account,
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1086 purple_buddy_get_name(buddy), NULL, 0, NULL);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1087 } else if (!purple_strequal(checksum, bigavatar)) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1088 data = g_new0(struct gg_fetch_avatar_data, 1);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1089 data->gc = gc;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1090 data->uin = g_strdup(uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1091 data->avatar_url = g_strdup(bigavatar);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1092
31952
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
1093 purple_debug_info("gg", "gg_get_avatar_url_cb: "
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
1094 "requesting avatar for %s\n", uin);
32596
927575c2af4e * purple_util_fetch_url_request_len() renamed to purple_util_fetch_url_request().
Andrew Victor <andrew.victor@mxit.com>
parents: 32531
diff changeset
1095 url_data = purple_util_fetch_url_request(account,
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1096 bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)",
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1097 FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1098 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1099 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1100 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1101
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1102 out:
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1103 if (xml)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1104 xmlnode_free(xml);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1105 g_free(bigavatar);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1106 }
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
1107
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1108 /**
31665
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1109 * Try to update avatar of the buddy.
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1110 *
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1111 * @param gc PurpleConnection
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1112 * @param uin UIN of the buddy.
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1113 */
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1114 static void ggp_update_buddy_avatar(PurpleConnection *gc, uin_t uin)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1115 {
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1116 gchar *avatarurl;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1117 PurpleUtilFetchUrlData *url_data;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1118
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1119 purple_debug_info("gg", "ggp_update_buddy_avatar(gc, %u)\n", uin);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1120
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1121 avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%u/0.xml", uin);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1122
32596
927575c2af4e * purple_util_fetch_url_request_len() renamed to purple_util_fetch_url_request().
Andrew Victor <andrew.victor@mxit.com>
parents: 32531
diff changeset
1123 url_data = purple_util_fetch_url_request(
31665
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1124 purple_connection_get_account(gc), avatarurl, TRUE,
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1125 "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1,
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1126 gg_get_avatar_url_cb, gc);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1127
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1128 g_free(avatarurl);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1129 }
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1130
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1131 /**
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1132 * Handle change of the status of the buddy.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1133 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1134 * @param gc PurpleConnection
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1135 * @param uin UIN of the buddy.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1136 * @param status ID of the status.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1137 * @param descr Description.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1138 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1139 static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1140 int status, const char *descr)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1141 {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1142 gchar *from;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1143 const char *st;
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1144 char *status_msg = NULL;
31665
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1145
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1146 ggp_update_buddy_avatar(gc, uin);
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1147
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1148 from = g_strdup_printf("%u", uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1149
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1150 switch (status) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1151 case GG_STATUS_NOT_AVAIL:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1152 case GG_STATUS_NOT_AVAIL_DESCR:
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1153 st = purple_primitive_get_id_from_type(PURPLE_STATUS_OFFLINE);
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1154 break;
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1155 case GG_STATUS_FFC:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1156 case GG_STATUS_FFC_DESCR:
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
1157 st = "freeforchat";
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1158 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1159 case GG_STATUS_AVAIL:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1160 case GG_STATUS_AVAIL_DESCR:
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1161 st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1162 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1163 case GG_STATUS_BUSY:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1164 case GG_STATUS_BUSY_DESCR:
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1165 st = purple_primitive_get_id_from_type(PURPLE_STATUS_AWAY);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1166 break;
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
1167 case GG_STATUS_INVISIBLE:
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
1168 case GG_STATUS_INVISIBLE_DESCR:
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
1169 st = purple_primitive_get_id_from_type(PURPLE_STATUS_INVISIBLE);
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
1170 break;
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1171 case GG_STATUS_DND:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1172 case GG_STATUS_DND_DESCR:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1173 st = purple_primitive_get_id_from_type(PURPLE_STATUS_UNAVAILABLE);
30055
1aa76ed6cda6 gadu-gadu: Add a missing 'break;'
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 30006
diff changeset
1174 break;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1175 case GG_STATUS_BLOCKED:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1176 /* user is blocking us.... */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1177 st = "blocked";
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1178 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1179 default:
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1180 st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1181 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1182 "GG_EVENT_NOTIFY: Unknown status: %d\n", status);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1183 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1184 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1185
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1186 if (descr != NULL) {
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1187 status_msg = g_strdup(descr);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1188 g_strstrip(status_msg);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1189 if (status_msg[0] == '\0') {
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1190 g_free(status_msg);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1191 status_msg = NULL;
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1192 }
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1193 }
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1194
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1195 purple_debug_info("gg", "status of %u is %s [%s]\n", uin, st,
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1196 status_msg ? status_msg : "");
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1197 if (status_msg == NULL) {
30006
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1198 purple_prpl_got_user_status(purple_connection_get_account(gc),
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1199 from, st, NULL);
30006
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1200 } else {
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1201 purple_prpl_got_user_status(purple_connection_get_account(gc),
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1202 from, st, "message", status_msg, NULL);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1203 g_free(status_msg);
30006
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1204 }
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1205 g_free(from);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1206 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1207
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1208 static void ggp_sr_close_cb(gpointer user_data)
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1209 {
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1210 GGPSearchForm *form = user_data;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1211 GGPInfo *info = form->user_data;
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1212
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1213 ggp_search_remove(info->searches, form->seq);
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1214 purple_debug_info("gg", "ggp_sr_close_cb(): Removed seq %u\n",
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1215 form->seq);
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1216 ggp_search_form_destroy(form);
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1217 }
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1218
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1219 /**
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1220 * Translate a status' ID to a more user-friendly name.
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1221 *
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1222 * @param id The ID of the status.
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1223 *
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1224 * @return The user-friendly name of the status.
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1225 */
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1226 static const char *ggp_status_by_id(unsigned int id)
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1227 {
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1228 const char *st;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1229
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1230 purple_debug_info("gg", "ggp_status_by_id: %d\n", id);
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1231 switch (id) {
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1232 case GG_STATUS_NOT_AVAIL:
27371
6f8830d73092 Correctly show status in tooltips for GG contacts with status messages.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27255
diff changeset
1233 case GG_STATUS_NOT_AVAIL_DESCR:
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1234 st = _("Offline");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1235 break;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1236 case GG_STATUS_AVAIL:
27371
6f8830d73092 Correctly show status in tooltips for GG contacts with status messages.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27255
diff changeset
1237 case GG_STATUS_AVAIL_DESCR:
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1238 st = _("Available");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1239 break;
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1240 case GG_STATUS_FFC:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1241 case GG_STATUS_FFC_DESCR:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1242 return _("Chatty");
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1243 case GG_STATUS_DND:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1244 case GG_STATUS_DND_DESCR:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1245 return _("Do Not Disturb");
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1246 case GG_STATUS_BUSY:
27371
6f8830d73092 Correctly show status in tooltips for GG contacts with status messages.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27255
diff changeset
1247 case GG_STATUS_BUSY_DESCR:
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1248 st = _("Away");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1249 break;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1250 default:
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1251 st = _("Unknown");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1252 break;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1253 }
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1254
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1255 return st;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1256 }
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1257
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1258 static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req,
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1259 GGPSearchForm *form)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1260 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1261 PurpleNotifyUserInfo *user_info;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1262 PurpleBuddy *buddy;
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1263 char *val, *who;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1264
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1265 user_info = purple_notify_user_info_new();
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1266
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1267 val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS);
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1268 /* XXX: Use of ggp_str_to_uin() is an ugly hack! */
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1269 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), ggp_status_by_id(ggp_str_to_uin(val)));
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1270 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1271
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1272 who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1273 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1274 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
1275 purple_notify_user_info_add_pair_html(user_info, _("UIN"), who);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1276
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1277 val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1278 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1279 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
1280 purple_notify_user_info_add_pair_html(user_info, _("First Name"), val);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1281 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1282
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1283 val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1284 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1285 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
1286 purple_notify_user_info_add_pair_html(user_info, _("Nickname"), val);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1287 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1288
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1289 val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1290 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1291 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
1292 purple_notify_user_info_add_pair_html(user_info, _("City"), val);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1293 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1294
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1295 val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR);
15205
f642029b2f97 [gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents: 15196
diff changeset
1296 if (strncmp(val, "0", 1)) {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1297 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1298 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
1299 purple_notify_user_info_add_pair_html(user_info, _("Birth Year"), val);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1300 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1301 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1302
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1303 /*
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1304 * Include a status message, if exists and buddy is in the blist.
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1305 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1306 buddy = purple_find_buddy(purple_connection_get_account(gc), who);
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1307 if (NULL != buddy) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1308 PurpleStatus *status;
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1309 const char *msg;
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1310
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1311 status = purple_presence_get_active_status(purple_buddy_get_presence(buddy));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1312 msg = purple_status_get_attr_string(status, "message");
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1313
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1314 if (msg != NULL) {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
1315 purple_notify_user_info_add_pair_plaintext(user_info, _("Message"), msg);
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1316 }
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1317 }
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1318
18629
9e78088bfc46 Close temporary Get Info window when showing the real one. Fixes #1720.
Bartosz Oler <bartosz@pidgin.im>
parents: 18190
diff changeset
1319 purple_notify_userinfo(gc, who, user_info, ggp_sr_close_cb, form);
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1320 g_free(who);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1321 purple_notify_user_info_destroy(user_info);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1322 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1323
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1324 static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req,
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1325 GGPSearchForm *form)
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1326 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1327 PurpleNotifySearchResults *results;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1328 PurpleNotifySearchColumn *column;
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1329 int res_count;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1330 int start;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1331 int i;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1332
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1333 g_return_if_fail(form != NULL);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1334
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1335 res_count = gg_pubdir50_count(req);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1336 res_count = (res_count > PUBDIR_RESULTS_MAX) ? PUBDIR_RESULTS_MAX : res_count;
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1337 if (form->page_size == 0)
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1338 form->page_size = res_count;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1339
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1340 results = purple_notify_searchresults_new();
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1341
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1342 if (results == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1343 purple_debug_error("gg", "ggp_pubdir_reply_handler: "
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1344 "Unable to display the search results.\n");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1345 purple_notify_error(gc, NULL,
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1346 _("Unable to display the search results."),
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1347 NULL);
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1348 if (form->window == NULL)
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1349 ggp_sr_close_cb(form);
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1350 return;
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1351 }
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1352
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1353 column = purple_notify_searchresults_column_new(_("UIN"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1354 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1355
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1356 column = purple_notify_searchresults_column_new(_("First Name"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1357 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1358
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1359 column = purple_notify_searchresults_column_new(_("Nickname"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1360 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1361
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1362 column = purple_notify_searchresults_column_new(_("City"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1363 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1364
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1365 column = purple_notify_searchresults_column_new(_("Birth Year"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1366 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1367
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1368 purple_debug_info("gg", "Going with %d entries\n", res_count);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1369
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1370 start = (int)ggp_str_to_uin(gg_pubdir50_get(req, 0, GG_PUBDIR50_START));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1371 purple_debug_info("gg", "start = %d\n", start);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1372
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1373 for (i = 0; i < res_count; i++) {
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1374 GList *row = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1375 char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1376
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1377 /* TODO: Status will be displayed as an icon. */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1378 /* row = g_list_append(row, ggp_search_get_result(req, i, GG_PUBDIR50_STATUS)); */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1379 row = g_list_append(row, ggp_search_get_result(req, i,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1380 GG_PUBDIR50_UIN));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1381 row = g_list_append(row, ggp_search_get_result(req, i,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1382 GG_PUBDIR50_FIRSTNAME));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1383 row = g_list_append(row, ggp_search_get_result(req, i,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1384 GG_PUBDIR50_NICKNAME));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1385 row = g_list_append(row, ggp_search_get_result(req, i,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1386 GG_PUBDIR50_CITY));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1387 row = g_list_append(row,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1388 (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-"));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1389
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1390 purple_notify_searchresults_row_add(results, row);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1391 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1392
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1393 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_CONTINUE,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1394 ggp_callback_show_next);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1395 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1396 ggp_callback_add_buddy);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1397 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_IM,
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
1398 ggp_callback_im);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1399
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1400 if (form->window == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1401 void *h = purple_notify_searchresults(gc,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1402 _("Gadu-Gadu Public Directory"),
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1403 _("Search results"), NULL, results,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1404 (PurpleNotifyCloseCallback)ggp_sr_close_cb,
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1405 form);
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1406
12277
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1407 if (h == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1408 purple_debug_error("gg", "ggp_pubdir_reply_handler: "
12277
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1409 "Unable to display the search results.\n");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1410 purple_notify_error(gc, NULL,
12277
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1411 _("Unable to display the search results."),
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1412 NULL);
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1413 return;
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1414 }
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1415
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1416 form->window = h;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1417 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1418 purple_notify_searchresults_new_rows(gc, results, form->window);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1419 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1420 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1421
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1422 static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req)
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1423 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
1424 GGPInfo *info = purple_connection_get_protocol_data(gc);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1425 GGPSearchForm *form;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1426 int res_count;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1427 guint32 seq;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1428
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1429 seq = gg_pubdir50_seq(req);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1430 form = ggp_search_get(info->searches, seq);
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1431 purple_debug_info("gg",
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1432 "ggp_pubdir_reply_handler(): seq %u --> form %p\n", seq, form);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1433 /*
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1434 * this can happen when user will request more results
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1435 * and close the results window before they arrive.
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1436 */
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1437 g_return_if_fail(form != NULL);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1438
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1439 res_count = gg_pubdir50_count(req);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1440 if (res_count < 1) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1441 purple_debug_info("gg", "GG_EVENT_PUBDIR50_SEARCH_REPLY: Nothing found\n");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1442 purple_notify_error(gc, NULL,
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1443 _("No matching users found"),
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1444 _("There are no users matching your search criteria."));
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1445 if (form->window == NULL)
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1446 ggp_sr_close_cb(form);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1447 return;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1448 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1449
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1450 switch (form->search_type) {
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1451 case GGP_SEARCH_TYPE_INFO:
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1452 ggp_pubdir_handle_info(gc, req, form);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1453 break;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1454 case GGP_SEARCH_TYPE_FULL:
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1455 ggp_pubdir_handle_full(gc, req, form);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1456 break;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1457 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1458 purple_debug_warning("gg", "Unknown search_type!\n");
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1459 break;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1460 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1461 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1462
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1463 static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev)
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1464 {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1465 gint imgid = 0;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
1466 GGPInfo *info = purple_connection_get_protocol_data(gc);
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1467 GList *entry = g_list_first(info->pending_richtext_messages);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1468 gchar *handlerid = g_strdup_printf("IMGID_HANDLER-%i", ev->event.image_reply.crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1469
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1470 imgid = purple_imgstore_add_with_id(
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1471 g_memdup(ev->event.image_reply.image, ev->event.image_reply.size),
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1472 ev->event.image_reply.size,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1473 ev->event.image_reply.filename);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1474
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1475 purple_debug_info("gg", "ggp_recv_image_handler: got image with crc32: %u\n", ev->event.image_reply.crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1476
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1477 while(entry) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1478 if (strstr((gchar *)entry->data, handlerid) != NULL) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1479 gchar **split = g_strsplit((gchar *)entry->data, handlerid, 3);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1480 gchar *text = g_strdup_printf("%s%i%s", split[0], imgid, split[1]);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1481 purple_debug_info("gg", "ggp_recv_image_handler: found message matching crc32: %s\n", (gchar *)entry->data);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1482 g_strfreev(split);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1483 info->pending_richtext_messages = g_list_remove(info->pending_richtext_messages, entry->data);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1484 /* We don't have any more images to download */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1485 if (strstr(text, "<IMG ID=\"IMGID_HANDLER") == NULL) {
31663
e05ed1139d6f gg: Fix a null pointer dereference.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31661
diff changeset
1486 gchar *buf = g_strdup_printf("%lu", (unsigned long int)ev->event.image_reply.sender);
e05ed1139d6f gg: Fix a null pointer dereference.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31661
diff changeset
1487 serv_got_im(gc, buf, text, PURPLE_MESSAGE_IMAGES, time(NULL));
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1488 g_free(buf);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1489 purple_debug_info("gg", "ggp_recv_image_handler: richtext message: %s\n", text);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1490 g_free(text);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1491 break;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1492 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1493 info->pending_richtext_messages = g_list_append(info->pending_richtext_messages, text);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1494 break;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1495 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1496 entry = g_list_next(entry);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1497 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1498 g_free(handlerid);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1499
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1500 return;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1501 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1502
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1503
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1504 /**
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1505 * Dispatch a message received from a buddy.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1506 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1507 * @param gc PurpleConnection.
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1508 * @param ev Gadu-Gadu event structure.
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1509 *
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1510 * Image receiving, some code borrowed from Kadu http://www.kadu.net
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1511 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1512 static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1513 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
1514 GGPInfo *info = purple_connection_get_protocol_data(gc);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1515 PurpleConversation *conv;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1516 gchar *from;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1517 gchar *msg;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1518 gchar *tmp;
32645
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1519 time_t mtime;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1520
31611
764040623eb1 When somebody sends me an image, I get some (depends on image size) empty
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31595
diff changeset
1521 if (ev->event.msg.message == NULL)
764040623eb1 When somebody sends me an image, I get some (depends on image size) empty
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31595
diff changeset
1522 {
764040623eb1 When somebody sends me an image, I get some (depends on image size) empty
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31595
diff changeset
1523 purple_debug_warning("gg", "ggp_recv_message_handler: NULL as message pointer\n");
764040623eb1 When somebody sends me an image, I get some (depends on image size) empty
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31595
diff changeset
1524 return;
764040623eb1 When somebody sends me an image, I get some (depends on image size) empty
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31595
diff changeset
1525 }
764040623eb1 When somebody sends me an image, I get some (depends on image size) empty
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31595
diff changeset
1526
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1527 from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1528
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1529 /*
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1530 tmp = charset_convert((const char *)ev->event.msg.message,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1531 "CP1250", "UTF-8");
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1532 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1533 tmp = g_strdup_printf("%s", ev->event.msg.message);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1534 purple_str_strip_char(tmp, '\r');
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1535 msg = g_markup_escape_text(tmp, -1);
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1536 g_free(tmp);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1537
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1538 /* We got richtext message */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1539 if (ev->event.msg.formats_length)
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1540 {
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
1541 gboolean got_image = FALSE, bold = FALSE, italic = FALSE, under = FALSE;
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1542 char *cformats = (char *)ev->event.msg.formats;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1543 char *cformats_end = cformats + ev->event.msg.formats_length;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1544 gint increased_len = 0;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1545 struct gg_msg_richtext_format *actformat;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1546 struct gg_msg_richtext_image *actimage;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1547 GString *message = g_string_new(msg);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1548 gchar *handlerid;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1549
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1550 purple_debug_info("gg", "ggp_recv_message_handler: richtext msg from (%s): %s %i formats\n", from, msg, ev->event.msg.formats_length);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1551
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1552 while (cformats < cformats_end)
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1553 {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1554 gint byteoffset;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1555 actformat = (struct gg_msg_richtext_format *)cformats;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1556 cformats += sizeof(struct gg_msg_richtext_format);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1557 byteoffset = g_utf8_offset_to_pointer(message->str, actformat->position + increased_len) - message->str;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1558
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1559 if(actformat->position == 0 && actformat->font == 0) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1560 purple_debug_warning("gg", "ggp_recv_message_handler: bogus formatting (inc: %i)\n", increased_len);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1561 continue;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1562 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1563 purple_debug_info("gg", "ggp_recv_message_handler: format at pos: %i, image:%i, bold:%i, italic: %i, under:%i (inc: %i)\n",
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1564 actformat->position,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1565 (actformat->font & GG_FONT_IMAGE) != 0,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1566 (actformat->font & GG_FONT_BOLD) != 0,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1567 (actformat->font & GG_FONT_ITALIC) != 0,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1568 (actformat->font & GG_FONT_UNDERLINE) != 0,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1569 increased_len);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1570
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1571 if (actformat->font & GG_FONT_IMAGE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1572 got_image = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1573 actimage = (struct gg_msg_richtext_image*)(cformats);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1574 cformats += sizeof(struct gg_msg_richtext_image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1575 purple_debug_info("gg", "ggp_recv_message_handler: image received, size: %d, crc32: %i\n", actimage->size, actimage->crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1576
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1577 /* Checking for errors, image size shouldn't be
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1578 * larger than 255.000 bytes */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1579 if (actimage->size > 255000) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1580 purple_debug_warning("gg", "ggp_recv_message_handler: received image large than 255 kb\n");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1581 continue;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1582 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1583
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1584 gg_image_request(info->session, ev->event.msg.sender,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1585 actimage->size, actimage->crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1586
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1587 handlerid = g_strdup_printf("<IMG ID=\"IMGID_HANDLER-%i\">", actimage->crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1588 g_string_insert(message, byteoffset, handlerid);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1589 increased_len += strlen(handlerid);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1590 g_free(handlerid);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1591 continue;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1592 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1593
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1594 if (actformat->font & GG_FONT_BOLD) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1595 if (bold == FALSE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1596 g_string_insert(message, byteoffset, "<b>");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1597 increased_len += 3;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1598 bold = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1599 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1600 } else if (bold) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1601 g_string_insert(message, byteoffset, "</b>");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1602 increased_len += 4;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1603 bold = FALSE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1604 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1605
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1606 if (actformat->font & GG_FONT_ITALIC) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1607 if (italic == FALSE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1608 g_string_insert(message, byteoffset, "<i>");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1609 increased_len += 3;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1610 italic = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1611 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1612 } else if (italic) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1613 g_string_insert(message, byteoffset, "</i>");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1614 increased_len += 4;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1615 italic = FALSE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1616 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1617
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1618 if (actformat->font & GG_FONT_UNDERLINE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1619 if (under == FALSE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1620 g_string_insert(message, byteoffset, "<u>");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1621 increased_len += 3;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1622 under = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1623 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1624 } else if (under) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1625 g_string_insert(message, byteoffset, "</u>");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1626 increased_len += 4;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1627 under = FALSE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1628 }
31386
85d81b2b1142 gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31294
diff changeset
1629
85d81b2b1142 gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31294
diff changeset
1630 if (actformat->font & GG_FONT_COLOR) {
85d81b2b1142 gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31294
diff changeset
1631 cformats += sizeof(struct gg_msg_richtext_color);
85d81b2b1142 gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31294
diff changeset
1632 }
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1633 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1634
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1635 msg = message->str;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1636 g_string_free(message, FALSE);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1637
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1638 if (got_image) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1639 info->pending_richtext_messages = g_list_append(info->pending_richtext_messages, msg);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1640 return;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1641 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1642 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1643
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1644 purple_debug_info("gg", "ggp_recv_message_handler: msg from (%s): %s (class = %d; rcpt_count = %d)\n",
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1645 from, msg, ev->event.msg.msgclass,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1646 ev->event.msg.recipients_count);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1647
32645
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1648 if (ev->event.msg.msgclass & GG_CLASS_QUEUED)
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1649 mtime = ev->event.msg.time;
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1650 else
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1651 mtime = time(NULL);
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1652
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1653 if (ev->event.msg.recipients_count == 0) {
32645
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1654 serv_got_im(gc, from, msg, 0, mtime);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1655 } else {
12373
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1656 const char *chat_name;
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1657 int chat_id;
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1658 char *buddy_name;
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1659
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1660 chat_name = ggp_confer_find_by_participants(gc,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1661 ev->event.msg.recipients,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1662 ev->event.msg.recipients_count);
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1663
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1664 if (chat_name == NULL) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1665 chat_name = ggp_confer_add_new(gc, NULL);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1666 serv_got_joined_chat(gc, info->chats_count, chat_name);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1667
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1668 ggp_confer_participants_add_uin(gc, chat_name,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1669 ev->event.msg.sender);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1670
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1671 ggp_confer_participants_add(gc, chat_name,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1672 ev->event.msg.recipients,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1673 ev->event.msg.recipients_count);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1674 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1675 conv = ggp_confer_find_by_name(gc, chat_name);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1676 chat_id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv));
12373
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1677
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1678 buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender);
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1679 serv_got_chat_in(gc, chat_id, buddy_name,
32645
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1680 PURPLE_MESSAGE_RECV, msg, mtime);
12373
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1681 g_free(buddy_name);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1682 }
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1683 g_free(msg);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1684 g_free(from);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1685 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1686
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1687 static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev)
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1688 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
1689 GGPInfo *info = purple_connection_get_protocol_data(gc);
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1690 PurpleStoredImage *image;
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
1691 gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, GINT_TO_POINTER(ev->event.image_request.crc32)));
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
1692
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
1693 purple_debug_info("gg", "ggp_send_image_handler: image request received, crc32: %u, imgid: %d\n", ev->event.image_request.crc32, imgid);
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1694
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1695 if(imgid)
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1696 {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1697 if((image = purple_imgstore_find_by_id(imgid))) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1698 gint image_size = purple_imgstore_get_size(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1699 gconstpointer image_bin = purple_imgstore_get_data(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1700 const char *image_filename = purple_imgstore_get_filename(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1701
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1702 purple_debug_info("gg", "ggp_send_image_handler: sending image imgid: %i, crc: %u\n", imgid, ev->event.image_request.crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1703 gg_image_reply(info->session, (unsigned long int)ev->event.image_request.sender, image_filename, image_bin, image_size);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1704 purple_imgstore_unref(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1705 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1706 purple_debug_error("gg", "ggp_send_image_handler: image imgid: %i, crc: %u in hash but not found in imgstore!\n", imgid, ev->event.image_request.crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1707 }
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
1708 g_hash_table_remove(info->pending_images, GINT_TO_POINTER(ev->event.image_request.crc32));
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1709 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1710 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1711
31630
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1712 static void ggp_typing_notification_handler(PurpleConnection *gc, uin_t uin, int length) {
31795
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1713 gchar *from;
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1714
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1715 from = g_strdup_printf("%u", uin);
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1716 if (length)
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1717 serv_got_typing(gc, from, 0, PURPLE_TYPING);
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1718 else
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1719 serv_got_typing_stopped(gc, from);
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1720 g_free(from);
31630
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1721 }
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1722
31665
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1723 /**
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1724 * Handling of XML events.
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1725 *
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1726 * @param gc PurpleConnection.
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1727 * @param data Raw XML contents.
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1728 *
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1729 * @see http://toxygen.net/libgadu/protocol/#ch1.13
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1730 */
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1731 static void ggp_xml_event_handler(PurpleConnection *gc, char *data)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1732 {
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1733 xmlnode *xml = NULL;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1734 xmlnode *xmlnode_next_event;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1735
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1736 xml = xmlnode_from_str(data, -1);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1737 if (xml == NULL)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1738 goto out;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1739
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1740 xmlnode_next_event = xmlnode_get_child(xml, "event");
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1741 while (xmlnode_next_event != NULL)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1742 {
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1743 xmlnode *xmlnode_current_event = xmlnode_next_event;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1744
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1745 xmlnode *xmlnode_type;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1746 char *event_type_raw;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1747 int event_type = 0;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1748
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1749 xmlnode *xmlnode_sender;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1750 char *event_sender_raw;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1751 uin_t event_sender = 0;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1752
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1753 xmlnode_next_event = xmlnode_get_next_twin(xmlnode_next_event);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1754
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1755 xmlnode_type = xmlnode_get_child(xmlnode_current_event, "type");
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1756 if (xmlnode_type == NULL)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1757 continue;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1758 event_type_raw = xmlnode_get_data(xmlnode_type);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1759 if (event_type_raw != NULL)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1760 event_type = atoi(event_type_raw);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1761 g_free(event_type_raw);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1762
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1763 xmlnode_sender = xmlnode_get_child(xmlnode_current_event, "sender");
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1764 if (xmlnode_sender != NULL)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1765 {
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1766 event_sender_raw = xmlnode_get_data(xmlnode_sender);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1767 if (event_sender_raw != NULL)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1768 event_sender = ggp_str_to_uin(event_sender_raw);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1769 g_free(event_sender_raw);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1770 }
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1771
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1772 switch (event_type)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1773 {
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1774 case 28: /* avatar update */
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1775 purple_debug_info("gg",
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1776 "ggp_xml_event_handler: avatar updated (uid: %u)\n",
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1777 event_sender);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1778 ggp_update_buddy_avatar(gc, event_sender);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1779 break;
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1780 default:
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1781 purple_debug_error("gg",
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1782 "ggp_xml_event_handler: unsupported event type=%d from=%u\n",
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1783 event_type, event_sender);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1784 }
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1785 }
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1786
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1787 out:
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1788 if (xml)
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1789 xmlnode_free(xml);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1790 }
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1791
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1792 static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1793 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1794 PurpleConnection *gc = _gc;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
1795 GGPInfo *info = purple_connection_get_protocol_data(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1796 struct gg_event *ev;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1797 int i;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1798
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1799 if (!(ev = gg_watch_fd(info->session))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1800 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1801 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n");
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
1802 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
1803 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
1804 _("Unable to read from socket"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1805 return;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1806 }
31661
2a8aceaee628 Don't update last_received when receiving data on gg. Fixes #13699.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31649
diff changeset
1807
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1808 switch (ev->type) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1809 case GG_EVENT_NONE:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1810 /* Nothing happened. */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1811 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1812 case GG_EVENT_MSG:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1813 ggp_recv_message_handler(gc, ev);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1814 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1815 case GG_EVENT_ACK:
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1816 /* Changing %u to %i fixes compiler warning */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1817 purple_debug_info("gg",
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1818 "ggp_callback_recv: message sent to: %i, delivery status=%d, seq=%d\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1819 ev->event.ack.recipient, ev->event.ack.status,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1820 ev->event.ack.seq);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1821 break;
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1822 case GG_EVENT_IMAGE_REPLY:
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1823 ggp_recv_image_handler(gc, ev);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1824 break;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1825 case GG_EVENT_IMAGE_REQUEST:
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1826 ggp_send_image_handler(gc, ev);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1827 break;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1828 case GG_EVENT_NOTIFY:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1829 case GG_EVENT_NOTIFY_DESCR:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1830 {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1831 struct gg_notify_reply *n;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1832 char *descr;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1833
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1834 purple_debug_info("gg", "notify_pre: (%d) status: %d\n",
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1835 ev->event.notify->uin,
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1836 GG_S(ev->event.notify->status));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1837
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1838 n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1839 : ev->event.notify_descr.notify;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1840
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1841 for (; n->uin; n++) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1842 descr = (ev->type == GG_EVENT_NOTIFY) ? NULL
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1843 : ev->event.notify_descr.descr;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1844
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1845 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1846 "notify: (%d) status: %d; descr: %s\n",
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1847 n->uin, GG_S(n->status), descr ? descr : "(null)");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1848
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1849 ggp_generic_status_handler(gc,
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1850 n->uin, GG_S(n->status), descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1851 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1852 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1853 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1854 case GG_EVENT_NOTIFY60:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1855 for (i = 0; ev->event.notify60[i].uin; i++) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1856 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1857 "notify60: (%d) status=%d; version=%d; descr=%s\n",
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1858 ev->event.notify60[i].uin,
30006
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1859 GG_S(ev->event.notify60[i].status),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1860 ev->event.notify60[i].version,
14524
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1861 ev->event.notify60[i].descr ? ev->event.notify60[i].descr : "(null)");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1862
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1863 ggp_generic_status_handler(gc, ev->event.notify60[i].uin,
30006
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1864 GG_S(ev->event.notify60[i].status),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1865 ev->event.notify60[i].descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1866 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1867 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1868 case GG_EVENT_STATUS:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1869 purple_debug_info("gg", "status: (%d) status=%d; descr=%s\n",
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1870 ev->event.status.uin, GG_S(ev->event.status.status),
14524
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1871 ev->event.status.descr ? ev->event.status.descr : "(null)");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1872
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1873 ggp_generic_status_handler(gc, ev->event.status.uin,
30006
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1874 GG_S(ev->event.status.status), ev->event.status.descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1875 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1876 case GG_EVENT_STATUS60:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1877 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1878 "status60: (%d) status=%d; version=%d; descr=%s\n",
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1879 ev->event.status60.uin, GG_S(ev->event.status60.status),
14524
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1880 ev->event.status60.version,
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1881 ev->event.status60.descr ? ev->event.status60.descr : "(null)");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1882
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1883 ggp_generic_status_handler(gc, ev->event.status60.uin,
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1884 GG_S(ev->event.status60.status), ev->event.status60.descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1885 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1886 case GG_EVENT_USERLIST:
31795
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1887 if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1888 purple_debug_info("gg", "GG_USERLIST_GET_REPLY\n");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1889 purple_notify_info(gc, NULL,
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1890 _("Buddy list downloaded"),
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1891 _("Your buddy list was downloaded from the server."));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1892 if (ev->event.userlist.reply != NULL) {
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1893 ggp_buddylist_load(gc, ev->event.userlist.reply);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1894 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1895 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1896 purple_debug_info("gg", "GG_USERLIST_PUT_REPLY\n");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1897 purple_notify_info(gc, NULL,
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1898 _("Buddy list uploaded"),
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1899 _("Your buddy list was stored on the server."));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1900 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1901 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1902 case GG_EVENT_PUBDIR50_SEARCH_REPLY:
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1903 ggp_pubdir_reply_handler(gc, ev->event.pubdir50);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1904 break;
31630
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1905 case GG_EVENT_TYPING_NOTIFICATION:
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1906 ggp_typing_notification_handler(gc, ev->event.typing_notification.uin,
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1907 ev->event.typing_notification.length);
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1908 break;
31665
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1909 case GG_EVENT_XML_EVENT:
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1910 purple_debug_info("gg", "GG_EVENT_XML_EVENT\n");
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1911 ggp_xml_event_handler(gc, ev->event.xml_event.data);
1854b313a9bb Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31663
diff changeset
1912 break;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1913 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1914 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1915 "unsupported event type=%d\n", ev->type);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1916 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1917 }
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1918
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1919 gg_free_event(ev);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1920 }
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1921
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1922 static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1923 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1924 PurpleConnection *gc = _gc;
15419
c8f83c72739d [gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents: 15294
diff changeset
1925 GGPInfo *info;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1926 struct gg_event *ev;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1927
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1928 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
15419
c8f83c72739d [gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents: 15294
diff changeset
1929
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
1930 info = purple_connection_get_protocol_data(gc);
15419
c8f83c72739d [gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents: 15294
diff changeset
1931
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1932 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1933 info->session->check, info->session->state);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1934
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1935 switch (info->session->state) {
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1936 case GG_STATE_RESOLVING:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1937 purple_debug_info("gg", "GG_STATE_RESOLVING\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1938 break;
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1939 case GG_STATE_RESOLVING_GG:
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1940 purple_debug_info("gg", "GG_STATE_RESOLVING_GG\n");
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1941 break;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1942 case GG_STATE_CONNECTING_HUB:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1943 purple_debug_info("gg", "GG_STATE_CONNECTING_HUB\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1944 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1945 case GG_STATE_READING_DATA:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1946 purple_debug_info("gg", "GG_STATE_READING_DATA\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1947 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1948 case GG_STATE_CONNECTING_GG:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1949 purple_debug_info("gg", "GG_STATE_CONNECTING_GG\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1950 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1951 case GG_STATE_READING_KEY:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1952 purple_debug_info("gg", "GG_STATE_READING_KEY\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1953 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1954 case GG_STATE_READING_REPLY:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1955 purple_debug_info("gg", "GG_STATE_READING_REPLY\n");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1956 break;
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1957 case GG_STATE_TLS_NEGOTIATION:
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1958 purple_debug_info("gg", "GG_STATE_TLS_NEGOTIATION\n");
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1959 break;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1960 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1961 purple_debug_error("gg", "unknown state = %d\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1962 info->session->state);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1963 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1964 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1965
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1966 if (!(ev = gg_watch_fd(info->session))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1967 purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n");
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
1968 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
1969 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
1970 _("Unable to read from socket"));
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1971 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1972 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1973 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1974 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1975 info->session->check, info->session->state);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1976
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1977 purple_input_remove(info->inpa);
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1978 info->inpa = 0;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1979
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1980 /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1981 if (info->session->fd >= 0)
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1982 info->inpa = purple_input_add(info->session->fd,
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1983 (info->session->check == 1) ? PURPLE_INPUT_WRITE :
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1984 PURPLE_INPUT_READ,
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
1985 ggp_async_login_handler, gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1986
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1987 switch (ev->type) {
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1988 case GG_EVENT_NONE:
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1989 /* Nothing happened. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1990 purple_debug_info("gg", "GG_EVENT_NONE\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1991 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1992 case GG_EVENT_CONN_SUCCESS:
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
1993 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1994 purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n");
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1995 purple_input_remove(info->inpa);
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1996 info->inpa = purple_input_add(info->session->fd,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1997 PURPLE_INPUT_READ,
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
1998 ggp_callback_recv, gc);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
1999
27642
6ae79601ad84 Patch from kkszysiu to make the GG prpl support
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27626
diff changeset
2000 ggp_buddylist_send(gc);
30163
e43601d06035 gg: Fix misuse of update_progress. Fixes #11774
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 30138
diff changeset
2001 purple_connection_update_progress(gc, _("Connected"), 1, 2);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2002 purple_connection_set_state(gc, PURPLE_CONNECTED);
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2003 }
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2004 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2005 case GG_EVENT_CONN_FAILED:
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2006 purple_input_remove(info->inpa);
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2007 info->inpa = 0;
32646
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2008 purple_debug_info("gg", "Connection failure: %d\n",
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2009 ev->event.failure);
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2010 switch (ev->event.failure) {
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2011 case GG_FAILURE_RESOLVING:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2012 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2013 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2014 _("Unable to resolve "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2015 "hostname"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2016 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2017 case GG_FAILURE_PASSWORD:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2018 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2019 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2020 _("Incorrect password"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2021 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2022 case GG_FAILURE_TLS:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2023 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2024 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2025 _("SSL Connection Failed"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2026 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2027 case GG_FAILURE_INTRUDER:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2028 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2029 PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2030 _("Your account has been "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2031 "disabled because too many "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2032 "incorrect passwords were "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2033 "entered"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2034 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2035 case GG_FAILURE_UNAVAILABLE:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2036 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2037 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2038 _("Service temporarily "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2039 "unavailable"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2040 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2041 case GG_FAILURE_PROXY:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2042 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2043 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2044 _("Error connecting to proxy "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2045 "server"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2046 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2047 case GG_FAILURE_HUB:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2048 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2049 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2050 _("Error connecting to master "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2051 "server"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2052 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2053 default:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2054 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2055 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2056 _("Connection failed"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2057 }
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2058 break;
31874
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2059 case GG_EVENT_MSG:
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2060 if (ev->event.msg.sender == 0)
32647
a8e9b3781df1 Gadu-Gadu: check for NULL pointer before logging system messages.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32646
diff changeset
2061 {
a8e9b3781df1 Gadu-Gadu: check for NULL pointer before logging system messages.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32646
diff changeset
2062 if (ev->event.msg.message == NULL)
a8e9b3781df1 Gadu-Gadu: check for NULL pointer before logging system messages.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32646
diff changeset
2063 break;
a8e9b3781df1 Gadu-Gadu: check for NULL pointer before logging system messages.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32646
diff changeset
2064
31874
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2065 /* system messages are mostly ads */
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2066 purple_debug_info("gg", "System message:\n%s\n",
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2067 ev->event.msg.message);
32647
a8e9b3781df1 Gadu-Gadu: check for NULL pointer before logging system messages.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32646
diff changeset
2068 }
31874
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2069 else
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2070 purple_debug_warning("gg", "GG_EVENT_MSG: message from user %u "
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2071 "unexpected while connecting:\n%s\n",
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2072 ev->event.msg.sender,
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2073 ev->event.msg.message);
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2074 break;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2075 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2076 purple_debug_error("gg", "strange event: %d\n", ev->type);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2077 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2078 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2079
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2080 gg_free_event(ev);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2081 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2082
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2083 /* ---------------------------------------------------------------------- */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2084 /* ----- PurplePluginProtocolInfo ----------------------------------------- */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2085 /* ---------------------------------------------------------------------- */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2086
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2087 static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2088 {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2089 return "gadu-gadu";
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2090 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2091
32652
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2092 static const char *ggp_normalize(const PurpleAccount *account, const char *who)
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2093 {
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2094 static char normalized[21]; /* maximum unsigned long long int size */
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2095
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2096 uin_t uin = ggp_str_to_uin(who);
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2097 if (uin <= 0)
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2098 return NULL;
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2099
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2100 g_snprintf(normalized, sizeof(normalized), "%u", uin);
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2101
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2102 return normalized;
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2103 }
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2104
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2105 static char *ggp_status_text(PurpleBuddy *b)
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2106 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2107 PurpleStatus *status;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2108 const char *msg;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2109 char *text;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2110 char *tmp;
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2111
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2112 status = purple_presence_get_active_status(
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2113 purple_buddy_get_presence(b));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2114 msg = purple_status_get_attr_string(status, "message");
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2115
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2116 if (msg == NULL)
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2117 return NULL;
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2118
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2119 tmp = purple_markup_strip_html(msg);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2120 text = g_markup_escape_text(tmp, -1);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2121 g_free(tmp);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2122
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2123 return text;
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2124 }
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2125
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2126 static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2127 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2128 PurpleStatus *status;
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
2129 char *tmp;
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2130 const char *msg, *name, *alias;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2131
15005
4b4af389b71c [gaim-migrate @ 17715]
Bartosz Oler <bartosz@pidgin.im>
parents: 14754
diff changeset
2132 g_return_if_fail(b != NULL);
4b4af389b71c [gaim-migrate @ 17715]
Bartosz Oler <bartosz@pidgin.im>
parents: 14754
diff changeset
2133
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2134 status = purple_presence_get_active_status(purple_buddy_get_presence(b));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2135 msg = purple_status_get_attr_string(status, "message");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2136 name = purple_status_get_name(status);
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2137 alias = purple_buddy_get_alias(b);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2138
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
2139 purple_notify_user_info_add_pair_plaintext(user_info, _("Alias"), alias);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2140
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2141 if (msg != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2142 if (PURPLE_BUDDY_IS_ONLINE(b)) {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
2143 tmp = g_strdup_printf("%s: %s", name, msg);
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
2144 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), tmp);
15205
f642029b2f97 [gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents: 15196
diff changeset
2145 g_free(tmp);
15196
1663f0333c05 [gaim-migrate @ 17920]
Bartosz Oler <bartosz@pidgin.im>
parents: 15185
diff changeset
2146 } else {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
2147 purple_notify_user_info_add_pair_plaintext(user_info, _("Message"), msg);
15196
1663f0333c05 [gaim-migrate @ 17920]
Bartosz Oler <bartosz@pidgin.im>
parents: 15185
diff changeset
2148 }
15227
a3327ea6d1b7 [gaim-migrate @ 17951]
Bartosz Oler <bartosz@pidgin.im>
parents: 15205
diff changeset
2149 /* We don't want to duplicate 'Status: Offline'. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2150 } else if (PURPLE_BUDDY_IS_ONLINE(b)) {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
2151 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), name);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2152 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2153 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2154
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2155 static GList *ggp_status_types(PurpleAccount *account)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2156 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2157 PurpleStatusType *type;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2158 GList *types = NULL;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2159
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2160 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2161 NULL, NULL, TRUE, TRUE, FALSE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2162 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2163 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2164 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2165
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2166 /*
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2167 * New status for GG 8.0: PoGGadaj ze mna (chatty).
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2168 * NOTE: at this time, this is used only to set our own status.
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2169 */
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2170 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2171 "freeforchat", _("Chatty"), TRUE, TRUE, FALSE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2172 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2173 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2174 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2175
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2176 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2177 NULL, NULL, TRUE, TRUE, FALSE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2178 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2179 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2180 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2181
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
2182 /*
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2183 * New status for GG 8.0: Nie przeszkadzac (do not disturb).
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2184 */
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2185 type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2186 NULL, NULL, TRUE, TRUE, FALSE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2187 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2188 NULL);
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2189 types = g_list_append(types, type);
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2190
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2191 /*
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2192 * It's used on buddy list if and only if it's showing our own
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2193 * (invisible) status.
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2194 */
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2195 type = purple_status_type_new_with_attrs(PURPLE_STATUS_INVISIBLE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2196 NULL, NULL, TRUE, TRUE, FALSE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2197 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2198 NULL);
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2199 types = g_list_append(types, type);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
2200
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2201 /*
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2202 * This status is necessary to display guys who are blocking *us*.
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2203 */
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2204 type = purple_status_type_new_with_attrs(PURPLE_STATUS_INVISIBLE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2205 "blocked", _("Blocked"), TRUE, FALSE, FALSE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2206 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2207 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2208 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2209
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2210 type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2211 NULL, NULL, TRUE, TRUE, FALSE,
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2212 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2213 NULL);
12658
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12645
diff changeset
2214 types = g_list_append(types, type);
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12645
diff changeset
2215
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2216 return types;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2217 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2218
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2219 static GList *ggp_blist_node_menu(PurpleBlistNode *node)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2220 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2221 PurpleMenuAction *act;
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2222 GList *m = NULL;
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2223 PurpleAccount *account;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2224 PurpleConnection *gc;
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2225 GGPInfo *info;
4333
f4c095774bc2 [gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents: 4229
diff changeset
2226
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2227 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2228 return NULL;
4333
f4c095774bc2 [gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents: 4229
diff changeset
2229
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2230 account = purple_buddy_get_account((PurpleBuddy *) node);
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2231 gc = purple_account_get_connection(account);
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2232 info = purple_connection_get_protocol_data(gc);
25430
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2233 if (info->chats) {
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2234 act = purple_menu_action_new(_("Add to chat"),
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2235 PURPLE_CALLBACK(ggp_bmenu_add_to_chat),
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2236 NULL, NULL);
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2237 m = g_list_append(m, act);
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
2238 }
11410
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
2239
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2240 return m;
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2241 }
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2242
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2243 static GList *ggp_chat_info(PurpleConnection *gc)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2244 {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2245 GList *m = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2246 struct proto_chat_entry *pce;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2247
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2248 pce = g_new0(struct proto_chat_entry, 1);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2249 pce->label = _("Chat _name:");
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2250 pce->identifier = "name";
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2251 pce->required = TRUE;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2252 m = g_list_append(m, pce);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2253
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2254 return m;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2255 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2256
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2257 static void ggp_login(PurpleAccount *account)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2258 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2259 PurpleConnection *gc;
23382
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2260 PurplePresence *presence;
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2261 PurpleStatus *status;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2262 struct gg_login_params *glp;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2263 GGPInfo *info;
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2264 const char *address;
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2265 const gchar *encryption_type;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2266
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2267 if (ggp_setup_proxy(account) == -1)
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2268 return;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2269
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2270 gc = purple_account_get_connection(account);
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2271 glp = g_new0(struct gg_login_params, 1);
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2272 info = g_new0(GGPInfo, 1);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2273
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2274 /* Probably this should be moved to *_new() function. */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2275 info->session = NULL;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2276 info->chats = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2277 info->chats_count = 0;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2278 info->token = NULL;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2279 info->searches = ggp_search_new();
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2280 info->pending_richtext_messages = NULL;
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2281 info->pending_images = g_hash_table_new(g_direct_hash, g_direct_equal);
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2282 info->status_broadcasting = purple_account_get_bool(account, "status_broadcasting", TRUE);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2283
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2284 purple_connection_set_protocol_data(gc, info);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2285
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2286 glp->uin = ggp_get_uin(account);
34023
6bc30809f7fe propagate from branch 'im.pidgin.pidgin' (head e275f5e7b257ee56363a918879d8af746c519d8d)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34022 32685
diff changeset
2287 glp->password = charset_convert(purple_connection_get_password(gc),
32648
198d9a91c334 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32647
diff changeset
2288 "UTF-8", "CP1250");
32646
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2289
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2290 if (glp->uin == 0) {
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2291 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2292 PURPLE_CONNECTION_ERROR_INVALID_USERNAME,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2293 _("The username specified is invalid."));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2294 g_free(glp);
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2295 return;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2296 }
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2297
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2298 glp->image_size = 255;
32651
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
2299 glp->status_flags = GG_STATUS_FLAG_UNKNOWN;
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
2300
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
2301 if (purple_account_get_bool(account, "show_links_from_strangers", 1))
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
2302 glp->status_flags |= GG_STATUS_FLAG_SPAM;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2303
23382
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2304 presence = purple_account_get_presence(account);
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2305 status = purple_presence_get_active_status(presence);
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2306
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2307 glp->encoding = GG_ENCODING_UTF8;
31630
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
2308 glp->protocol_features = (GG_FEATURE_STATUS80|GG_FEATURE_DND_FFC
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
2309 |GG_FEATURE_TYPING_NOTIFICATION);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
2310
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2311 glp->async = 1;
23382
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2312 glp->status = ggp_to_gg_status(status, &glp->status_descr);
34023
6bc30809f7fe propagate from branch 'im.pidgin.pidgin' (head e275f5e7b257ee56363a918879d8af746c519d8d)
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34022 32685
diff changeset
2313
32643
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2314 encryption_type = purple_account_get_string(account, "encryption",
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2315 "opportunistic_tls");
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2316 purple_debug_info("gg", "Requested encryption type: %s\n",
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2317 encryption_type);
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2318 if (strcmp(encryption_type, "opportunistic_tls") == 0)
32643
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2319 glp->tls = GG_SSL_ENABLED;
32646
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2320 else if (strcmp(encryption_type, "require_tls") == 0) {
32643
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2321 if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL))
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2322 glp->tls = GG_SSL_REQUIRED;
32646
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2323 else {
32643
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2324 purple_connection_error(gc,
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2325 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2326 _("SSL support unavailable"));
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2327 g_free(glp);
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2328 return;
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2329 }
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2330 }
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2331 else /* encryption_type == "none" */
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2332 glp->tls = GG_SSL_DISABLED;
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2333 purple_debug_info("gg", "TLS mode: %d\n", glp->tls);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2334
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2335 if (!info->status_broadcasting)
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2336 glp->status = glp->status|GG_STATUS_FRIENDS_MASK;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2337
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2338 address = purple_account_get_string(account, "gg_server", "");
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2339 if (address && *address) {
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
2340 /* TODO: Make this non-blocking */
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2341 struct in_addr *addr = gg_gethostbyname(address);
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2342
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2343 purple_debug_info("gg", "Using gg server given by user (%s)\n", address);
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2344
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2345 if (addr == NULL) {
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
2346 gchar *tmp = g_strdup_printf(_("Unable to resolve hostname '%s': %s"),
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
2347 address, g_strerror(errno));
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
2348 purple_connection_error(gc,
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2349 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
2350 tmp);
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
2351 g_free(tmp);
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2352 return;
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2353 }
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2354
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2355 glp->server_addr = inet_addr(inet_ntoa(*addr));
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2356 glp->server_port = 8074;
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2357 } else
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2358 purple_debug_info("gg", "Trying to retrieve address from gg appmsg service\n");
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2359
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2360 info->session = gg_login(glp);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
2361 purple_connection_update_progress(gc, _("Connecting"), 0, 2);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2362 if (info->session == NULL) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
2363 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
2364 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
2365 _("Connection failed"));
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2366 g_free(glp);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2367 return;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2368 }
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2369 info->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2370 ggp_async_login_handler, gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2371 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2372
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2373 static void ggp_close(PurpleConnection *gc)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2374 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2375 PurpleAccount *account;
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2376 GGPInfo *info;;
8997
a30b6b11674a [gaim-migrate @ 9772]
Luke Schierer <lschiere@pidgin.im>
parents: 8996
diff changeset
2377
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2378 if (gc == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2379 purple_debug_info("gg", "gc == NULL\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2380 return;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2381 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2382
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2383 account = purple_connection_get_account(gc);
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2384 info = purple_connection_get_protocol_data(gc);
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2385
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2386 if (info) {
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2387 PurpleStatus *status = purple_account_get_active_status(account);
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2388
11538
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2389 if (info->session != NULL) {
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2390 ggp_set_status(account, status);
11538
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2391 gg_logoff(info->session);
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2392 gg_free_session(info->session);
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2393 }
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2394
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2395 purple_account_set_bool(account, "status_broadcasting", info->status_broadcasting);
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2396
14060
e1a87aabd80c [gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents: 13645
diff changeset
2397 /* Immediately close any notifications on this handle since that process depends
e1a87aabd80c [gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents: 13645
diff changeset
2398 * upon the contents of info->searches, which we are about to destroy.
e1a87aabd80c [gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents: 13645
diff changeset
2399 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2400 purple_notify_close_with_handle(gc);
14060
e1a87aabd80c [gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents: 13645
diff changeset
2401
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2402 ggp_search_destroy(info->searches);
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2403 g_list_free(info->pending_richtext_messages);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2404 g_hash_table_destroy(info->pending_images);
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2405
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2406 if (info->inpa > 0)
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2407 purple_input_remove(info->inpa);
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2408
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2409 purple_connection_set_protocol_data(gc, NULL);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
2410 g_free(info);
11538
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2411 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2412
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2413 purple_debug_info("gg", "Connection closed.\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2414 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2415
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2416 static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2417 PurpleMessageFlags flags)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2418 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2419 GGPInfo *info = purple_connection_get_protocol_data(gc);
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2420 char *tmp, *plain;
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2421 int ret = 1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2422 unsigned char format[1024];
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2423 unsigned int format_length = sizeof(struct gg_msg_richtext);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2424 gint pos = 0;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2425 GData *attribs;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2426 const char *start, *end = NULL, *last;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2427
24747
498c6dda6e48 Fix two warnings introduced by the image patch I committed earlier and make
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24746
diff changeset
2428 if (msg == NULL || *msg == '\0') {
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2429 return 0;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2430 }
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2431
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2432 last = msg;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2433
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2434 /* Check if the message is richtext */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2435 /* TODO: Check formatting, too */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2436 if(purple_markup_find_tag("img", last, &start, &end, &attribs)) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2437
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2438 GString *string_buffer = g_string_new(NULL);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2439 struct gg_msg_richtext fmt;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2440
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2441 do {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2442 PurpleStoredImage *image;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2443 const char *id;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2444
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2445 /* Add text before the image */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2446 if(start - last) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2447 pos = pos + g_utf8_strlen(last, start - last);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2448 g_string_append_len(string_buffer, last, start - last);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2449 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2450
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2451 if((id = g_datalist_get_data(&attribs, "id")) && (image = purple_imgstore_find_by_id(atoi(id)))) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2452 struct gg_msg_richtext_format actformat;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2453 struct gg_msg_richtext_image actimage;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2454 gint image_size = purple_imgstore_get_size(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2455 gconstpointer image_bin = purple_imgstore_get_data(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2456 const char *image_filename = purple_imgstore_get_filename(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2457 uint32_t crc32 = gg_crc32(0, image_bin, image_size);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2458
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2459 g_hash_table_insert(info->pending_images, GINT_TO_POINTER(crc32), GINT_TO_POINTER(atoi(id)));
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2460 purple_imgstore_ref(image);
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2461 purple_debug_info("gg", "ggp_send_im_richtext: got crc: %u for imgid: %i\n", crc32, atoi(id));
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2462
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2463 actformat.font = GG_FONT_IMAGE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2464 actformat.position = pos;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2465
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2466 actimage.unknown1 = 0x0109;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2467 actimage.size = gg_fix32(image_size);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2468 actimage.crc32 = gg_fix32(crc32);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2469
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2470 if (actimage.size > 255000) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2471 purple_debug_warning("gg", "ggp_send_im_richtext: image over 255kb!\n");
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2472 } else {
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2473 purple_debug_info("gg", "ggp_send_im_richtext: adding images to richtext, size: %i, crc32: %u, name: %s\n", actimage.size, actimage.crc32, image_filename);
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2474
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2475 memcpy(format + format_length, &actformat, sizeof(actformat));
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2476 format_length += sizeof(actformat);
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2477 memcpy(format + format_length, &actimage, sizeof(actimage));
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2478 format_length += sizeof(actimage);
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2479 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2480 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2481 purple_debug_error("gg", "ggp_send_im_richtext: image not found in the image store!");
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2482 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2483
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2484 last = end + 1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2485 g_datalist_clear(&attribs);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2486
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2487 } while(purple_markup_find_tag("img", last, &start, &end, &attribs));
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2488
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2489 /* Add text after the images */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2490 if(last && *last) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2491 pos = pos + g_utf8_strlen(last, -1);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2492 g_string_append(string_buffer, last);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2493 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2494
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2495 fmt.flag = 2;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2496 fmt.length = format_length - sizeof(fmt);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2497 memcpy(format, &fmt, sizeof(fmt));
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2498
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2499 purple_debug_info("gg", "ggp_send_im: richtext msg = %s\n", string_buffer->str);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2500 plain = purple_unescape_html(string_buffer->str);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2501 g_string_free(string_buffer, TRUE);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2502 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2503 purple_debug_info("gg", "ggp_send_im: msg = %s\n", msg);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2504 plain = purple_unescape_html(msg);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2505 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2506
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2507 /*
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2508 tmp = charset_convert(plain, "UTF-8", "CP1250");
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2509 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2510 tmp = g_strdup_printf("%s", plain);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
2511
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2512 if (tmp && (format_length - sizeof(struct gg_msg_richtext))) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2513 if(gg_send_message_richtext(info->session, GG_CLASS_CHAT, ggp_str_to_uin(who), (unsigned char *)tmp, format, format_length) < 0) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2514 ret = -1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2515 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2516 ret = 1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2517 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2518 } else if (NULL == tmp || *tmp == 0) {
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2519 ret = 0;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2520 } else if (strlen(tmp) > GG_MSG_MAXSIZE) {
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2521 ret = -E2BIG;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2522 } else if (gg_send_message(info->session, GG_CLASS_CHAT,
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2523 ggp_str_to_uin(who), (unsigned char *)tmp) < 0) {
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2524 ret = -1;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2525 } else {
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2526 ret = 1;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2527 }
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2528
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2529 g_free(plain);
11565
098117df202f [gaim-migrate @ 13831]
Bartosz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
2530 g_free(tmp);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2531
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2532 return ret;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2533 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2534
31648
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2535 static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state)
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2536 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2537 GGPInfo *info = purple_connection_get_protocol_data(gc);
31648
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2538 int dummy_length; // we don't send real length of typed message
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2539
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2540 if (state == PURPLE_TYPED) // not supported
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2541 return 1;
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2542
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2543 if (state == PURPLE_TYPING)
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2544 dummy_length = (int)g_random_int();
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2545 else // PURPLE_NOT_TYPING
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2546 dummy_length = 0;
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2547
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2548 gg_typing_notification(
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2549 info->session,
31648
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2550 ggp_str_to_uin(name),
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2551 dummy_length);
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2552
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2553 return 1; // wait 1 second before another notification
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2554 }
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2555
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2556 static void ggp_get_info(PurpleConnection *gc, const char *name)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2557 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2558 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2559 GGPSearchForm *form;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2560 guint32 seq;
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2561
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2562 form = ggp_search_form_new(GGP_SEARCH_TYPE_INFO);
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
2563
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2564 form->user_data = info;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2565 form->uin = g_strdup(name);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2566
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2567 seq = ggp_search_start(gc, form);
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2568 ggp_search_add(info->searches, seq, form);
23584
886e1611b952 Gadu-Gadu Get Info isn't behaving properly. Added debug logging to its traking
Evan Schoenberg <evands@pidgin.im>
parents: 23382
diff changeset
2569 purple_debug_info("gg", "ggp_get_info(): Added seq %u", seq);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2570 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2571
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2572 static int ggp_to_gg_status(PurpleStatus *status, char **msg)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2573 {
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2574 const char *status_id = purple_status_get_id(status);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2575 int new_status, new_status_descr;
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2576 const char *new_msg;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2577
24043
47da129e16d1 Fixed an inverted g_return_val_if_fail() which caused gadu-gadu to always set an available status with no status message
Evan Schoenberg <evands@pidgin.im>
parents: 23584
diff changeset
2578 g_return_val_if_fail(msg != NULL, 0);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2579
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2580 purple_debug_info("gg", "ggp_to_gg_status: Requested status = %s\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2581 status_id);
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2582
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2583 if (strcmp(status_id, "available") == 0) {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2584 new_status = GG_STATUS_AVAIL;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2585 new_status_descr = GG_STATUS_AVAIL_DESCR;
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2586 } else if (strcmp(status_id, "freeforchat") == 0) {
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2587 new_status = GG_STATUS_FFC;
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2588 new_status_descr = GG_STATUS_FFC_DESCR;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2589 } else if (strcmp(status_id, "away") == 0) {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2590 new_status = GG_STATUS_BUSY;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2591 new_status_descr = GG_STATUS_BUSY_DESCR;
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2592 } else if (strcmp(status_id, "unavailable") == 0) {
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2593 new_status = GG_STATUS_DND;
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2594 new_status_descr = GG_STATUS_DND_DESCR;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2595 } else if (strcmp(status_id, "invisible") == 0) {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2596 new_status = GG_STATUS_INVISIBLE;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2597 new_status_descr = GG_STATUS_INVISIBLE_DESCR;
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2598 } else if (strcmp(status_id, "offline") == 0) {
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2599 new_status = GG_STATUS_NOT_AVAIL;
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2600 new_status_descr = GG_STATUS_NOT_AVAIL_DESCR;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2601 } else {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2602 new_status = GG_STATUS_AVAIL;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2603 new_status_descr = GG_STATUS_AVAIL_DESCR;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2604 purple_debug_info("gg",
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2605 "ggp_set_status: unknown status requested (status_id=%s)\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2606 status_id);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2607 }
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4793
diff changeset
2608
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2609 new_msg = purple_status_get_attr_string(status, "message");
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2610
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2611 if(new_msg) {
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2612 /*
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2613 char *tmp = purple_markup_strip_html(new_msg);
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2614 *msg = charset_convert(tmp, "UTF-8", "CP1250");
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2615 g_free(tmp);
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2616 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2617 *msg = purple_markup_strip_html(new_msg);
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2618
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2619 return new_status_descr;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2620 } else {
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2621 *msg = NULL;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2622 return new_status;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2623 }
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2624 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2625
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2626 static void ggp_set_status(PurpleAccount *account, PurpleStatus *status)
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2627 {
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2628 PurpleConnection *gc;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2629 GGPInfo *info;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2630 int new_status;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2631 char *new_msg = NULL;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2632
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2633 if (!purple_status_is_active(status))
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2634 return;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2635
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2636 gc = purple_account_get_connection(account);
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2637 info = purple_connection_get_protocol_data(gc);
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2638
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2639 new_status = ggp_to_gg_status(status, &new_msg);
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2640
31550
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2641 if (!info->status_broadcasting)
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2642 new_status = new_status|GG_STATUS_FRIENDS_MASK;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
2643
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2644 if (new_msg == NULL) {
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2645 gg_change_status(info->session, new_status);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2646 } else {
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2647 gg_change_status_descr(info->session, new_status, new_msg);
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2648 g_free(new_msg);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2649 }
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2650
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2651 ggp_status_fake_to_self(account);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2652
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2653 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2654
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32261
diff changeset
2655 static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2656 {
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2657 PurpleAccount *account;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2658 GGPInfo *info = purple_connection_get_protocol_data(gc);
24939
d25fdf62ae92 moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24043
diff changeset
2659 const gchar *name = purple_buddy_get_name(buddy);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2660
24939
d25fdf62ae92 moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24043
diff changeset
2661 gg_add_notify(info->session, ggp_str_to_uin(name));
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2662
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2663 account = purple_connection_get_account(gc);
24939
d25fdf62ae92 moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24043
diff changeset
2664 if (strcmp(purple_account_get_username(account), name) == 0) {
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2665 ggp_status_fake_to_self(account);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2666 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2667 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2668
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2669 static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2670 PurpleGroup *group)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2671 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2672 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2673
24939
d25fdf62ae92 moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24043
diff changeset
2674 gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy)));
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2675 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2676
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2677 static void ggp_join_chat(PurpleConnection *gc, GHashTable *data)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2678 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2679 GGPInfo *info = purple_connection_get_protocol_data(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2680 GGPChat *chat;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2681 char *chat_name;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2682 GList *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2683 PurpleConversation *conv;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2684 PurpleAccount *account = purple_connection_get_account(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2685
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2686 chat_name = g_hash_table_lookup(data, "name");
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2687
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2688 if (chat_name == NULL)
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2689 return;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2690
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2691 purple_debug_info("gg", "joined %s chat\n", chat_name);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2692
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2693 for (l = info->chats; l != NULL; l = l->next) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2694 chat = l->data;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2695
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2696 if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2697 purple_notify_error(gc, _("Chat error"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2698 _("This chat name is already in use"), NULL);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2699 return;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2700 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2701 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2702
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2703 ggp_confer_add_new(gc, chat_name);
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2704 conv = serv_got_joined_chat(gc, info->chats_count, chat_name);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2705 purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2706 purple_account_get_username(account), NULL,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2707 PURPLE_CBFLAGS_NONE, TRUE);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2708 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2709
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2710 static char *ggp_get_chat_name(GHashTable *data) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2711 return g_strdup(g_hash_table_lookup(data, "name"));
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2712 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2713
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2714 static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2715 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2716 PurpleConversation *conv;
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2717 GGPInfo *info = purple_connection_get_protocol_data(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2718 GGPChat *chat = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2719 GList *l;
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2720 /* char *msg, *plain; */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2721 gchar *msg;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2722 uin_t *uins;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2723 int count = 0;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2724
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2725 if ((conv = purple_find_chat(gc, id)) == NULL)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2726 return -EINVAL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2727
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2728 for (l = info->chats; l != NULL; l = l->next) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2729 chat = l->data;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2730
32617
c74b4bd27e37 Use purple_conversation accessor methods.
Andrew Victor <andrew.victor@mxit.com>
parents: 32596
diff changeset
2731 if (g_utf8_collate(chat->name, purple_conversation_get_name(conv)) == 0) {
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2732 break;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2733 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2734
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2735 chat = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2736 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2737
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2738 if (chat == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2739 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2740 "ggp_chat_send: Hm... that's strange. No such chat?\n");
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2741 return -EINVAL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2742 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2743
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2744 uins = g_new0(uin_t, g_list_length(chat->participants));
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2745
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2746 for (l = chat->participants; l != NULL; l = l->next) {
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2747 uin_t uin = GPOINTER_TO_INT(l->data);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2748
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2749 uins[count++] = uin;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2750 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2751
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2752 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2753 plain = purple_unescape_html(message);
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2754 msg = charset_convert(plain, "UTF-8", "CP1250");
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2755 g_free(plain);
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2756 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2757 msg = purple_unescape_html(message);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2758 gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins,
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2759 (unsigned char *)msg);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2760 g_free(msg);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2761 g_free(uins);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2762
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2763 serv_got_chat_in(gc, id,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2764 purple_account_get_username(purple_connection_get_account(gc)),
23295
5d3a2fd59439 When calling serv_got_chat_in() after sending a group chat message (to let
Evan Schoenberg <evands@pidgin.im>
parents: 23277
diff changeset
2765 flags, message, time(NULL));
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2766
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2767 return 0;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2768 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2769
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2770 static void ggp_keepalive(PurpleConnection *gc)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2771 {
32261
bd956558346e Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
2772 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2773
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2774 /* purple_debug_info("gg", "Keeping connection alive....\n"); */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2775
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2776 if (gg_ping(info->session) < 0) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2777 purple_debug_info("gg", "Not connected to the server "
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2778 "or gg_session is not correct\n");
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
2779 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
2780 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27626
62fbae50be08 Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents: 27388
diff changeset
2781 _("Not connected to the server"));
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4793
diff changeset
2782 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2783 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2784
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2785 static void ggp_register_user(PurpleAccount *account)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2786 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2787 PurpleConnection *gc = purple_account_get_connection(account);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2788
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2789 ggp_token_request(gc, ggp_register_user_dialog);
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2790 }
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2791
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2792 static GList *ggp_actions(PurplePlugin *plugin, gpointer context)
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2793 {
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2794 GList *m = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2795 PurplePluginAction *act;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2796
32650
4a755a62aa46 Gadu-Gadu: reorder actions to clean up the mess in gg account menu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32649
diff changeset
2797 act = purple_plugin_action_new(_("Change password..."),
4a755a62aa46 Gadu-Gadu: reorder actions to clean up the mess in gg account menu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32649
diff changeset
2798 ggp_change_passwd);
4a755a62aa46 Gadu-Gadu: reorder actions to clean up the mess in gg account menu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32649
diff changeset
2799 m = g_list_append(m, act);
4a755a62aa46 Gadu-Gadu: reorder actions to clean up the mess in gg account menu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32649
diff changeset
2800
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2801 act = purple_plugin_action_new(_("Find buddies..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2802 ggp_find_buddies);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2803 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2804
32650
4a755a62aa46 Gadu-Gadu: reorder actions to clean up the mess in gg account menu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32649
diff changeset
2805 act = purple_plugin_action_new(_("Change status broadcasting"),
4a755a62aa46 Gadu-Gadu: reorder actions to clean up the mess in gg account menu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32649
diff changeset
2806 ggp_action_change_status_broadcasting);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2807 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2808
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2809 m = g_list_append(m, NULL);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2810
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2811 act = purple_plugin_action_new(_("Upload buddylist to Server"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2812 ggp_action_buddylist_put);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2813 m = g_list_append(m, act);
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2814
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2815 act = purple_plugin_action_new(_("Download buddylist from Server"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2816 ggp_action_buddylist_get);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2817 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2818
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2819 act = purple_plugin_action_new(_("Delete buddylist from Server"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2820 ggp_action_buddylist_delete);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2821 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2822
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2823 act = purple_plugin_action_new(_("Save buddylist to file..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2824 ggp_action_buddylist_save);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2825 m = g_list_append(m, act);
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2826
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2827 act = purple_plugin_action_new(_("Load buddylist from file..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2828 ggp_action_buddylist_load);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2829 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2830
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2831 return m;
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2832 }
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2833
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2834 static gboolean ggp_offline_message(const PurpleBuddy *buddy)
13298
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2835 {
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2836 return TRUE;
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2837 }
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2838
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2839 static PurplePluginProtocolInfo prpl_info =
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2840 {
32316
21dab55b4699 Move struct_size to the beginning of the struct. Even if we don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32315
diff changeset
2841 sizeof(PurplePluginProtocolInfo), /* struct_size */
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2842 OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2843 NULL, /* user_splits */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2844 NULL, /* protocol_options */
22546
3f7e366741a3 Patch from Tomasz Salacinski to allow setting buddy icons in GG prpl.
Bartosz Oler <bartosz@pidgin.im>
parents: 22277
diff changeset
2845 {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2846 ggp_list_icon, /* list_icon */
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2847 NULL, /* list_emblem */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2848 ggp_status_text, /* status_text */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2849 ggp_tooltip_text, /* tooltip_text */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2850 ggp_status_types, /* status_types */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2851 ggp_blist_node_menu, /* blist_node_menu */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2852 ggp_chat_info, /* chat_info */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2853 NULL, /* chat_info_defaults */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2854 ggp_login, /* login */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2855 ggp_close, /* close */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2856 ggp_send_im, /* send_im */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2857 NULL, /* set_info */
31648
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2858 ggp_send_typing, /* send_typing */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2859 ggp_get_info, /* get_info */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2860 ggp_set_status, /* set_away */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2861 NULL, /* set_idle */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2862 NULL, /* change_passwd */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2863 ggp_add_buddy, /* add_buddy */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2864 NULL, /* add_buddies */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2865 ggp_remove_buddy, /* remove_buddy */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2866 NULL, /* remove_buddies */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2867 NULL, /* add_permit */
31938
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
2868 ggp_add_deny, /* add_deny */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2869 NULL, /* rem_permit */
31938
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
2870 ggp_rem_deny, /* rem_deny */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2871 NULL, /* set_permit_deny */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2872 ggp_join_chat, /* join_chat */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2873 NULL, /* reject_chat */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2874 ggp_get_chat_name, /* get_chat_name */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2875 NULL, /* chat_invite */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2876 NULL, /* chat_leave */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2877 NULL, /* chat_whisper */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2878 ggp_chat_send, /* chat_send */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2879 ggp_keepalive, /* keepalive */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2880 ggp_register_user, /* register_user */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2881 NULL, /* get_cb_info */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2882 NULL, /* alias_buddy */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2883 NULL, /* group_buddy */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2884 NULL, /* rename_group */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2885 NULL, /* buddy_free */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2886 NULL, /* convo_closed */
32652
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2887 ggp_normalize, /* normalize */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2888 NULL, /* set_buddy_icon */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2889 NULL, /* remove_group */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2890 NULL, /* get_cb_real_name */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2891 NULL, /* set_chat_topic */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2892 NULL, /* find_blist_chat */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2893 NULL, /* roomlist_get_list */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2894 NULL, /* roomlist_cancel */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2895 NULL, /* roomlist_expand_category */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2896 NULL, /* can_receive_file */
12143
09f216663302 [gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents: 12007
diff changeset
2897 NULL, /* send_file */
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12595
diff changeset
2898 NULL, /* new_xfer */
13298
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2899 ggp_offline_message, /* offline_message */
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12595
diff changeset
2900 NULL, /* whiteboard_prpl_ops */
14604
67a7c42a8654 [gaim-migrate @ 17263]
Sean Egan <seanegan@pidgin.im>
parents: 14524
diff changeset
2901 NULL, /* send_raw */
15185
74b689a74430 [gaim-migrate @ 17909]
Nathan Walp <nwalp@pidgin.im>
parents: 15005
diff changeset
2902 NULL, /* roomlist_room_serialize */
22071
4c47e360e467 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22069
diff changeset
2903 NULL, /* unregister_user */
4c47e360e467 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22069
diff changeset
2904 NULL, /* send_attention */
4c47e360e467 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22069
diff changeset
2905 NULL, /* get_attention_types */
23707
480f94157418 propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23325 22648
diff changeset
2906 NULL, /* get_account_text_table */
480f94157418 propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23325 22648
diff changeset
2907 NULL, /* initiate_media */
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29182
diff changeset
2908 NULL, /* can_do_media */
30138
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30134
diff changeset
2909 NULL, /* get_moods */
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 30134
diff changeset
2910 NULL, /* set_public_alias */
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32261
diff changeset
2911 NULL /* get_public_alias */
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2912 };
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2913
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2914 static PurplePluginInfo info = {
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2915 PURPLE_PLUGIN_MAGIC, /* magic */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2916 PURPLE_MAJOR_VERSION, /* major_version */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2917 PURPLE_MINOR_VERSION, /* minor_version */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2918 PURPLE_PLUGIN_PROTOCOL, /* plugin type */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2919 NULL, /* ui_requirement */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2920 0, /* flags */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2921 NULL, /* dependencies */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2922 PURPLE_PRIORITY_DEFAULT, /* priority */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2923
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2924 "prpl-gg", /* id */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2925 "Gadu-Gadu", /* name */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2926 DISPLAY_VERSION, /* version */
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2927
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2928 N_("Gadu-Gadu Protocol Plugin"), /* summary */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2929 N_("Polish popular IM"), /* description */
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2930 "boler@sourceforge.net", /* author */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2931 PURPLE_WEBSITE, /* homepage */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2932
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2933 NULL, /* load */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2934 NULL, /* unload */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2935 NULL, /* destroy */
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2936
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2937 NULL, /* ui_info */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2938 &prpl_info, /* extra_info */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2939 NULL, /* prefs_info */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2940 ggp_actions, /* actions */
16746
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2941
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2942 /* padding */
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2943 NULL,
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2944 NULL,
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2945 NULL,
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2946 NULL
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2947 };
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2948
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2949 static void purple_gg_debug_handler(int level, const char * format, va_list args) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2950 PurpleDebugLevel purple_level;
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2951 char *msg = g_strdup_vprintf(format, args);
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2952
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2953 /* This is pretty pointless since the GG_DEBUG levels don't correspond to
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2954 * the purple ones */
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2955 switch (level) {
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2956 case GG_DEBUG_FUNCTION:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2957 purple_level = PURPLE_DEBUG_INFO;
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2958 break;
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2959 case GG_DEBUG_MISC:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2960 case GG_DEBUG_NET:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2961 case GG_DEBUG_DUMP:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2962 case GG_DEBUG_TRAFFIC:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2963 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2964 purple_level = PURPLE_DEBUG_MISC;
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2965 break;
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2966 }
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2967
24683
3481a3320313 Backport the 'purple_debug_*(msg)' -> 'purple_debug_*("%s", msg);' fixes.
Richard Laager <rlaager@pidgin.im>
parents: 24569
diff changeset
2968 purple_debug(purple_level, "gg", "%s", msg);
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2969 g_free(msg);
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2970 }
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2971
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2972 static void init_plugin(PurplePlugin *plugin)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2973 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2974 PurpleAccountOption *option;
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2975 GList *encryption_options = NULL;
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2976
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2977 option = purple_account_option_string_new(_("GG server"),
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2978 "gg_server", "");
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2979 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2980 option);
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2981
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2982 #define ADD_VALUE(list, desc, v) { \
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2983 PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); \
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2984 kvp->key = g_strdup((desc)); \
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2985 kvp->value = g_strdup((v)); \
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2986 list = g_list_append(list, kvp); \
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2987 }
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2988
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2989 ADD_VALUE(encryption_options, _("Use encryption if available"),
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2990 "opportunistic_tls");
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2991 ADD_VALUE(encryption_options, _("Require encryption"), "require_tls");
32643
c7ba76b54779 Gadu-Gadu: possibility to require encryption; use encryption when available is default option now
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32617
diff changeset
2992 ADD_VALUE(encryption_options, _("Don't use encryption"), "none");
31685
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2993
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2994 option = purple_account_option_list_new(_("Connection security"),
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2995 "encryption", encryption_options);
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2996 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2997 option);
166a2f589d32 gg: Allow the user to choose whether to use SSL/TLS support. Fixes #13894.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31665
diff changeset
2998
32651
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
2999 option = purple_account_option_bool_new(_("Show links from strangers"),
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
3000 "show_links_from_strangers", 1);
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
3001 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
3002 option);
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
3003
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3004 my_protocol = plugin;
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
3005
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
3006 gg_debug_handler = purple_gg_debug_handler;
32674
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
3007
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
3008 #ifdef _WIN32
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
3009 gg_global_set_custom_resolver(ggp_resolver_win32thread_start,
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
3010 ggp_resolver_win32thread_cleanup);
2de7f0cebb8b Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32653
diff changeset
3011 #endif
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3012 }
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3013
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
3014 PURPLE_INIT_PLUGIN(gg, init_plugin, info);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
3015
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
3016 /* vim: set ts=8 sts=0 sw=8 noet: */

mercurial