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