libpurple/protocols/gg/gg.c

Mon, 25 Jun 2012 00:45:39 +0200

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Mon, 25 Jun 2012 00:45:39 +0200
branch
soc.2012.gg
changeset 33296
33a9adb52028
parent 33295
c995c45e8ed9
child 33298
519acf37d16e
permissions
-rw-r--r--

Enable receiving of user_data packets

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"
33291
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33287
diff changeset
47 #include "resolver-purple.h"
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
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
49 /* 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
50 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
51 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
52
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
53 /* ---------------------------------------------------------------------- */
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
54 /* ----- EXTERNAL CALLBACKS --------------------------------------------- */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
55 /* ---------------------------------------------------------------------- */
9950
ac8bc7606554 [gaim-migrate @ 10846]
Tim Ringenbach <marv@pidgin.im>
parents: 9944
diff changeset
56
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
57
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
58 /* ----- HELPERS -------------------------------------------------------- */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
59
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
60 /**
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
61 * Set up libgadu's proxy.
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
62 *
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
63 * @param account Account for which to set up the proxy.
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
64 *
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
65 * @return Zero if proxy setup is valid, otherwise -1.
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
66 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
67 static int ggp_setup_proxy(PurpleAccount *account)
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
68 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
69 PurpleProxyInfo *gpi;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
70
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
71 gpi = purple_proxy_get_setup(account);
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
72
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
73 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
74 (purple_proxy_info_get_host(gpi) == NULL ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
75 purple_proxy_info_get_port(gpi) <= 0)) {
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
76
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
77 gg_proxy_enabled = 0;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
78 purple_notify_error(NULL, NULL, _("Invalid proxy settings"),
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
79 _("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
80 return -1;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
81 } 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
82 gg_proxy_enabled = 1;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
83 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
84 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
85 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
86 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
87 } else {
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
88 gg_proxy_enabled = 0;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
89 }
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
90
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
91 return 0;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
92 }
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
93
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
94 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
95 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
96 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
97 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
98 GGPToken *token = info->token;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
99 GGPTokenCallback cb;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
100
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
101 struct gg_token *t = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
102
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
103 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
104 token->req->check, token->req->state);
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 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
107 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
108 purple_input_remove(token->inpa);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
109 gg_token_free(token->req);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
110 token->req = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
111
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
112 purple_notify_error(purple_connection_get_account(gc),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
113 _("Token Error"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
114 _("Unable to fetch the token.\n"), NULL);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
115 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
116 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
117
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
118 if (token->req->state != GG_STATE_DONE) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
119 purple_input_remove(token->inpa);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
120 token->inpa = purple_input_add(token->req->fd,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
121 (token->req->check == 1)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
122 ? PURPLE_INPUT_WRITE
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
123 : PURPLE_INPUT_READ,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
124 ggp_async_token_handler, gc);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
125 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
126 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
127
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
128 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
129 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
130 purple_input_remove(token->inpa);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
131 gg_token_free(token->req);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
132 token->req = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
133
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
134 purple_notify_error(purple_connection_get_account(gc),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
135 _("Token Error"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
136 _("Unable to fetch the token.\n"), NULL);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
137 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
138 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
139
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
140 purple_input_remove(token->inpa);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
141
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
142 token->id = g_strdup(t->tokenid);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
143 token->size = token->req->body_size;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
144 token->data = g_new0(char, token->size);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
145 memcpy(token->data, token->req->body, token->size);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
146
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
147 purple_debug_info("gg", "TOKEN! tokenid = %s; size = %d\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
148 token->id, token->size);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
149
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
150 gg_token_free(token->req);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
151 token->req = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
152 token->inpa = 0;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
153
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
154 cb = token->cb;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
155 token->cb = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
156 cb(gc);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
157 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
158
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
159 static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
160 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
161 PurpleAccount *account;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
162 struct gg_http *req;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
163 GGPInfo *info;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
164
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
165 account = purple_connection_get_account(gc);
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
166
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
167 if (ggp_setup_proxy(account) == -1)
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
168 return;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
169
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
170 info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
171
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
172 if ((req = gg_token(1)) == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
173 purple_notify_error(account,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
174 _("Token Error"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
175 _("Unable to fetch the token.\n"), NULL);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
176 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
177 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
178
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
179 info->token = g_new(GGPToken, 1);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
180 info->token->cb = cb;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
181
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
182 info->token->req = req;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
183 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
184 ggp_async_token_handler, gc);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
185 }
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
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
188 /* ---------------------------------------------------------------------- */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
189
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
190 /**
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
191 * Request buddylist from the server.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
192 * Buddylist is received in the ggp_callback_recv().
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
193 *
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
194 * @param Current action handler.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
195 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
196 static void ggp_action_buddylist_get(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
197 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
198 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
199 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
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 purple_debug_info("gg", "Downloading...\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
202
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
203 gg_userlist_request(info->session, GG_USERLIST_GET, NULL);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
204 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
205
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
206 /**
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
207 * Upload the buddylist to the server.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
208 *
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
209 * @param action Current action handler.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
210 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
211 static void ggp_action_buddylist_put(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
212 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
213 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
214 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
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 char *buddylist = ggp_buddylist_dump(purple_connection_get_account(gc));
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 purple_debug_info("gg", "Uploading...\n");
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
219
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
220 if (buddylist == NULL)
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
221 return;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
222
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
223 gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
224 g_free(buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
225 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
226
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 * Delete buddylist from the server.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
229 *
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
230 * @param action Current action handler.
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
231 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
232 static void ggp_action_buddylist_delete(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
233 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
234 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
235 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
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 purple_debug_info("gg", "Deleting...\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
238
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
239 gg_userlist_request(info->session, GG_USERLIST_PUT, NULL);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
240 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
241
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
242 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
243 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
244 PurpleAccount *account = purple_connection_get_account(gc);
11360
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 char *buddylist = ggp_buddylist_dump(account);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
247
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
248 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
249 purple_debug_info("gg", "file = %s\n", filename);
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 if (buddylist == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
252 purple_notify_info(account, _("Save Buddylist..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
253 _("Your buddylist is empty, nothing was written to the file."),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
254 NULL);
2792
f40db99e87c7 [gaim-migrate @ 2805]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2791
diff changeset
255 return;
f40db99e87c7 [gaim-migrate @ 2805]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2791
diff changeset
256 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
257
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
258 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
259 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
260 _("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
261 } 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
262 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
263 _("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
264 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
265 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
266 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
267 g_free(primary);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
268 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
269
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
270 g_free(buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
271 }
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
272
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
273 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
274 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
275 PurpleAccount *account = purple_connection_get_account(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
276 GError *error = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
277 char *buddylist = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
278 gsize length;
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 purple_debug_info("gg", "file_name = %s\n", file);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
281
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
282 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
283 purple_notify_error(account,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
284 _("Couldn't load buddylist"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
285 _("Couldn't load buddylist"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
286 error->message);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
287
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
288 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
289 "Couldn't load buddylist. file = %s; error = %s\n",
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
290 file, error->message);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
291
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
292 g_error_free(error);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
293
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
294 return;
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
295 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
296
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
297 ggp_buddylist_load(gc, buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
298 g_free(buddylist);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
299
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
300 purple_notify_info(account,
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
301 _("Load Buddylist..."),
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
302 _("Buddylist loaded successfully!"), NULL);
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
303 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
304 /* }}} */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
305
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
306 /*
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
307 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
308 /* static void ggp_action_buddylist_save(PurplePluginAction *action) {{{ */
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
309 static void ggp_action_buddylist_save(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
310 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
311 PurpleConnection *gc = (PurpleConnection *)action->context;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
312
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
313 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
314 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
315 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
316 gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
317 }
2806
1576edefc75a [gaim-migrate @ 2819]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2792
diff changeset
318
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
319 static void ggp_action_buddylist_load(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
320 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
321 PurpleConnection *gc = (PurpleConnection *)action->context;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
322
23379
536450c4f7f9 Mark a string as translatable in prpl-gg. References #5693.
Will Thompson <resiak@pidgin.im>
parents: 23325
diff changeset
323 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
324 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
325 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
326 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
327 gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
328 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
329
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
330 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
331 PurpleRequestFields *fields)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
332 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
333 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
334 GGPInfo *info = purple_connection_get_protocol_data(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
335 struct gg_http *h = NULL;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
336 struct gg_pubdir *s;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
337 uin_t uin;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
338 gchar *email, *p1, *p2, *t;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
339 GGPToken *token = info->token;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
340
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
341 email = charset_convert(purple_request_fields_get_string(fields, "email"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
342 "UTF-8", "CP1250");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
343 p1 = charset_convert(purple_request_fields_get_string(fields, "password1"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
344 "UTF-8", "CP1250");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
345 p2 = charset_convert(purple_request_fields_get_string(fields, "password2"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
346 "UTF-8", "CP1250");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
347 t = charset_convert(purple_request_fields_get_string(fields, "token"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
348 "UTF-8", "CP1250");
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
349
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
350 account = purple_connection_get_account(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
351
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
352 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL ||
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
353 *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
354 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
355 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
356 _("You must fill in all registration fields"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
357 goto exit_err;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
358 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
359
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
360 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
361 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
362 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
363 _("Passwords do not match"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
364 goto exit_err;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
365 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
366
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
367 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
368 token->id, t);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
369 h = gg_register3(email, p1, token->id, t, 0);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
370 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
371 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
372 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
373 _("Unable to register new account. An unknown error occurred."));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
374 goto exit_err;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
375 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
376
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
377 uin = s->uin;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
378 purple_debug_info("gg", "registered uin: %d\n", uin);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
379
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
380 g_free(t);
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
381 t = g_strdup_printf("%u", uin);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
382 purple_account_set_username(account, t);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
383 /* 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
384 purple_account_set_password(account, p1);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
385
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
386 purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"),
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
387 _("Registration completed successfully!"), NULL);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
388
32721
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32685
diff changeset
389 purple_account_register_completed(account, TRUE);
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32685
diff changeset
390
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
391 /* TODO: the currently open Accounts Window will not be updated withthe
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
392 * 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
393 * point
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
394 */
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
395
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
396 /* 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
397 purple_account_disconnect(account);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
398
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
399 exit_err:
32721
3a64afbc2da2 Introduce purple_account_register_completed() to handle the invoking of any
Andrew Victor <andrew.victor@mxit.com>
parents: 32685
diff changeset
400 purple_account_register_completed(account, FALSE);
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
401
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
402 gg_register_free(h);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
403 g_free(email);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
404 g_free(p1);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
405 g_free(p2);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
406 g_free(t);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
407 g_free(token->id);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
408 g_free(token);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
409 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
410
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
411 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
412 PurpleRequestFields *fields)
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
413 {
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
414 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
415 GGPToken *token = info->token;
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
416
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32675
diff changeset
417 purple_account_disconnect(purple_connection_get_account(gc));
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
418
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
419 g_free(token->id);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
420 g_free(token->data);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
421 g_free(token);
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
422
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
423 }
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
424
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
425 static void ggp_register_user_dialog(PurpleConnection *gc)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
426 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
427 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
428 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
429 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
430 PurpleRequestField *field;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
431
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
432 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
433 GGPToken *token = info->token;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
434
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
435
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
436 account = purple_connection_get_account(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
437
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
438 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
439 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
440 purple_request_fields_add_group(fields, group);
12007
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 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
443 _("Email"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
444 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
445 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
446
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
447 field = purple_request_field_string_new("password1",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
448 _("Password"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
449 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
450 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
451
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
452 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
453 _("Password (again)"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
454 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
455 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
456
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
457 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
458 _("Enter captcha text"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
459 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
460 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
461
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
462 /* original size: 60x24 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
463 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
464 _("Captcha"), token->data, token->size);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
465 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
466
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
467 purple_request_fields(account,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
468 _("Register New Gadu-Gadu Account"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
469 _("Register New Gadu-Gadu Account"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
470 _("Please, fill in the following fields"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
471 fields,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
472 _("OK"), G_CALLBACK(ggp_callback_register_account_ok),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
473 _("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
474 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
475 gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
476 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
477
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
478 /* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
479
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
480 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
481 {
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
482 GGPInfo *info = purple_connection_get_protocol_data(gc);
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
483 GGPSearchForm *form = user_data;
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
484 guint32 seq;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
485
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
486 form->page_number++;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
487
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
488 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
489 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
490 form->seq);
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
491
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
492 seq = ggp_search_start(gc, form);
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
493 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
494 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
495 seq);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
496 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
497
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
498 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
499 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
500 purple_blist_request_add_buddy(purple_connection_get_account(gc),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
501 g_list_nth_data(row, 0), NULL, NULL);
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_im(PurpleConnection *gc, GList *row, gpointer user_data)
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
505 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
506 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
507 PurpleConversation *conv;
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
508 char *name;
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
509
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
510 account = purple_connection_get_account(gc);
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
511
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
512 name = g_list_nth_data(row, 0);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
513 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
514 purple_conversation_present(conv);
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
515 }
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
516
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
517 static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
518 {
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
519 GGPInfo *info = purple_connection_get_protocol_data(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
520 GGPSearchForm *form;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
521 guint32 seq;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
522
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
523 form = ggp_search_form_new(GGP_SEARCH_TYPE_FULL);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
524
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
525 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
526 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
527 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
528 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
529 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
530 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
531 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
532 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
533 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
534 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
535 purple_request_fields_get_string(fields, "year"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
536
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
537 switch (purple_request_fields_get_choice(fields, "gender")) {
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
538 case 1:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
539 form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
540 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
541 case 2:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
542 form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
543 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
544 default:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
545 form->gender = NULL;
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 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
548
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
549 form->active = purple_request_fields_get_bool(fields, "active")
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
550 ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
551
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
552 seq = ggp_search_start(gc, form);
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
553 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
554 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
555 seq);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
556 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
557
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
558 static void ggp_find_buddies(PurplePluginAction *action)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
559 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
560 PurpleConnection *gc = (PurpleConnection *)action->context;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
561
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
562 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
563 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
564 PurpleRequestField *field;
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 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
567 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
568 purple_request_fields_add_group(fields, group);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
569
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
570 field = purple_request_field_string_new("lastname",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
571 _("Last name"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
572 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
573 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
574
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
575 field = purple_request_field_string_new("firstname",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
576 _("First name"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
577 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
578 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
579
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
580 field = purple_request_field_string_new("nickname",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
581 _("Nickname"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
582 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
583 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
584
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
585 field = purple_request_field_string_new("city",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
586 _("City"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
587 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
588 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
589
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
590 field = purple_request_field_string_new("year",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
591 _("Year of birth"), NULL, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
592 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
593
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
594 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
595 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
596 purple_request_field_choice_add(field, _("Male"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
597 purple_request_field_choice_add(field, _("Female"));
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_bool_new("active",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
601 _("Only online"), FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
602 purple_request_field_group_add_field(group, field);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
603
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
604 purple_request_fields(gc,
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
605 _("Find buddies"),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
606 _("Find buddies"),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
607 _("Please, enter your search criteria below"),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
608 fields,
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
609 _("OK"), G_CALLBACK(ggp_callback_find_buddies),
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
610 _("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
611 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
612 gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
613 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
614
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
615 /* ----- 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
616
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
617 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
618 {
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
619 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
620 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
621 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
622 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
623 } 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
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 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
626 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
627 {
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 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
629 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
630 _("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
631
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 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
633
32649
b497d33010e3 Gadu-Gadu: use correct libgadu api functions to change password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32648
diff changeset
634 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
635 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
636 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
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 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
639 {
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
640 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
641 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
642 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
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
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 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
646 ((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
647 {
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 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
649 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
650 _("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
651 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
652 }
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 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
655 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
656 _("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
657
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 exit_cleanup:
32649
b497d33010e3 Gadu-Gadu: use correct libgadu api functions to change password
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32648
diff changeset
659 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
660 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
661 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
662 }
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 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
665 PurpleRequestFields *fields)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
666 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
667 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
668 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
669 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
670 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
671 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
672 _("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
673
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
674 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
675 "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
676 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
677 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
678 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
679 mail = g_strdup(purple_request_fields_get_string(fields, "email"));
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
680
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
681 account = purple_connection_get_account(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
682
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
683 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
684 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
685 *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
686 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
687 _("Fill in the fields."), NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
688 goto exit_err;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
689 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
690
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
691 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
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 _("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
694 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
695 }
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
696
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
697 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
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 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
700 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
701 goto exit_err;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
702 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
703
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
704 if (g_utf8_collate(cur, purple_account_get_password(account)) != 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
705 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
706 _("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
707 " 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
708 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
709 }
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
710
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 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
712 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
713 _("Invalid email address"), NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
714 goto exit_err;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
715 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
716
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
717 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
718 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
719
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
720 h = gg_change_passwd4(ggp_get_uin(account), 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
721 purple_account_get_password(account), p1, info->token->id, t,
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
722 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
723
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 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
725 purple_notify_error(account, messagesTitle,
14754
621ecdbdaf9a [gaim-migrate @ 17444]
Paul Schulz
parents: 14604
diff changeset
726 _("Unable to change password. Error occurred.\n"),
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
727 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
728 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
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 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
731 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
732 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
733 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
734 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
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 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
737 ggp_callback_change_passwd_handler, req);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
738 }
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
739
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
740 exit_err:
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
741 g_free(cur);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
742 g_free(p1);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
743 g_free(p2);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
744 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
745 g_free(mail);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
746 g_free(info->token->id);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
747 g_free(info->token->data);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
748 g_free(info->token);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
749 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
750
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
751 static void ggp_change_passwd_dialog(PurpleConnection *gc)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
752 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
753 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
754 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
755 PurpleRequestField *field;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
756
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
757 GGPInfo *info = purple_connection_get_protocol_data(gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
758 GGPToken *token = info->token;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
759
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
760 char *msg;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
761
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
762 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
763 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
764 purple_request_fields_add_group(fields, group);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
765
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
766 field = purple_request_field_string_new("password_cur",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
767 _("Current password"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
768 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
769 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
770
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
771 field = purple_request_field_string_new("password1",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
772 _("Password"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
773 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
774 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
775
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
776 field = purple_request_field_string_new("password2",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
777 _("Password (retype)"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
778 purple_request_field_string_set_masked(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
779 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
780
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
781 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
782 _("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
783 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
784 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
785
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
786 field = purple_request_field_string_new("token",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
787 _("Enter current token"), "", FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
788 purple_request_field_string_set_masked(field, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
789 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
790
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
791 /* original size: 60x24 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
792 field = purple_request_field_image_new("token_img",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
793 _("Current token"), token->data, token->size);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
794 purple_request_field_group_add_field(group, field);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
795
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
796 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
797 _("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
798 "for UIN: "), ggp_get_uin(purple_connection_get_account(gc)));
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
799
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
800 purple_request_fields(gc,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
801 _("Change Gadu-Gadu Password"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
802 _("Change Gadu-Gadu Password"),
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
803 msg,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
804 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
805 _("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
806 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
807 gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
808
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
809 g_free(msg);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
810 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
811
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
812 static void ggp_change_passwd(PurplePluginAction *action)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
813 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
814 PurpleConnection *gc = (PurpleConnection *)action->context;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
815
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
816 ggp_token_request(gc, ggp_change_passwd_dialog);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
817 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
818
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
819 /* ----- 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
820
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
821 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
822 {
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
823 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
824 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
825 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
826 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
827
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 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
829
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 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
831 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
832 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
833 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
834
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 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
836
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 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
838 }
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
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 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
841 {
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 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
843 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
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 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
846 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
847 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
848
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
diff changeset
849 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
850 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
851 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
852
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 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
854 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
855 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
856 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
857
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 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
859 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
860 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
861 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
862
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 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
864 _("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
865 _("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
866 _("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
867 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
868 _("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
869 _("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
870 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
871 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
872 }
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
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
874 /* ----- CONFERENCES ---------------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
875
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
876 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
877 {
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
878 PurpleConnection *conn;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
879 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
880 GList *sel;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
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 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
883
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 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
885
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
886 field = purple_request_fields_get_field(fields, "name");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
887 sel = purple_request_field_list_get_selected(field);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
888
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
889 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
890 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
891 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
892 }
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
893
78be70c986d3 Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents: 24747
diff changeset
894 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
895 ggp_str_to_uin(purple_buddy_get_name(buddy)));
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
896 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
897
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
898 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
899 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
900 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
901 PurpleConnection *gc;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
902 GGPInfo *info;
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 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
905 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
906 PurpleRequestField *field;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
907
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
908 GList *l;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
909 gchar *msg;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
910
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
911 buddy = (PurpleBuddy *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
912 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
913 info = purple_connection_get_protocol_data(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
914
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
915 fields = purple_request_fields_new();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
916 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
917 purple_request_fields_add_group(fields, group);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
918
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
919 field = purple_request_field_list_new("name", "Chat name");
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
920 for (l = info->chats; l != NULL; l = l->next) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
921 GGPChat *chat = l->data;
32531
5c85c02694e1 Remove deprecated purple_request_field_list_add().
Andrew Victor <andrew.victor@mxit.com>
parents: 32338
diff changeset
922 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
923 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
924 purple_request_field_group_add_field(group, field);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
925
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
926 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
927 purple_buddy_get_alias(buddy));
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
928 purple_request_fields(gc,
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
929 _("Add to chat..."),
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
930 _("Add to chat..."),
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
931 msg,
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
932 fields,
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
933 _("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
934 _("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
935 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
936 buddy);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
937 g_free(msg);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
938 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
939
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
940 /* ----- BLOCK BUDDIES -------------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
941
31938
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
942 static void ggp_add_deny(PurpleConnection *gc, const char *who)
11410
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
943 {
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
944 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
945 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
946
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
947 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
948
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
949 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
950 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
951 }
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 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
954 {
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
955 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
956 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
957
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
958 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
959
13c568701e8a Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31892
diff changeset
960 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
961 gg_add_notify_ex(info->session, uin, GG_USER_NORMAL);
11410
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
962 }
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
963
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
964 /* ---------------------------------------------------------------------- */
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
965 /* ----- INTERNAL CALLBACKS --------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
966 /* ---------------------------------------------------------------------- */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
967
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
968 struct gg_fetch_avatar_data
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
969 {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
970 PurpleConnection *gc;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
971 gchar *uin;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
972 gchar *avatar_url;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
973 };
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
974
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 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
977 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
978 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
979 PurpleAccount *account;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
980 PurpleBuddy *buddy;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
981 gpointer buddy_icon_data;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
982
31952
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
983 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
984 d->uin);
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
985
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
986 /* FIXME: This shouldn't be necessary */
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
987 if (!PURPLE_CONNECTION_IS_VALID(d->gc)) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
988 g_free(d->uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
989 g_free(d->avatar_url);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
990 g_free(d);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
991 g_return_if_reached();
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
992 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
993
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
994 account = purple_connection_get_account(d->gc);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
995 buddy = purple_find_buddy(account, d->uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
996
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
997 if (buddy == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
998 goto out;
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 buddy_icon_data = g_memdup(data, len);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1001
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1002 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
1003 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
1004 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
1005 "now\n", d->uin);
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1006
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1007 out:
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1008 g_free(d->uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1009 g_free(d->avatar_url);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1010 g_free(d);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1011 }
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 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
1014 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
1015 struct gg_fetch_avatar_data *data;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1016 PurpleConnection *gc = user_data;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1017 PurpleAccount *account;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1018 PurpleBuddy *buddy;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1019 const char *uin;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1020 const char *is_blank;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1021 const char *checksum;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1022
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1023 gchar *bigavatar = NULL;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1024 xmlnode *xml = NULL;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1025 xmlnode *xmlnode_users;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1026 xmlnode *xmlnode_user;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1027 xmlnode *xmlnode_avatars;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1028 xmlnode *xmlnode_avatar;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1029 xmlnode *xmlnode_bigavatar;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1030
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1031 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
1032 account = purple_connection_get_account(gc);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1033
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1034 if (error_message != NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1035 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
1036 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
1037 xml = xmlnode_from_str(url_text, -1);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1038 if (xml == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1039 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1040
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1041 xmlnode_users = xmlnode_get_child(xml, "users");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1042 if (xmlnode_users == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1043 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1044
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1045 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
1046 if (xmlnode_user == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1047 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1048
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1049 uin = xmlnode_get_attrib(xmlnode_user, "uin");
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_avatars = xmlnode_get_child(xmlnode_user, "avatars");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1052 if (xmlnode_avatars == 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 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
1056 if (xmlnode_avatar == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1057 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1058
29182
f11475f964ac Fix Gadu-Gadu avatars. The server's response format has changed. Fixes #11050.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27642
diff changeset
1059 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
1060 if (xmlnode_bigavatar == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1061 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1062
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1063 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
1064 bigavatar = xmlnode_get_data(xmlnode_bigavatar);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1065
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1066 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
1067 "URL %s\n",
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1068 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
1069 bigavatar ? bigavatar : "(null)");
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1070
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1071 if (uin != NULL && bigavatar != NULL) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1072 buddy = purple_find_buddy(account, uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1073 if (buddy == NULL)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1074 goto out;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1075
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1076 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
1077
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1078 if (purple_strequal(is_blank, "1")) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1079 purple_buddy_icons_set_for_user(account,
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1080 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
1081 } else if (!purple_strequal(checksum, bigavatar)) {
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1082 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
1083 data->gc = gc;
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1084 data->uin = g_strdup(uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1085 data->avatar_url = g_strdup(bigavatar);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1086
31952
64be5338ab6b More debugging informations when updating avatars in Gadu-Gadu
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31938
diff changeset
1087 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
1088 "requesting avatar for %s\n", uin);
32763
fecea45a546b Remove dead assignments found with clang-analyzer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32721
diff changeset
1089 /* FIXME: This should be cancelled somewhere if not needed. */
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
1090 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
1091 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
1092 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
1093 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1094 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1095 }
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1096
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1097 out:
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1098 if (xml)
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1099 xmlnode_free(xml);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1100 g_free(bigavatar);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1101 }
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
1102
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1103 /**
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
1104 * 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
1105 *
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
1106 * @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
1107 * @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
1108 */
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 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
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 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
1112 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
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 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
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 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
1117
32763
fecea45a546b Remove dead assignments found with clang-analyzer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32721
diff changeset
1118 /* FIXME: This should be cancelled somewhere if not needed. */
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
1119 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
1120 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
1121 "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
1122 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
1123
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 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
1125 }
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
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 /**
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1128 * Handle change of the status of the buddy.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1129 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1130 * @param gc PurpleConnection
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1131 * @param uin UIN of the buddy.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1132 * @param status ID of the status.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1133 * @param descr Description.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1134 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1135 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
1136 int status, const char *descr)
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1137 {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1138 gchar *from;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1139 const char *st;
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1140 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
1141
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
1142 ggp_update_buddy_avatar(gc, uin);
27388
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1143
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1144 from = g_strdup_printf("%u", uin);
e72ccf802d25 Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 27371
diff changeset
1145
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1146 switch (status) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1147 case GG_STATUS_NOT_AVAIL:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1148 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
1149 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
1150 break;
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1151 case GG_STATUS_FFC:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1152 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
1153 st = "freeforchat";
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1154 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1155 case GG_STATUS_AVAIL:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1156 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
1157 st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE);
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_BUSY:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1160 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
1161 st = purple_primitive_get_id_from_type(PURPLE_STATUS_AWAY);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1162 break;
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
1163 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
1164 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
1165 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
1166 break;
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1167 case GG_STATUS_DND:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1168 case GG_STATUS_DND_DESCR:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1169 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
1170 break;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1171 case GG_STATUS_BLOCKED:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1172 /* user is blocking us.... */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1173 st = "blocked";
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1174 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1175 default:
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1176 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
1177 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1178 "GG_EVENT_NOTIFY: Unknown status: %d\n", status);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1179 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1180 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1181
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1182 if (descr != NULL) {
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1183 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
1184 g_strstrip(status_msg);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1185 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
1186 g_free(status_msg);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1187 status_msg = NULL;
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1188 }
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1189 }
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1190
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1191 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
1192 status_msg ? status_msg : "");
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
1193 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
1194 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
1195 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
1196 } else {
3587e1e5fbe5 gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29824
diff changeset
1197 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
1198 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
1199 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
1200 }
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1201 g_free(from);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1202 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1203
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1204 static void ggp_sr_close_cb(gpointer user_data)
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1205 {
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1206 GGPSearchForm *form = user_data;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1207 GGPInfo *info = form->user_data;
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1208
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1209 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
1210 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
1211 form->seq);
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1212 ggp_search_form_destroy(form);
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1213 }
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1214
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1215 /**
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1216 * Translate a status' ID to a more user-friendly name.
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1217 *
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1218 * @param id The ID of the status.
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 * @return The user-friendly name of the status.
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 static const char *ggp_status_by_id(unsigned int id)
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 const char *st;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1225
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1226 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
1227 switch (id) {
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1228 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
1229 case GG_STATUS_NOT_AVAIL_DESCR:
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1230 st = _("Offline");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1231 break;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1232 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
1233 case GG_STATUS_AVAIL_DESCR:
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1234 st = _("Available");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1235 break;
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1236 case GG_STATUS_FFC:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1237 case GG_STATUS_FFC_DESCR:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1238 return _("Chatty");
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1239 case GG_STATUS_DND:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1240 case GG_STATUS_DND_DESCR:
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1241 return _("Do Not Disturb");
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1242 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
1243 case GG_STATUS_BUSY_DESCR:
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1244 st = _("Away");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1245 break;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1246 default:
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1247 st = _("Unknown");
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1248 break;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1249 }
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1250
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1251 return st;
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1252 }
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1253
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1254 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
1255 GGPSearchForm *form)
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1256 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1257 PurpleNotifyUserInfo *user_info;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1258 PurpleBuddy *buddy;
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1259 char *val, *who;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1260
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1261 user_info = purple_notify_user_info_new();
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1262
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1263 val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS);
13645
3de3dfcf24fa [gaim-migrate @ 16042]
Bartosz Oler <bartosz@pidgin.im>
parents: 13643
diff changeset
1264 /* 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
1265 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
1266 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1267
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1268 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
1269 /* 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
1270 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
1271 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
1272
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1273 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
1274 /* 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
1275 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
1276 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
1277 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1278
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1279 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
1280 /* 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
1281 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
1282 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
1283 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1284
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1285 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
1286 /* 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
1287 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
1288 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
1289 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1290
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1291 val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR);
15205
f642029b2f97 [gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents: 15196
diff changeset
1292 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
1293 /* 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
1294 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
1295 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
1296 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1297 g_free(val);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1298
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1299 /*
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1300 * 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
1301 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1302 buddy = purple_find_buddy(purple_connection_get_account(gc), who);
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1303 if (NULL != buddy) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1304 PurpleStatus *status;
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1305 const char *msg;
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1306
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1307 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
1308 msg = purple_status_get_attr_string(status, "message");
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1309
15294
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1310 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
1311 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
1312 }
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1313 }
4d3cd3c5b5a6 [gaim-migrate @ 18022]
Bartosz Oler <bartosz@pidgin.im>
parents: 15291
diff changeset
1314
18629
9e78088bfc46 Close temporary Get Info window when showing the real one. Fixes #1720.
Bartosz Oler <bartosz@pidgin.im>
parents: 18190
diff changeset
1315 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
1316 g_free(who);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1317 purple_notify_user_info_destroy(user_info);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1318 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1319
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1320 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
1321 GGPSearchForm *form)
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1322 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1323 PurpleNotifySearchResults *results;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1324 PurpleNotifySearchColumn *column;
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1325 int res_count;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1326 int start;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1327 int i;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1328
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1329 g_return_if_fail(form != NULL);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1330
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1331 res_count = gg_pubdir50_count(req);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1332 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
1333 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
1334 form->page_size = res_count;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1335
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1336 results = purple_notify_searchresults_new();
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1337
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1338 if (results == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1339 purple_debug_error("gg", "ggp_pubdir_reply_handler: "
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1340 "Unable to display the search results.\n");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1341 purple_notify_error(gc, NULL,
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1342 _("Unable to display the search results."),
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1343 NULL);
31879
6c34fd3b36f4 Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31874
diff changeset
1344 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
1345 ggp_sr_close_cb(form);
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1346 return;
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1347 }
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1348
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1349 column = purple_notify_searchresults_column_new(_("UIN"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1350 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1351
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1352 column = purple_notify_searchresults_column_new(_("First Name"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1353 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1354
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1355 column = purple_notify_searchresults_column_new(_("Nickname"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1356 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1357
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1358 column = purple_notify_searchresults_column_new(_("City"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1359 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1360
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1361 column = purple_notify_searchresults_column_new(_("Birth Year"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1362 purple_notify_searchresults_column_add(results, column);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1363
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1364 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
1365
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1366 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
1367 purple_debug_info("gg", "start = %d\n", start);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1368
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1369 for (i = 0; i < res_count; i++) {
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1370 GList *row = NULL;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1371 char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR);
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 /* TODO: Status will be displayed as an icon. */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1374 /* 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
1375 row = g_list_append(row, ggp_search_get_result(req, i,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1376 GG_PUBDIR50_UIN));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1377 row = g_list_append(row, ggp_search_get_result(req, i,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1378 GG_PUBDIR50_FIRSTNAME));
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_NICKNAME));
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_CITY));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1383 row = g_list_append(row,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1384 (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-"));
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1385
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1386 purple_notify_searchresults_row_add(results, row);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1387 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1388
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1389 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_CONTINUE,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1390 ggp_callback_show_next);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1391 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1392 ggp_callback_add_buddy);
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_IM,
13642
43cc4f6ca8e1 [gaim-migrate @ 16039]
Bartosz Oler <bartosz@pidgin.im>
parents: 13641
diff changeset
1394 ggp_callback_im);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1395
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1396 if (form->window == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1397 void *h = purple_notify_searchresults(gc,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1398 _("Gadu-Gadu Public Directory"),
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1399 _("Search results"), NULL, results,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1400 (PurpleNotifyCloseCallback)ggp_sr_close_cb,
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1401 form);
12257
bc979ba39363 [gaim-migrate @ 14559]
Bartosz Oler <bartosz@pidgin.im>
parents: 12220
diff changeset
1402
12277
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1403 if (h == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1404 purple_debug_error("gg", "ggp_pubdir_reply_handler: "
12277
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1405 "Unable to display the search results.\n");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1406 purple_notify_error(gc, NULL,
12277
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1407 _("Unable to display the search results."),
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1408 NULL);
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1409 return;
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1410 }
6e45a609022c [gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents: 12258
diff changeset
1411
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
1412 form->window = h;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1413 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1414 purple_notify_searchresults_new_rows(gc, results, form->window);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1415 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1416 }
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1417
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1418 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
1419 {
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
1420 GGPInfo *info = purple_connection_get_protocol_data(gc);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1421 GGPSearchForm *form;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1422 int res_count;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1423 guint32 seq;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1424
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1425 seq = gg_pubdir50_seq(req);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1426 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
1427 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
1428 "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
1429 /*
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1430 * this can happen when user will request more results
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1431 * and close the results window before they arrive.
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1432 */
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1433 g_return_if_fail(form != NULL);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1434
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1435 res_count = gg_pubdir50_count(req);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1436 if (res_count < 1) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1437 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
1438 purple_notify_error(gc, NULL,
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1439 _("No matching users found"),
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1440 _("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
1441 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
1442 ggp_sr_close_cb(form);
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1443 return;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1444 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1445
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1446 switch (form->search_type) {
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1447 case GGP_SEARCH_TYPE_INFO:
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1448 ggp_pubdir_handle_info(gc, req, form);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1449 break;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1450 case GGP_SEARCH_TYPE_FULL:
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1451 ggp_pubdir_handle_full(gc, req, form);
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1452 break;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1453 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1454 purple_debug_warning("gg", "Unknown search_type!\n");
13643
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1455 break;
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1456 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1457 }
1a69e962e3b4 [gaim-migrate @ 16040]
Bartosz Oler <bartosz@pidgin.im>
parents: 13642
diff changeset
1458
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1459 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
1460 {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1461 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
1462 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
1463 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
1464 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
1465
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1466 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
1467 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
1468 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
1469 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
1470
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1471 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
1472
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1473 while(entry) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1474 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
1475 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
1476 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
1477 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
1478 g_strfreev(split);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1479 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
1480 /* 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
1481 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
1482 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
1483 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
1484 g_free(buf);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1485 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
1486 g_free(text);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1487 break;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1488 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1489 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
1490 break;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1491 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1492 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
1493 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1494 g_free(handlerid);
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 return;
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
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1499
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1500 /**
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1501 * Dispatch a message received from a buddy.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1502 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1503 * @param gc PurpleConnection.
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1504 * @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
1505 *
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1506 * 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
1507 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1508 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
1509 {
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
1510 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
1511 PurpleConversation *conv;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1512 gchar *from;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1513 gchar *msg;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1514 gchar *tmp;
32645
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1515 time_t mtime;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1516
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
1517 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
1518 {
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
1519 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
1520 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
1521 }
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
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1523 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
1524
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1525 /*
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1526 tmp = charset_convert((const char *)ev->event.msg.message,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1527 "CP1250", "UTF-8");
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1528 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1529 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
1530 purple_str_strip_char(tmp, '\r');
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1531 msg = g_markup_escape_text(tmp, -1);
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1532 g_free(tmp);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1533
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1534 /* We got richtext message */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1535 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
1536 {
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
1537 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
1538 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
1539 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
1540 gint increased_len = 0;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1541 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
1542 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
1543 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
1544 gchar *handlerid;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1545
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1546 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
1547
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1548 while (cformats < cformats_end)
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 gint byteoffset;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1551 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
1552 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
1553 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
1554
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1555 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
1556 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
1557 continue;
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 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
1560 actformat->position,
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1561 (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
1562 (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
1563 (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
1564 (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
1565 increased_len);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1566
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1567 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
1568 got_image = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1569 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
1570 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
1571 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
1572
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1573 /* 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
1574 * 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
1575 if (actimage->size > 255000) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1576 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
1577 continue;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1578 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1579
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1580 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
1581 actimage->size, actimage->crc32);
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 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
1584 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
1585 increased_len += strlen(handlerid);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1586 g_free(handlerid);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1587 continue;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1588 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1589
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1590 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
1591 if (bold == FALSE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1592 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
1593 increased_len += 3;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1594 bold = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1595 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1596 } else if (bold) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1597 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
1598 increased_len += 4;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1599 bold = FALSE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1600 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1601
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1602 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
1603 if (italic == FALSE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1604 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
1605 increased_len += 3;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1606 italic = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1607 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1608 } else if (italic) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1609 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
1610 increased_len += 4;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1611 italic = FALSE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1612 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1613
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1614 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
1615 if (under == FALSE) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1616 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
1617 increased_len += 3;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1618 under = TRUE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1619 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1620 } else if (under) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1621 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
1622 increased_len += 4;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1623 under = FALSE;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1624 }
31386
85d81b2b1142 gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31294
diff changeset
1625
85d81b2b1142 gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31294
diff changeset
1626 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
1627 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
1628 }
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1629 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1630
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1631 msg = message->str;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1632 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
1633
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1634 if (got_image) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1635 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
1636 return;
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 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1639
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1640 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
1641 from, msg, ev->event.msg.msgclass,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1642 ev->event.msg.recipients_count);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1643
32645
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1644 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
1645 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
1646 else
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1647 mtime = time(NULL);
262c9ba5fe13 Gadu-Gadu: Show local time for incoming messages. Fixes #4579
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32644
diff changeset
1648
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1649 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
1650 serv_got_im(gc, from, msg, 0, mtime);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1651 } else {
12373
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1652 const char *chat_name;
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1653 int chat_id;
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1654 char *buddy_name;
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1655
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1656 chat_name = ggp_confer_find_by_participants(gc,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1657 ev->event.msg.recipients,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1658 ev->event.msg.recipients_count);
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1659
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1660 if (chat_name == NULL) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1661 chat_name = ggp_confer_add_new(gc, NULL);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1662 serv_got_joined_chat(gc, info->chats_count, chat_name);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1663
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1664 ggp_confer_participants_add_uin(gc, chat_name,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1665 ev->event.msg.sender);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1666
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1667 ggp_confer_participants_add(gc, chat_name,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1668 ev->event.msg.recipients,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1669 ev->event.msg.recipients_count);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1670 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1671 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
1672 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
1673
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1674 buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender);
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1675 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
1676 PURPLE_MESSAGE_RECV, msg, mtime);
12373
a8f71f73576d [gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents: 12277
diff changeset
1677 g_free(buddy_name);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1678 }
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
1679 g_free(msg);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1680 g_free(from);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1681 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1682
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1683 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
1684 {
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
1685 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
1686 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
1687 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
1688
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
1689 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
1690
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1691 if(imgid)
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1692 {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1693 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
1694 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
1695 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
1696 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
1697
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1698 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
1699 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
1700 purple_imgstore_unref(image);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1701 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1702 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
1703 }
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
1704 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
1705 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1706 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1707
31630
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1708 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
1709 gchar *from;
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1710
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1711 from = g_strdup_printf("%u", uin);
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1712 if (length)
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1713 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
1714 else
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1715 serv_got_typing_stopped(gc, from);
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1716 g_free(from);
31630
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1717 }
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1718
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
1719 /**
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
1720 * 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
1721 *
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
1722 * @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
1723 * @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
1724 *
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 * @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
1726 */
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 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
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 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
1730 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
1731
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 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
1733 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
1734 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
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 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
1737 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
1738 {
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 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
1740
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 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
1742 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
1743 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
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_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
1746 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
1747 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
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_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
1750
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 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
1752 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
1753 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
1754 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
1755 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
1756 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
1757 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
1758
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 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
1760 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
1761 {
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 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
1763 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
1764 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
1765 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
1766 }
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
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 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
1769 {
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 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
1771 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
1772 "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
1773 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
1774 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
1775 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
1776 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
1777 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
1778 "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
1779 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
1780 }
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 }
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
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 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
1784 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
1785 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
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1788 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
1789 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1790 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
1791 GGPInfo *info = purple_connection_get_protocol_data(gc);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1792 struct gg_event *ev;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1793 int i;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1794
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1795 if (!(ev = gg_watch_fd(info->session))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1796 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1797 "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
1798 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
1799 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
1800 _("Unable to read from socket"));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1801 return;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1802 }
31661
2a8aceaee628 Don't update last_received when receiving data on gg. Fixes #13699.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31649
diff changeset
1803
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1804 switch (ev->type) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1805 case GG_EVENT_NONE:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1806 /* Nothing happened. */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1807 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1808 case GG_EVENT_MSG:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1809 ggp_recv_message_handler(gc, ev);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1810 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1811 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
1812 /* Changing %u to %i fixes compiler warning */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1813 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
1814 "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
1815 ev->event.ack.recipient, ev->event.ack.status,
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1816 ev->event.ack.seq);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1817 break;
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1818 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
1819 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
1820 break;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
1821 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
1822 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
1823 break;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1824 case GG_EVENT_NOTIFY:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1825 case GG_EVENT_NOTIFY_DESCR:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1826 {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1827 struct gg_notify_reply *n;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1828 char *descr;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1829
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1830 purple_debug_info("gg", "notify_pre: (%d) status: %d\n",
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1831 ev->event.notify->uin,
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
1832 GG_S(ev->event.notify->status));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1833
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1834 n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1835 : ev->event.notify_descr.notify;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1836
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1837 for (; n->uin; n++) {
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1838 descr = (ev->type == GG_EVENT_NOTIFY) ? NULL
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1839 : ev->event.notify_descr.descr;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1840
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1841 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1842 "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
1843 n->uin, GG_S(n->status), descr ? descr : "(null)");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1844
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1845 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
1846 n->uin, GG_S(n->status), descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1847 }
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 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1850 case GG_EVENT_NOTIFY60:
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1851 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
1852 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1853 "notify60: (%d) status=%d; version=%d; descr=%s\n",
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1854 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
1855 GG_S(ev->event.notify60[i].status),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1856 ev->event.notify60[i].version,
14524
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1857 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
1858
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1859 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
1860 GG_S(ev->event.notify60[i].status),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1861 ev->event.notify60[i].descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1862 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1863 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1864 case GG_EVENT_STATUS:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1865 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
1866 ev->event.status.uin, GG_S(ev->event.status.status),
14524
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1867 ev->event.status.descr ? ev->event.status.descr : "(null)");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1868
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1869 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
1870 GG_S(ev->event.status.status), ev->event.status.descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1871 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1872 case GG_EVENT_STATUS60:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1873 purple_debug_info("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1874 "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
1875 ev->event.status60.uin, GG_S(ev->event.status60.status),
14524
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1876 ev->event.status60.version,
9637518e9703 [gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents: 14521
diff changeset
1877 ev->event.status60.descr ? ev->event.status60.descr : "(null)");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1878
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1879 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
1880 GG_S(ev->event.status60.status), ev->event.status60.descr);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1881 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1882 case GG_EVENT_USERLIST:
31795
ee01a0566a86 Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31739
diff changeset
1883 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
1884 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
1885 purple_notify_info(gc, NULL,
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1886 _("Buddy list downloaded"),
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1887 _("Your buddy list was downloaded from the server."));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1888 if (ev->event.userlist.reply != NULL) {
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1889 ggp_buddylist_load(gc, ev->event.userlist.reply);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1890 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1891 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1892 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
1893 purple_notify_info(gc, NULL,
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1894 _("Buddy list uploaded"),
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
1895 _("Your buddy list was stored on the server."));
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1896 }
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1897 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1898 case GG_EVENT_PUBDIR50_SEARCH_REPLY:
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1899 ggp_pubdir_reply_handler(gc, ev->event.pubdir50);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1900 break;
31630
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1901 case GG_EVENT_TYPING_NOTIFICATION:
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1902 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
1903 ev->event.typing_notification.length);
47b2ee63a797 Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents: 31628
diff changeset
1904 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
1905 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
1906 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
1907 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
1908 break;
33296
33a9adb52028 Enable receiving of user_data packets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33295
diff changeset
1909 case GG_EVENT_USER_DATA:
33a9adb52028 Enable receiving of user_data packets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33295
diff changeset
1910 purple_debug_misc("gg", "GG_EVENT_USER_DATA\n");
33a9adb52028 Enable receiving of user_data packets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33295
diff changeset
1911 break;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1912 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1913 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1914 "unsupported event type=%d\n", ev->type);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1915 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1916 }
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1917
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1918 gg_free_event(ev);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1919 }
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1920
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1921 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
1922 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1923 PurpleConnection *gc = _gc;
15419
c8f83c72739d [gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents: 15294
diff changeset
1924 GGPInfo *info;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1925 struct gg_event *ev;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1926
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1927 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
15419
c8f83c72739d [gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents: 15294
diff changeset
1928
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
1929 info = purple_connection_get_protocol_data(gc);
15419
c8f83c72739d [gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents: 15294
diff changeset
1930
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1931 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
1932 info->session->check, info->session->state);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1933
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1934 switch (info->session->state) {
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1935 case GG_STATE_RESOLVING:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1936 purple_debug_info("gg", "GG_STATE_RESOLVING\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1937 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
1938 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
1939 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
1940 break;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1941 case GG_STATE_CONNECTING_HUB:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1942 purple_debug_info("gg", "GG_STATE_CONNECTING_HUB\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1943 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1944 case GG_STATE_READING_DATA:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1945 purple_debug_info("gg", "GG_STATE_READING_DATA\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1946 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1947 case GG_STATE_CONNECTING_GG:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1948 purple_debug_info("gg", "GG_STATE_CONNECTING_GG\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1949 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1950 case GG_STATE_READING_KEY:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1951 purple_debug_info("gg", "GG_STATE_READING_KEY\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1952 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1953 case GG_STATE_READING_REPLY:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1954 purple_debug_info("gg", "GG_STATE_READING_REPLY\n");
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1955 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
1956 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
1957 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
1958 break;
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
1959 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1960 purple_debug_error("gg", "unknown state = %d\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1961 info->session->state);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1962 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1963 }
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 if (!(ev = gg_watch_fd(info->session))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1966 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
1967 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
1968 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
1969 _("Unable to read from socket"));
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1970 return;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1971 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1972 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
1973 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
1974 info->session->check, info->session->state);
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1975
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
1976 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
1977 info->inpa = 0;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1978
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1979 /** 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
1980 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
1981 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
1982 (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
1983 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
1984 ggp_async_login_handler, gc);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1985
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1986 switch (ev->type) {
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1987 case GG_EVENT_NONE:
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1988 /* Nothing happened. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1989 purple_debug_info("gg", "GG_EVENT_NONE\n");
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1990 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
1991 case GG_EVENT_CONN_SUCCESS:
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
1992 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1993 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
1994 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
1995 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
1996 PURPLE_INPUT_READ,
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
1997 ggp_callback_recv, gc);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
1998
27642
6ae79601ad84 Patch from kkszysiu to make the GG prpl support
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27626
diff changeset
1999 ggp_buddylist_send(gc);
30163
e43601d06035 gg: Fix misuse of update_progress. Fixes #11774
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 30138
diff changeset
2000 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
2001 purple_connection_set_state(gc, PURPLE_CONNECTED);
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2002 }
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2003 break;
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2004 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
2005 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
2006 info->inpa = 0;
32646
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2007 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
2008 ev->event.failure);
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2009 switch (ev->event.failure) {
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2010 case GG_FAILURE_RESOLVING:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2011 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2012 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
2013 _("Unable to resolve "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2014 "hostname"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2015 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2016 case GG_FAILURE_PASSWORD:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2017 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2018 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
2019 _("Incorrect password"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2020 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2021 case GG_FAILURE_TLS:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2022 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2023 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
2024 _("SSL Connection Failed"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2025 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2026 case GG_FAILURE_INTRUDER:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2027 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2028 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
2029 _("Your account has been "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2030 "disabled because too many "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2031 "incorrect passwords were "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2032 "entered"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2033 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2034 case GG_FAILURE_UNAVAILABLE:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2035 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2036 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
2037 _("Service temporarily "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2038 "unavailable"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2039 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2040 case GG_FAILURE_PROXY:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2041 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2042 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
2043 _("Error connecting to proxy "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2044 "server"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2045 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2046 case GG_FAILURE_HUB:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2047 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2048 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
2049 _("Error connecting to master "
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2050 "server"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2051 break;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2052 default:
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2053 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2054 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
2055 _("Connection failed"));
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2056 }
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2057 break;
31874
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2058 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
2059 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
2060 {
a8e9b3781df1 Gadu-Gadu: check for NULL pointer before logging system messages.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32646
diff changeset
2061 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
2062 break;
a8e9b3781df1 Gadu-Gadu: check for NULL pointer before logging system messages.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32646
diff changeset
2063
31874
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2064 /* 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
2065 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
2066 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
2067 }
31874
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2068 else
6ddbbcd38154 No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31795
diff changeset
2069 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
2070 "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
2071 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
2072 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
2073 break;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2074 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2075 purple_debug_error("gg", "strange event: %d\n", ev->type);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2076 break;
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2077 }
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 gg_free_event(ev);
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2080 }
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 /* ---------------------------------------------------------------------- */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2083 /* ----- PurplePluginProtocolInfo ----------------------------------------- */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2084 /* ---------------------------------------------------------------------- */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2085
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2086 static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2087 {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2088 return "gadu-gadu";
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2089 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2090
32652
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2091 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
2092 {
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2093 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
2094
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2095 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
2096 if (uin <= 0)
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2097 return NULL;
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2098
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2099 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
2100
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2101 return normalized;
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2102 }
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2103
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2104 static char *ggp_status_text(PurpleBuddy *b)
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2105 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2106 PurpleStatus *status;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2107 const char *msg;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2108 char *text;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2109 char *tmp;
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2110
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2111 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
2112 purple_buddy_get_presence(b));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2113 msg = purple_status_get_attr_string(status, "message");
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2114
31892
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2115 if (msg == NULL)
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2116 return NULL;
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2117
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2118 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
2119 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
2120 g_free(tmp);
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2121
3368a7044a4a Better status message handling in Gadu-Gadu. Fixes #14314
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 31879
diff changeset
2122 return text;
2846
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2123 }
4f0435806f95 [gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents: 2835
diff changeset
2124
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2125 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
2126 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2127 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
2128 char *tmp;
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2129 const char *msg, *name, *alias;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2130
15005
4b4af389b71c [gaim-migrate @ 17715]
Bartosz Oler <bartosz@pidgin.im>
parents: 14754
diff changeset
2131 g_return_if_fail(b != NULL);
4b4af389b71c [gaim-migrate @ 17715]
Bartosz Oler <bartosz@pidgin.im>
parents: 14754
diff changeset
2132
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2133 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
2134 msg = purple_status_get_attr_string(status, "message");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2135 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
2136 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
2137
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
2138 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
2139
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2140 if (msg != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2141 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
2142 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
2143 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
2144 g_free(tmp);
15196
1663f0333c05 [gaim-migrate @ 17920]
Bartosz Oler <bartosz@pidgin.im>
parents: 15185
diff changeset
2145 } 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
2146 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
2147 }
15227
a3327ea6d1b7 [gaim-migrate @ 17951]
Bartosz Oler <bartosz@pidgin.im>
parents: 15205
diff changeset
2148 /* 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
2149 } 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
2150 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
2151 }
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2154 static GList *ggp_status_types(PurpleAccount *account)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2155 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2156 PurpleStatusType *type;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2157 GList *types = NULL;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2158
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2159 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
2160 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
2161 "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
2162 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2163 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2164
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2165 /*
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2166 * 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
2167 * 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
2168 */
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2169 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
2170 "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
2171 "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
2172 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2173 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2174
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2175 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
2176 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
2177 "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
2178 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2179 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2180
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
2181 /*
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2182 * 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
2183 */
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2184 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
2185 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
2186 "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
2187 NULL);
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2188 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
2189
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 * 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
2192 * (invisible) status.
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2193 */
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2194 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
2195 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
2196 "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
2197 NULL);
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2198 types = g_list_append(types, type);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
2199
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2200 /*
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2201 * This status is necessary to display guys who are blocking *us*.
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2202 */
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2203 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
2204 "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
2205 "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
2206 NULL);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2207 types = g_list_append(types, type);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2208
32653
5ff7a8b6e0f1 Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32652
diff changeset
2209 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
2210 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
2211 "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
2212 NULL);
12658
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12645
diff changeset
2213 types = g_list_append(types, type);
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12645
diff changeset
2214
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2215 return types;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2216 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2217
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2218 static GList *ggp_blist_node_menu(PurpleBlistNode *node)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2219 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2220 PurpleMenuAction *act;
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2221 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
2222 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
2223 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
2224 GGPInfo *info;
4333
f4c095774bc2 [gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents: 4229
diff changeset
2225
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2226 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2227 return NULL;
4333
f4c095774bc2 [gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents: 4229
diff changeset
2228
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
2229 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
2230 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
2231 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
2232 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
2233 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
2234 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
2235 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
2236 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
2237 }
11410
08212b2e6083 [gaim-migrate @ 13647]
Bartosz Oler <bartosz@pidgin.im>
parents: 11397
diff changeset
2238
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2239 return m;
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2240 }
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2241
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2242 static GList *ggp_chat_info(PurpleConnection *gc)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2243 {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2244 GList *m = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2245 struct proto_chat_entry *pce;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2246
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2247 pce = g_new0(struct proto_chat_entry, 1);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2248 pce->label = _("Chat _name:");
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2249 pce->identifier = "name";
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2250 pce->required = TRUE;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2251 m = g_list_append(m, pce);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2252
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2253 return m;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2254 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2255
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2256 static void ggp_login(PurpleAccount *account)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2257 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2258 PurpleConnection *gc;
23382
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2259 PurplePresence *presence;
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2260 PurpleStatus *status;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2261 struct gg_login_params *glp;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2262 GGPInfo *info;
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2263 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
2264 const gchar *encryption_type;
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2265
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2266 if (ggp_setup_proxy(account) == -1)
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2267 return;
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2268
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2269 gc = purple_account_get_connection(account);
13515
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2270 glp = g_new0(struct gg_login_params, 1);
0cea461e904c [gaim-migrate @ 15890]
Bartosz Oler <bartosz@pidgin.im>
parents: 13466
diff changeset
2271 info = g_new0(GGPInfo, 1);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2272
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2273 /* Probably this should be moved to *_new() function. */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2274 info->session = NULL;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2275 info->chats = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2276 info->chats_count = 0;
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2277 info->token = NULL;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2278 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
2279 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
2280 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
2281 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
2282
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
2283 purple_connection_set_protocol_data(gc, info);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2284
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2285 glp->uin = ggp_get_uin(account);
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
2286 glp->password = charset_convert(purple_account_get_password(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
2287 "UTF-8", "CP1250");
32646
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2288
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2289 if (glp->uin == 0) {
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2290 purple_connection_error(gc,
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2291 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
2292 _("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
2293 g_free(glp);
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2294 return;
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2295 }
d1e3538b0c5f Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32645
diff changeset
2296
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2297 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
2298 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
2299
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
2300 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
2301 glp->status_flags |= GG_STATUS_FLAG_SPAM;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2302
23382
8dfecaa62e66 Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents: 23381
diff changeset
2303 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
2304 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
2305
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2306 glp->encoding = GG_ENCODING_UTF8;
33296
33a9adb52028 Enable receiving of user_data packets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33295
diff changeset
2307 glp->protocol_features = (GG_FEATURE_DND_FFC |
33a9adb52028 Enable receiving of user_data packets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33295
diff changeset
2308 GG_FEATURE_TYPING_NOTIFICATION | GG_FEATURE_MULTILOGON |
33a9adb52028 Enable receiving of user_data packets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33295
diff changeset
2309 GG_FEATURE_USER_DATA);
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);
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
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;
909496097dcf Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents: 31386
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", "");
33292
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2339 if (address && *address)
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2340 {
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2341 glp->server_addr = inet_addr(address);
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2342 glp->server_port = 8074;
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2343
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2344 if (glp->server_addr == INADDR_NONE)
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2345 {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
2346 purple_connection_error(gc,
33292
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2347 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2348 _("Provided server IP address is not valid"));
0ad1dc71f5c7 Makefile cleanup, fix building with external libgadu, little synchronization of internal libgadu with upstream. Refs #343
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33291
diff changeset
2349 g_free(glp);
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2350 return;
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2351 }
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2352 } else
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2353 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
2354
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2355 info->session = gg_login(glp);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
2356 purple_connection_update_progress(gc, _("Connecting"), 0, 2);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2357 if (info->session == NULL) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 32147
diff changeset
2358 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
2359 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
2360 _("Connection failed"));
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2361 g_free(glp);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2362 return;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2363 }
32685
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2364 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
2365 ggp_async_login_handler, gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2366 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2367
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2368 static void ggp_close(PurpleConnection *gc)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2369 {
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
2370 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
2371 GGPInfo *info;;
8997
a30b6b11674a [gaim-migrate @ 9772]
Luke Schierer <lschiere@pidgin.im>
parents: 8996
diff changeset
2372
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2373 if (gc == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2374 purple_debug_info("gg", "gc == NULL\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2375 return;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2376 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2377
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
2378 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
2379 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
2380
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
2381 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
2382 PurpleStatus *status = purple_account_get_active_status(account);
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2383
11538
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2384 if (info->session != NULL) {
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2385 ggp_set_status(account, status);
11538
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2386 gg_logoff(info->session);
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2387 gg_free_session(info->session);
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2388 }
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2389
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
2390 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
2391
14060
e1a87aabd80c [gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents: 13645
diff changeset
2392 /* Immediately close any notifications on this handle since that process depends
e1a87aabd80c [gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents: 13645
diff changeset
2393 * 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
2394 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2395 purple_notify_close_with_handle(gc);
14060
e1a87aabd80c [gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents: 13645
diff changeset
2396
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2397 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
2398 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
2399 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
2400
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2401 if (info->inpa > 0)
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2402 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
2403
140518f18665 GG: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
2404 purple_connection_set_protocol_data(gc, NULL);
11545
df2f9bb3fd6e [gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents: 11544
diff changeset
2405 g_free(info);
11538
d87f3717d5a5 [gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents: 11522
diff changeset
2406 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2407
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2408 purple_debug_info("gg", "Connection closed.\n");
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2409 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2410
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2411 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
2412 PurpleMessageFlags flags)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2413 {
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
2414 GGPInfo *info = purple_connection_get_protocol_data(gc);
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2415 char *tmp, *plain;
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2416 int ret = 1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2417 unsigned char format[1024];
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2418 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
2419 gint pos = 0;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2420 GData *attribs;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2421 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
2422
24747
498c6dda6e48 Fix two warnings introduced by the image patch I committed earlier and make
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24746
diff changeset
2423 if (msg == NULL || *msg == '\0') {
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2424 return 0;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2425 }
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2426
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2427 last = msg;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2428
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2429 /* 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
2430 /* TODO: Check formatting, too */
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2431 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
2432
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2433 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
2434 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
2435
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2436 do {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2437 PurpleStoredImage *image;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2438 const char *id;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2439
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2440 /* 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
2441 if(start - last) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2442 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
2443 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
2444 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2445
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2446 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
2447 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
2448 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
2449 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
2450 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
2451 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
2452 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
2453
31628
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2454 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
2455 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
2456 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
2457
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2458 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
2459 actformat.position = pos;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2460
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2461 actimage.unknown1 = 0x0109;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2462 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
2463 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
2464
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2465 if (actimage.size > 255000) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2466 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
2467 } else {
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2468 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
2469
339576876d0b Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31611
diff changeset
2470 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
2471 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
2472 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
2473 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
2474 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2475 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2476 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
2477 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2478
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2479 last = end + 1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2480 g_datalist_clear(&attribs);
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2481
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2482 } 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
2483
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2484 /* 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
2485 if(last && *last) {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2486 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
2487 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
2488 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2489
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2490 fmt.flag = 2;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2491 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
2492 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
2493
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2494 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
2495 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
2496 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
2497 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2498 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
2499 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
2500 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2501
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2502 /*
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2503 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
2504 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2505 tmp = g_strdup_printf("%s", plain);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30163
diff changeset
2506
24745
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2507 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
2508 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
2509 ret = -1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2510 } else {
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2511 ret = 1;
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2512 }
511df62cb366 Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents: 24683
diff changeset
2513 } else if (NULL == tmp || *tmp == 0) {
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2514 ret = 0;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2515 } else if (strlen(tmp) > GG_MSG_MAXSIZE) {
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2516 ret = -E2BIG;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2517 } else if (gg_send_message(info->session, GG_CLASS_CHAT,
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2518 ggp_str_to_uin(who), (unsigned char *)tmp) < 0) {
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2519 ret = -1;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2520 } else {
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2521 ret = 1;
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2522 }
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2523
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2524 g_free(plain);
11565
098117df202f [gaim-migrate @ 13831]
Bartosz Oler <bartosz@pidgin.im>
parents: 11545
diff changeset
2525 g_free(tmp);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2526
15287
be6664498b13 [gaim-migrate @ 18015]
Bartosz Oler <bartosz@pidgin.im>
parents: 15227
diff changeset
2527 return ret;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2528 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2529
31648
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2530 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
2531 {
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
2532 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
2533 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
2534
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2535 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
2536 return 1;
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2537
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2538 if (state == PURPLE_TYPING)
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2539 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
2540 else // PURPLE_NOT_TYPING
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2541 dummy_length = 0;
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 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
2544 info->session,
31648
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2545 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
2546 dummy_length);
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 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
2549 }
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2550
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2551 static void ggp_get_info(PurpleConnection *gc, const char *name)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2552 {
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
2553 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2554 GGPSearchForm *form;
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2555 guint32 seq;
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2556
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2557 form = ggp_search_form_new(GGP_SEARCH_TYPE_INFO);
12220
2eecc6f28334 [gaim-migrate @ 14522]
Bartosz Oler <bartosz@pidgin.im>
parents: 12216
diff changeset
2558
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2559 form->user_data = info;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2560 form->uin = g_strdup(name);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2561
13641
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2562 seq = ggp_search_start(gc, form);
1173f8ca3fbf [gaim-migrate @ 16038]
Bartosz Oler <bartosz@pidgin.im>
parents: 13627
diff changeset
2563 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
2564 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
2565 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2566
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2567 static int ggp_to_gg_status(PurpleStatus *status, char **msg)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2568 {
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2569 const char *status_id = purple_status_get_id(status);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2570 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
2571 const char *new_msg;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2572
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
2573 g_return_val_if_fail(msg != NULL, 0);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2574
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2575 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
2576 status_id);
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2577
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2578 if (strcmp(status_id, "available") == 0) {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2579 new_status = GG_STATUS_AVAIL;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2580 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
2581 } 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
2582 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
2583 new_status_descr = GG_STATUS_FFC_DESCR;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2584 } else if (strcmp(status_id, "away") == 0) {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2585 new_status = GG_STATUS_BUSY;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2586 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
2587 } 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
2588 new_status = GG_STATUS_DND;
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2589 new_status_descr = GG_STATUS_DND_DESCR;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2590 } else if (strcmp(status_id, "invisible") == 0) {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2591 new_status = GG_STATUS_INVISIBLE;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2592 new_status_descr = GG_STATUS_INVISIBLE_DESCR;
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2593 } else if (strcmp(status_id, "offline") == 0) {
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2594 new_status = GG_STATUS_NOT_AVAIL;
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2595 new_status_descr = GG_STATUS_NOT_AVAIL_DESCR;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2596 } else {
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2597 new_status = GG_STATUS_AVAIL;
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2598 new_status_descr = GG_STATUS_AVAIL_DESCR;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2599 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
2600 "ggp_set_status: unknown status requested (status_id=%s)\n",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2601 status_id);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2602 }
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4793
diff changeset
2603
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2604 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
2605
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2606 if(new_msg) {
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2607 /*
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2608 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
2609 *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
2610 g_free(tmp);
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2611 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2612 *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
2613
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2614 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
2615 } else {
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2616 *msg = NULL;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2617 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
2618 }
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2619 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2620
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2621 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
2622 {
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2623 PurpleConnection *gc;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2624 GGPInfo *info;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2625 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
2626 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
2627
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2628 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
2629 return;
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2630
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2631 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
2632 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
2633
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2634 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
2635
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
2636 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
2637 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
2638
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2639 if (new_msg == NULL) {
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2640 gg_change_status(info->session, new_status);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2641 } else {
23380
1f2dda5756b9 Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents: 23379
diff changeset
2642 gg_change_status_descr(info->session, new_status, new_msg);
12964
3b3d00bb141b [gaim-migrate @ 15317]
Bartosz Oler <bartosz@pidgin.im>
parents: 12961
diff changeset
2643 g_free(new_msg);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2644 }
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2645
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2646 ggp_status_fake_to_self(account);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2647
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2648 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2649
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32261
diff changeset
2650 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
2651 {
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2652 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
2653 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
2654 const gchar *name = purple_buddy_get_name(buddy);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2655
24939
d25fdf62ae92 moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24043
diff changeset
2656 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
2657
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2658 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
2659 if (strcmp(purple_account_get_username(account), name) == 0) {
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2660 ggp_status_fake_to_self(account);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
2661 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2662 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2663
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2664 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
2665 PurpleGroup *group)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2666 {
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
2667 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2668
24939
d25fdf62ae92 moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24043
diff changeset
2669 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
2670 }
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2671
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2672 static void ggp_join_chat(PurpleConnection *gc, GHashTable *data)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2673 {
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
2674 GGPInfo *info = purple_connection_get_protocol_data(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2675 GGPChat *chat;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2676 char *chat_name;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2677 GList *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2678 PurpleConversation *conv;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2679 PurpleAccount *account = purple_connection_get_account(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2680
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2681 chat_name = g_hash_table_lookup(data, "name");
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2682
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2683 if (chat_name == NULL)
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2684 return;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2685
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2686 purple_debug_info("gg", "joined %s chat\n", chat_name);
11394
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 for (l = info->chats; l != NULL; l = l->next) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2689 chat = l->data;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2690
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2691 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
2692 purple_notify_error(gc, _("Chat error"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2693 _("This chat name is already in use"), NULL);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2694 return;
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 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2697
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents: 11410
diff changeset
2698 ggp_confer_add_new(gc, chat_name);
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2699 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
2700 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
2701 purple_account_get_username(account), NULL,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2702 PURPLE_CBFLAGS_NONE, TRUE);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2703 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2704
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2705 static char *ggp_get_chat_name(GHashTable *data) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2706 return g_strdup(g_hash_table_lookup(data, "name"));
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2707 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2708
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2709 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
2710 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2711 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
2712 GGPInfo *info = purple_connection_get_protocol_data(gc);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2713 GGPChat *chat = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2714 GList *l;
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2715 /* char *msg, *plain; */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2716 gchar *msg;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2717 uin_t *uins;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2718 int count = 0;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2719
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2720 if ((conv = purple_find_chat(gc, id)) == NULL)
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2721 return -EINVAL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2722
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2723 for (l = info->chats; l != NULL; l = l->next) {
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2724 chat = l->data;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2725
32617
c74b4bd27e37 Use purple_conversation accessor methods.
Andrew Victor <andrew.victor@mxit.com>
parents: 32596
diff changeset
2726 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
2727 break;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2728 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2729
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2730 chat = NULL;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2731 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2732
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2733 if (chat == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2734 purple_debug_error("gg",
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2735 "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
2736 return -EINVAL;
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
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2739 uins = g_new0(uin_t, g_list_length(chat->participants));
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2740
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2741 for (l = chat->participants; l != NULL; l = l->next) {
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2742 uin_t uin = GPOINTER_TO_INT(l->data);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2743
12961
ee989777ce02 [gaim-migrate @ 15314]
Bartosz Oler <bartosz@pidgin.im>
parents: 12943
diff changeset
2744 uins[count++] = uin;
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2745 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2746
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2747 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2748 plain = purple_unescape_html(message);
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2749 msg = charset_convert(plain, "UTF-8", "CP1250");
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12143
diff changeset
2750 g_free(plain);
29824
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2751 */
9878119b5d78 Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents: 29404
diff changeset
2752 msg = purple_unescape_html(message);
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2753 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
2754 (unsigned char *)msg);
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2755 g_free(msg);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2756 g_free(uins);
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2757
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2758 serv_got_chat_in(gc, id,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2759 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
2760 flags, message, time(NULL));
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2761
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2762 return 0;
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2763 }
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2764
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2765 static void ggp_keepalive(PurpleConnection *gc)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2766 {
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
2767 GGPInfo *info = purple_connection_get_protocol_data(gc);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2768
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2769 /* purple_debug_info("gg", "Keeping connection alive....\n"); */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2770
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2771 if (gg_ping(info->session) < 0) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2772 purple_debug_info("gg", "Not connected to the server "
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2773 "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
2774 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 20437
diff changeset
2775 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
2776 _("Not connected to the server"));
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4793
diff changeset
2777 }
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2778 }
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2779
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2780 static void ggp_register_user(PurpleAccount *account)
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2781 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2782 PurpleConnection *gc = purple_account_get_connection(account);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2783
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2784 ggp_token_request(gc, ggp_register_user_dialog);
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2785 }
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2786
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2787 static GList *ggp_actions(PurplePlugin *plugin, gpointer context)
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2788 {
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2789 GList *m = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2790 PurplePluginAction *act;
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2791
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
2792 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
2793 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
2794 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
2795
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2796 act = purple_plugin_action_new(_("Find buddies..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2797 ggp_find_buddies);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2798 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2799
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
2800 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
2801 ggp_action_change_status_broadcasting);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2802 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2803
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2804 m = g_list_append(m, NULL);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2805
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2806 act = purple_plugin_action_new(_("Upload buddylist to Server"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2807 ggp_action_buddylist_put);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2808 m = g_list_append(m, act);
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2809
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2810 act = purple_plugin_action_new(_("Download buddylist from Server"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2811 ggp_action_buddylist_get);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2812 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2813
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2814 act = purple_plugin_action_new(_("Delete buddylist from Server"),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2815 ggp_action_buddylist_delete);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2816 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2817
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2818 act = purple_plugin_action_new(_("Save buddylist to file..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2819 ggp_action_buddylist_save);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2820 m = g_list_append(m, act);
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2821
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2822 act = purple_plugin_action_new(_("Load buddylist from file..."),
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2823 ggp_action_buddylist_load);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2824 m = g_list_append(m, act);
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2825
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2826 return m;
8775
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2827 }
6cb5dddaad4f [gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents: 8749
diff changeset
2828
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2829 static gboolean ggp_offline_message(const PurpleBuddy *buddy)
13298
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2830 {
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2831 return TRUE;
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2832 }
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2833
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2834 static PurplePluginProtocolInfo prpl_info =
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2835 {
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
2836 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
2837 OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE,
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2838 NULL, /* user_splits */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2839 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
2840 {"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
2841 ggp_list_icon, /* list_icon */
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2842 NULL, /* list_emblem */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2843 ggp_status_text, /* status_text */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2844 ggp_tooltip_text, /* tooltip_text */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2845 ggp_status_types, /* status_types */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2846 ggp_blist_node_menu, /* blist_node_menu */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2847 ggp_chat_info, /* chat_info */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2848 NULL, /* chat_info_defaults */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2849 ggp_login, /* login */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2850 ggp_close, /* close */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2851 ggp_send_im, /* send_im */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2852 NULL, /* set_info */
31648
03cb811f6382 This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31630
diff changeset
2853 ggp_send_typing, /* send_typing */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2854 ggp_get_info, /* get_info */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2855 ggp_set_status, /* set_away */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2856 NULL, /* set_idle */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2857 NULL, /* change_passwd */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2858 ggp_add_buddy, /* add_buddy */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2859 NULL, /* add_buddies */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2860 ggp_remove_buddy, /* remove_buddy */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2861 NULL, /* remove_buddies */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2862 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
2863 ggp_add_deny, /* add_deny */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2864 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
2865 ggp_rem_deny, /* rem_deny */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2866 NULL, /* set_permit_deny */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2867 ggp_join_chat, /* join_chat */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2868 NULL, /* reject_chat */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2869 ggp_get_chat_name, /* get_chat_name */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2870 NULL, /* chat_invite */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2871 NULL, /* chat_leave */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2872 NULL, /* chat_whisper */
11394
044b3779f027 [gaim-migrate @ 13625]
Bartosz Oler <bartosz@pidgin.im>
parents: 11360
diff changeset
2873 ggp_chat_send, /* chat_send */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2874 ggp_keepalive, /* keepalive */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2875 ggp_register_user, /* register_user */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2876 NULL, /* get_cb_info */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2877 NULL, /* alias_buddy */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2878 NULL, /* group_buddy */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2879 NULL, /* rename_group */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2880 NULL, /* buddy_free */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2881 NULL, /* convo_closed */
32652
9cf860cf65f2 Gadu-Gadu: function to normalize gg usernames
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32651
diff changeset
2882 ggp_normalize, /* normalize */
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2883 NULL, /* set_buddy_icon */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2884 NULL, /* remove_group */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2885 NULL, /* get_cb_real_name */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2886 NULL, /* set_chat_topic */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2887 NULL, /* find_blist_chat */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2888 NULL, /* roomlist_get_list */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2889 NULL, /* roomlist_cancel */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2890 NULL, /* roomlist_expand_category */
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
2891 NULL, /* can_receive_file */
12143
09f216663302 [gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents: 12007
diff changeset
2892 NULL, /* send_file */
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12595
diff changeset
2893 NULL, /* new_xfer */
13298
7a41e676010b [gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
2894 ggp_offline_message, /* offline_message */
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12595
diff changeset
2895 NULL, /* whiteboard_prpl_ops */
14604
67a7c42a8654 [gaim-migrate @ 17263]
Sean Egan <seanegan@pidgin.im>
parents: 14524
diff changeset
2896 NULL, /* send_raw */
15185
74b689a74430 [gaim-migrate @ 17909]
Nathan Walp <nwalp@pidgin.im>
parents: 15005
diff changeset
2897 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
2898 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
2899 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
2900 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
2901 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
2902 NULL, /* initiate_media */
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29182
diff changeset
2903 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
2904 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
2905 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
2906 NULL /* get_public_alias */
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2907 };
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2908
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2909 static PurplePluginInfo info = {
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2910 PURPLE_PLUGIN_MAGIC, /* magic */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2911 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
2912 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
2913 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
2914 NULL, /* ui_requirement */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2915 0, /* flags */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2916 NULL, /* dependencies */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2917 PURPLE_PRIORITY_DEFAULT, /* priority */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2918
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2919 "prpl-gg", /* id */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2920 "Gadu-Gadu", /* name */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2921 DISPLAY_VERSION, /* version */
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2922
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2923 N_("Gadu-Gadu Protocol Plugin"), /* summary */
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2924 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
2925 "boler@sourceforge.net", /* author */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2926 PURPLE_WEBSITE, /* homepage */
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2927
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2928 NULL, /* load */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2929 NULL, /* unload */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2930 NULL, /* destroy */
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2931
24746
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2932 NULL, /* ui_info */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2933 &prpl_info, /* extra_info */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2934 NULL, /* prefs_info */
ffee942a34b2 Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24745
diff changeset
2935 ggp_actions, /* actions */
16746
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2936
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2937 /* padding */
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2938 NULL,
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2939 NULL,
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2940 NULL,
72faf41c3c4f And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
2941 NULL
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
2942 };
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2943
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2944 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
2945 PurpleDebugLevel purple_level;
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2946 char *msg = g_strdup_vprintf(format, args);
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2947
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2948 /* 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
2949 * the purple ones */
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2950 switch (level) {
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2951 case GG_DEBUG_FUNCTION:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2952 purple_level = PURPLE_DEBUG_INFO;
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2953 break;
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2954 case GG_DEBUG_MISC:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2955 case GG_DEBUG_NET:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2956 case GG_DEBUG_DUMP:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2957 case GG_DEBUG_TRAFFIC:
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2958 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2959 purple_level = PURPLE_DEBUG_MISC;
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2960 break;
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2961 }
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2962
24683
3481a3320313 Backport the 'purple_debug_*(msg)' -> 'purple_debug_*("%s", msg);' fixes.
Richard Laager <rlaager@pidgin.im>
parents: 24569
diff changeset
2963 purple_debug(purple_level, "gg", "%s", msg);
11541
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2964 g_free(msg);
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2965 }
b1468184879c [gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents: 11538
diff changeset
2966
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2967 static void init_plugin(PurplePlugin *plugin)
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2968 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2969 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
2970 GList *encryption_options = NULL;
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2971
33295
c995c45e8ed9 Check result of ggp_resolver_purple_setup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33292
diff changeset
2972 purple_debug_info("gg", "Loading Gadu-Gadu protocol plugin with "
c995c45e8ed9 Check result of ggp_resolver_purple_setup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33292
diff changeset
2973 "libgadu %s...\n", gg_libgadu_version());
33287
79ed046bf275 Report libgadu version, remove unused variable.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32763
diff changeset
2974
27255
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2975 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
2976 "gg_server", "");
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2977 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
2978 option);
d2284774cfed Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents: 27197
diff changeset
2979
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
2980 #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
2981 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
2982 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
2983 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
2984 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
2985 }
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
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 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
2988 "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
2989 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
2990 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
2991
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
2992 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
2993 "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
2994 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
2995 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
2996
32651
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
2997 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
2998 "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
2999 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
3000 option);
cc247c37281e Gadu-Gadu: option to show links from strangers. Fixes #10591
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32650
diff changeset
3001
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
3002 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
3003
33291
b70ab10887a7 New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33287
diff changeset
3004 ggp_resolver_purple_setup();
2393
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3005 }
cfef0212506b [gaim-migrate @ 2406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3006
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
3007 PURPLE_INIT_PLUGIN(gg, init_plugin, info);
11360
b77fd5a8959a [gaim-migrate @ 13582]
Bartosz Oler <bartosz@pidgin.im>
parents: 11257
diff changeset
3008
12007
bf1190509b70 [gaim-migrate @ 14300]
Bartosz Oler <bartosz@pidgin.im>
parents: 11920
diff changeset
3009 /* vim: set ts=8 sts=0 sw=8 noet: */

mercurial