Mon, 13 Jun 2011 19:22:24 +0000
No more warnings when receiving Gadu-Gadu system messages - fixes #13914
| 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; |
| 12007 | 100 | GGPInfo *info = gc->proto_data; |
| 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 | ||
| 173 | info = gc->proto_data; | |
| 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; |
| 11360 | 202 | GGPInfo *info = gc->proto_data; |
| 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; |
| 11360 | 217 | GGPInfo *info = gc->proto_data; |
| 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; |
| 11360 | 238 | GGPInfo *info = gc->proto_data; |
| 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; |
| 11414 | 337 | GGPInfo *info = gc->proto_data; |
| 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') { | |
| 21279 | 357 | purple_connection_error_reason (gc, |
| 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) { | |
|
20437
6596f4984a50
Modify gadu-gadu to use purple_connection_error_reason. I'm not sure about
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
364 | purple_connection_error_reason (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) { |
| 21279 | 374 | purple_connection_error_reason (gc, |
| 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 | { |
|
df2f9bb3fd6e
[gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents:
11544
diff
changeset
|
418 | GGPInfo *info = gc->proto_data; |
| 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 | |
| 436 | GGPInfo *info = gc->proto_data; | |
| 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 | { |
| 486 | GGPInfo *info = gc->proto_data; | |
| 13641 | 487 | GGPSearchForm *form = user_data; |
| 488 | guint32 seq; | |
| 11414 | 489 | |
| 13641 | 490 | g_free(form->offset); |
| 491 | form->offset = g_strdup(form->last_uin); | |
| 492 | ||
| 493 | ggp_search_remove(info->searches, form->seq); | |
|
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
|
494 | purple_debug_info("gg", "ggp_callback_show_next(): Removed seq %u", form->seq); |
| 13641 | 495 | |
| 496 | seq = ggp_search_start(gc, form); | |
| 497 | 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
|
498 | purple_debug_info("gg", "ggp_callback_show_next(): Added seq %u", seq); |
| 11414 | 499 | } |
| 500 | ||
| 15884 | 501 | static void ggp_callback_add_buddy(PurpleConnection *gc, GList *row, gpointer user_data) |
| 11414 | 502 | { |
| 15884 | 503 | purple_blist_request_add_buddy(purple_connection_get_account(gc), |
| 12007 | 504 | g_list_nth_data(row, 0), NULL, NULL); |
| 11414 | 505 | } |
| 506 | ||
| 15884 | 507 | static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data) |
| 13642 | 508 | { |
| 15884 | 509 | PurpleAccount *account; |
| 510 | PurpleConversation *conv; | |
| 13642 | 511 | char *name; |
| 512 | ||
| 15884 | 513 | account = purple_connection_get_account(gc); |
| 13642 | 514 | |
| 515 | name = g_list_nth_data(row, 0); | |
| 15884 | 516 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
| 517 | purple_conversation_present(conv); | |
| 13642 | 518 | } |
| 519 | ||
| 15884 | 520 | static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) |
| 11414 | 521 | { |
| 522 | GGPInfo *info = gc->proto_data; | |
| 523 | GGPSearchForm *form; | |
| 13641 | 524 | guint32 seq; |
| 11414 | 525 | |
| 13641 | 526 | form = ggp_search_form_new(GGP_SEARCH_TYPE_FULL); |
| 11414 | 527 | |
| 13641 | 528 | form->user_data = info; |
| 12007 | 529 | form->lastname = charset_convert( |
| 15884 | 530 | purple_request_fields_get_string(fields, "lastname"), |
| 12007 | 531 | "UTF-8", "CP1250"); |
| 532 | form->firstname = charset_convert( | |
| 15884 | 533 | purple_request_fields_get_string(fields, "firstname"), |
| 12007 | 534 | "UTF-8", "CP1250"); |
| 535 | form->nickname = charset_convert( | |
| 15884 | 536 | purple_request_fields_get_string(fields, "nickname"), |
| 12007 | 537 | "UTF-8", "CP1250"); |
| 538 | form->city = charset_convert( | |
| 15884 | 539 | purple_request_fields_get_string(fields, "city"), |
| 12007 | 540 | "UTF-8", "CP1250"); |
| 541 | form->birthyear = charset_convert( | |
| 15884 | 542 | purple_request_fields_get_string(fields, "year"), |
| 12007 | 543 | "UTF-8", "CP1250"); |
| 11414 | 544 | |
| 15884 | 545 | switch (purple_request_fields_get_choice(fields, "gender")) { |
| 11414 | 546 | case 1: |
| 547 | form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE); | |
| 548 | break; | |
| 549 | case 2: | |
| 550 | form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE); | |
| 551 | break; | |
| 552 | default: | |
| 553 | form->gender = NULL; | |
| 554 | break; | |
| 555 | } | |
| 556 | ||
| 15884 | 557 | form->active = purple_request_fields_get_bool(fields, "active") |
| 11414 | 558 | ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL; |
| 559 | ||
| 560 | form->offset = g_strdup("0"); | |
| 561 | ||
| 13641 | 562 | seq = ggp_search_start(gc, form); |
| 563 | 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
|
564 | purple_debug_info("gg", "ggp_callback_find_buddies(): Added seq %u", seq); |
| 11414 | 565 | } |
| 566 | ||
| 15884 | 567 | static void ggp_find_buddies(PurplePluginAction *action) |
| 11414 | 568 | { |
| 15884 | 569 | PurpleConnection *gc = (PurpleConnection *)action->context; |
| 11414 | 570 | |
| 15884 | 571 | PurpleRequestFields *fields; |
| 572 | PurpleRequestFieldGroup *group; | |
| 573 | PurpleRequestField *field; | |
| 11414 | 574 | |
| 15884 | 575 | fields = purple_request_fields_new(); |
| 576 | group = purple_request_field_group_new(NULL); | |
| 577 | purple_request_fields_add_group(fields, group); | |
| 11414 | 578 | |
| 15884 | 579 | field = purple_request_field_string_new("lastname", |
| 12007 | 580 | _("Last 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("firstname", |
| 12007 | 585 | _("First name"), 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("nickname", |
| 12007 | 590 | _("Nickname"), 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("city", |
| 12007 | 595 | _("City"), NULL, FALSE); |
| 15884 | 596 | purple_request_field_string_set_masked(field, FALSE); |
| 597 | purple_request_field_group_add_field(group, field); | |
| 11414 | 598 | |
| 15884 | 599 | field = purple_request_field_string_new("year", |
| 12007 | 600 | _("Year of birth"), NULL, FALSE); |
| 15884 | 601 | purple_request_field_group_add_field(group, field); |
| 11414 | 602 | |
| 15884 | 603 | field = purple_request_field_choice_new("gender", _("Gender"), 0); |
| 604 | purple_request_field_choice_add(field, _("Male or female")); | |
| 605 | purple_request_field_choice_add(field, _("Male")); | |
| 606 | purple_request_field_choice_add(field, _("Female")); | |
| 607 | purple_request_field_group_add_field(group, field); | |
| 11414 | 608 | |
| 15884 | 609 | field = purple_request_field_bool_new("active", |
| 12007 | 610 | _("Only online"), FALSE); |
| 15884 | 611 | purple_request_field_group_add_field(group, field); |
| 11414 | 612 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
613 | purple_request_fields(gc, |
| 11414 | 614 | _("Find buddies"), |
| 615 | _("Find buddies"), | |
| 616 | _("Please, enter your search criteria below"), | |
| 617 | fields, | |
| 618 | _("OK"), G_CALLBACK(ggp_callback_find_buddies), | |
| 619 | _("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
|
620 | purple_connection_get_account(gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
621 | gc); |
| 11414 | 622 | } |
| 623 | ||
| 624 | /* ----- CHANGE PASSWORD ------------------------------------------------ */ | |
| 625 | ||
| 15884 | 626 | static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) |
| 2393 | 627 | { |
| 15884 | 628 | PurpleAccount *account; |
| 11360 | 629 | GGPInfo *info = gc->proto_data; |
| 630 | struct gg_http *h; | |
| 631 | gchar *cur, *p1, *p2, *t; | |
| 632 | ||
| 12007 | 633 | cur = charset_convert( |
| 15884 | 634 | purple_request_fields_get_string(fields, "password_cur"), |
| 12007 | 635 | "UTF-8", "CP1250"); |
| 636 | p1 = charset_convert( | |
| 15884 | 637 | purple_request_fields_get_string(fields, "password1"), |
| 12007 | 638 | "UTF-8", "CP1250"); |
| 639 | p2 = charset_convert( | |
| 15884 | 640 | purple_request_fields_get_string(fields, "password2"), |
| 12007 | 641 | "UTF-8", "CP1250"); |
| 642 | t = charset_convert( | |
| 15884 | 643 | purple_request_fields_get_string(fields, "token"), |
| 12007 | 644 | "UTF-8", "CP1250"); |
| 11360 | 645 | |
| 15884 | 646 | account = purple_connection_get_account(gc); |
| 11360 | 647 | |
| 648 | if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL || | |
| 649 | *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { | |
| 15884 | 650 | purple_notify_error(account, NULL, _("Fill in the fields."), NULL); |
| 11360 | 651 | goto exit_err; |
| 652 | } | |
| 653 | ||
| 654 | if (g_utf8_collate(p1, p2) != 0) { | |
| 15884 | 655 | purple_notify_error(account, NULL, |
| 12007 | 656 | _("New passwords do not match."), NULL); |
| 11360 | 657 | goto exit_err; |
| 658 | } | |
| 2393 | 659 | |
| 15884 | 660 | if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) { |
| 661 | purple_notify_error(account, NULL, | |
| 11360 | 662 | _("Your current password is different from the one that you specified."), |
| 663 | NULL); | |
| 664 | goto exit_err; | |
| 665 | } | |
| 666 | ||
| 15884 | 667 | purple_debug_info("gg", "Changing password\n"); |
| 11360 | 668 | |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23295
diff
changeset
|
669 | /* XXX: this email should be a pref... */ |
| 11360 | 670 | h = gg_change_passwd4(ggp_get_uin(account), |
| 15884 | 671 | "user@example.net", purple_account_get_password(account), |
| 12007 | 672 | p1, info->token->id, t, 0); |
| 2393 | 673 | |
| 11360 | 674 | if (h == NULL) { |
| 15884 | 675 | purple_notify_error(account, NULL, |
| 14754 | 676 | _("Unable to change password. Error occurred.\n"), |
| 11360 | 677 | NULL); |
| 678 | goto exit_err; | |
| 679 | } | |
| 680 | ||
| 15884 | 681 | purple_account_set_password(account, p1); |
| 11360 | 682 | |
| 683 | gg_change_passwd_free(h); | |
| 684 | ||
| 15884 | 685 | purple_notify_info(account, _("Change password for the Gadu-Gadu account"), |
| 11360 | 686 | _("Password was changed successfully!"), NULL); |
| 687 | ||
| 688 | exit_err: | |
| 689 | g_free(cur); | |
| 690 | g_free(p1); | |
| 691 | g_free(p2); | |
| 692 | g_free(t); | |
| 12007 | 693 | g_free(info->token->id); |
| 694 | g_free(info->token->data); | |
| 695 | g_free(info->token); | |
| 696 | } | |
| 697 | ||
| 15884 | 698 | static void ggp_change_passwd_dialog(PurpleConnection *gc) |
| 12007 | 699 | { |
| 15884 | 700 | PurpleRequestFields *fields; |
| 701 | PurpleRequestFieldGroup *group; | |
| 702 | PurpleRequestField *field; | |
| 12007 | 703 | |
| 704 | GGPInfo *info = gc->proto_data; | |
| 705 | GGPToken *token = info->token; | |
| 706 | ||
| 707 | char *msg; | |
| 708 | ||
| 709 | ||
| 15884 | 710 | fields = purple_request_fields_new(); |
| 711 | group = purple_request_field_group_new(NULL); | |
| 712 | purple_request_fields_add_group(fields, group); | |
| 12007 | 713 | |
| 15884 | 714 | field = purple_request_field_string_new("password_cur", |
| 12007 | 715 | _("Current password"), "", FALSE); |
| 15884 | 716 | purple_request_field_string_set_masked(field, TRUE); |
| 717 | purple_request_field_group_add_field(group, field); | |
| 12007 | 718 | |
| 15884 | 719 | field = purple_request_field_string_new("password1", |
| 12007 | 720 | _("Password"), "", FALSE); |
| 15884 | 721 | purple_request_field_string_set_masked(field, TRUE); |
| 722 | purple_request_field_group_add_field(group, field); | |
| 12007 | 723 | |
| 15884 | 724 | field = purple_request_field_string_new("password2", |
| 12007 | 725 | _("Password (retype)"), "", FALSE); |
| 15884 | 726 | purple_request_field_string_set_masked(field, TRUE); |
| 727 | purple_request_field_group_add_field(group, field); | |
| 12007 | 728 | |
| 15884 | 729 | field = purple_request_field_string_new("token", |
| 12007 | 730 | _("Enter current token"), "", FALSE); |
| 15884 | 731 | purple_request_field_string_set_masked(field, FALSE); |
| 732 | purple_request_field_group_add_field(group, field); | |
| 12007 | 733 | |
| 734 | /* original size: 60x24 */ | |
| 15884 | 735 | field = purple_request_field_image_new("token_img", |
| 12007 | 736 | _("Current token"), token->data, token->size); |
| 15884 | 737 | purple_request_field_group_add_field(group, field); |
| 12007 | 738 | |
| 739 | msg = g_strdup_printf("%s %d", | |
| 740 | _("Please, enter your current password and your new password for UIN: "), | |
| 15884 | 741 | ggp_get_uin(purple_connection_get_account(gc))); |
| 12007 | 742 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
743 | purple_request_fields(gc, |
| 12007 | 744 | _("Change Gadu-Gadu Password"), |
| 745 | _("Change Gadu-Gadu Password"), | |
| 746 | msg, | |
| 747 | 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
|
748 | _("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
|
749 | purple_connection_get_account(gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
750 | gc); |
| 12007 | 751 | |
| 752 | g_free(msg); | |
| 11360 | 753 | } |
| 2393 | 754 | |
| 15884 | 755 | static void ggp_change_passwd(PurplePluginAction *action) |
| 11360 | 756 | { |
| 15884 | 757 | PurpleConnection *gc = (PurpleConnection *)action->context; |
| 11360 | 758 | |
| 12007 | 759 | ggp_token_request(gc, ggp_change_passwd_dialog); |
| 11360 | 760 | } |
| 761 | ||
|
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
|
762 | /* ----- 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
|
763 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
764 | 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
|
765 | { |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
766 | GGPInfo *info = gc->proto_data; |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
767 | 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
|
768 | 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
|
769 | 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
|
770 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
771 | 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
|
772 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
773 | 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
|
774 | 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
|
775 | 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
|
776 | 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
|
777 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
778 | 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
|
779 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
780 | 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
|
781 | } |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
782 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
783 | 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
|
784 | { |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
785 | PurpleConnection *gc = (PurpleConnection *)action->context; |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
786 | GGPInfo *info = gc->proto_data; |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
787 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
788 | 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
|
789 | 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
|
790 | 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
|
791 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
792 | 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
|
793 | 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
|
794 | 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
|
795 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
796 | 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
|
797 | 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
|
798 | 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
|
799 | 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
|
800 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
801 | 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
|
802 | 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
|
803 | 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
|
804 | 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
|
805 | |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
806 | 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
|
807 | _("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
|
808 | _("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
|
809 | _("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
|
810 | 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
|
811 | _("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
|
812 | _("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
|
813 | 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
|
814 | 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
|
815 | } |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
816 | |
| 11414 | 817 | /* ----- CONFERENCES ---------------------------------------------------- */ |
| 818 | ||
|
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
|
819 | static void ggp_callback_add_to_chat_ok(PurpleBuddy *buddy, PurpleRequestFields *fields) |
| 11394 | 820 | { |
|
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
|
821 | PurpleConnection *conn; |
| 15884 | 822 | 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
|
823 | GList *sel; |
| 11394 | 824 | |
|
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
|
825 | 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
|
826 | |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
827 | 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
|
828 | |
| 15884 | 829 | field = purple_request_fields_get_field(fields, "name"); |
| 830 | sel = purple_request_field_list_get_selected(field); | |
| 11394 | 831 | |
|
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
|
832 | 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
|
833 | 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
|
834 | 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
|
835 | } |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
836 | |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
837 | 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
|
838 | ggp_str_to_uin(purple_buddy_get_name(buddy))); |
| 11394 | 839 | } |
| 840 | ||
| 15884 | 841 | static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) |
| 11394 | 842 | { |
| 15884 | 843 | PurpleBuddy *buddy; |
| 844 | PurpleConnection *gc; | |
| 11394 | 845 | GGPInfo *info; |
| 846 | ||
| 15884 | 847 | PurpleRequestFields *fields; |
| 848 | PurpleRequestFieldGroup *group; | |
| 849 | PurpleRequestField *field; | |
| 11394 | 850 | |
| 851 | GList *l; | |
| 852 | gchar *msg; | |
| 853 | ||
| 15884 | 854 | buddy = (PurpleBuddy *)node; |
| 855 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | |
| 11394 | 856 | info = gc->proto_data; |
| 857 | ||
| 15884 | 858 | fields = purple_request_fields_new(); |
| 859 | group = purple_request_field_group_new(NULL); | |
| 860 | purple_request_fields_add_group(fields, group); | |
| 11394 | 861 | |
| 15884 | 862 | field = purple_request_field_list_new("name", "Chat name"); |
| 11394 | 863 | for (l = info->chats; l != NULL; l = l->next) { |
| 864 | GGPChat *chat = l->data; | |
|
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
|
865 | purple_request_field_list_add(field, chat->name, chat->name); |
| 11394 | 866 | } |
| 15884 | 867 | purple_request_field_group_add_field(group, field); |
| 11394 | 868 | |
| 12007 | 869 | msg = g_strdup_printf(_("Select a chat for buddy: %s"), |
| 15884 | 870 | purple_buddy_get_alias(buddy)); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
871 | purple_request_fields(gc, |
| 11394 | 872 | _("Add to chat..."), |
| 873 | _("Add to chat..."), | |
| 874 | msg, | |
| 875 | fields, | |
| 876 | _("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
|
877 | _("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
|
878 | 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
|
879 | buddy); |
| 11394 | 880 | g_free(msg); |
| 881 | } | |
| 882 | ||
| 11414 | 883 | /* ----- BLOCK BUDDIES -------------------------------------------------- */ |
| 884 | ||
| 15884 | 885 | static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) |
| 11410 | 886 | { |
| 15884 | 887 | PurpleConnection *gc; |
| 888 | PurpleBuddy *buddy; | |
| 11410 | 889 | GGPInfo *info; |
| 890 | uin_t uin; | |
| 891 | ||
| 15884 | 892 | buddy = (PurpleBuddy *)node; |
| 893 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | |
| 11410 | 894 | info = gc->proto_data; |
| 895 | ||
| 15884 | 896 | uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); |
| 11410 | 897 | |
| 15884 | 898 | if (purple_blist_node_get_bool(node, "blocked")) { |
| 899 | purple_blist_node_set_bool(node, "blocked", FALSE); | |
| 11410 | 900 | gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); |
| 901 | gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); | |
| 15884 | 902 | purple_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin); |
| 11410 | 903 | } else { |
| 15884 | 904 | purple_blist_node_set_bool(node, "blocked", TRUE); |
| 11410 | 905 | gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); |
| 906 | gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); | |
| 15884 | 907 | purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); |
| 11410 | 908 | } |
| 909 | } | |
| 910 | ||
| 11360 | 911 | /* ---------------------------------------------------------------------- */ |
| 11414 | 912 | /* ----- INTERNAL CALLBACKS --------------------------------------------- */ |
| 913 | /* ---------------------------------------------------------------------- */ | |
| 914 | ||
|
27388
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
915 | struct gg_fetch_avatar_data |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
916 | { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
917 | PurpleConnection *gc; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
918 | gchar *uin; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
919 | gchar *avatar_url; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
920 | }; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
921 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
922 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
923 | 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
|
924 | 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
|
925 | 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
|
926 | PurpleAccount *account; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
927 | PurpleBuddy *buddy; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
928 | gpointer buddy_icon_data; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
929 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
930 | /* FIXME: This shouldn't be necessary */ |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
931 | if (!PURPLE_CONNECTION_IS_VALID(d->gc)) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
932 | g_free(d->uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
933 | g_free(d->avatar_url); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
934 | g_free(d); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
935 | g_return_if_reached(); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
936 | } |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
937 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
938 | account = purple_connection_get_account(d->gc); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
939 | buddy = purple_find_buddy(account, d->uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
940 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
941 | if (buddy == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
942 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
943 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
944 | buddy_icon_data = g_memdup(data, len); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
945 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
946 | 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
|
947 | buddy_icon_data, len, d->avatar_url); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
948 | purple_debug_info("gg", "UIN: %s should have avatar now\n", d->uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
949 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
950 | out: |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
951 | g_free(d->uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
952 | g_free(d->avatar_url); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
953 | g_free(d); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
954 | } |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
955 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
956 | 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
|
957 | 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
|
958 | struct gg_fetch_avatar_data *data; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
959 | PurpleConnection *gc = user_data; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
960 | PurpleAccount *account; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
961 | PurpleBuddy *buddy; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
962 | const char *uin; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
963 | const char *is_blank; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
964 | const char *checksum; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
965 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
966 | gchar *bigavatar = NULL; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
967 | xmlnode *xml = NULL; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
968 | xmlnode *xmlnode_users; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
969 | xmlnode *xmlnode_user; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
970 | xmlnode *xmlnode_avatars; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
971 | xmlnode *xmlnode_avatar; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
972 | xmlnode *xmlnode_bigavatar; |
|
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 | 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
|
975 | account = purple_connection_get_account(gc); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
976 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
977 | if (error_message != NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
978 | 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
|
979 | 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
|
980 | xml = xmlnode_from_str(url_text, -1); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
981 | if (xml == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
982 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
983 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
984 | xmlnode_users = xmlnode_get_child(xml, "users"); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
985 | if (xmlnode_users == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
986 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
987 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
988 | 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
|
989 | if (xmlnode_user == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
990 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
991 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
992 | uin = xmlnode_get_attrib(xmlnode_user, "uin"); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
993 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
994 | 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
|
995 | if (xmlnode_avatars == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
996 | goto out; |
|
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 | 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
|
999 | if (xmlnode_avatar == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1000 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1001 | |
|
29182
f11475f964ac
Fix Gadu-Gadu avatars. The server's response format has changed. Fixes #11050.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27642
diff
changeset
|
1002 | 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
|
1003 | if (xmlnode_bigavatar == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1004 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1005 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1006 | 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
|
1007 | bigavatar = xmlnode_get_data(xmlnode_bigavatar); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1008 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1009 | 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
|
1010 | "URL %s\n", |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1011 | 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
|
1012 | bigavatar ? bigavatar : "(null)"); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1013 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1014 | if (uin != NULL && bigavatar != NULL) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1015 | buddy = purple_find_buddy(account, uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1016 | if (buddy == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1017 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1018 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1019 | 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
|
1020 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1021 | if (purple_strequal(is_blank, "1")) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1022 | purple_buddy_icons_set_for_user(account, |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1023 | 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
|
1024 | } else if (!purple_strequal(checksum, bigavatar)) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1025 | 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
|
1026 | data->gc = gc; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1027 | data->uin = g_strdup(uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1028 | data->avatar_url = g_strdup(bigavatar); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1029 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1030 | url_data = purple_util_fetch_url_request_len_with_account(account, |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1031 | 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
|
1032 | 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
|
1033 | } |
|
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 | } |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1036 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1037 | out: |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1038 | if (xml) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1039 | xmlnode_free(xml); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1040 | g_free(bigavatar); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1041 | } |
| 12964 | 1042 | |
| 11414 | 1043 | /** |
|
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
|
1044 | * 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
|
1045 | * |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1046 | * @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
|
1047 | * @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
|
1048 | */ |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1049 | 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
|
1050 | { |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1051 | 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
|
1052 | 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
|
1053 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1054 | 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
|
1055 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1056 | 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
|
1057 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1058 | url_data = purple_util_fetch_url_request_len_with_account( |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1059 | 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
|
1060 | "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
|
1061 | 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
|
1062 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1063 | 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
|
1064 | } |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1065 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1066 | /** |
| 11414 | 1067 | * Handle change of the status of the buddy. |
| 1068 | * | |
| 15884 | 1069 | * @param gc PurpleConnection |
| 11414 | 1070 | * @param uin UIN of the buddy. |
| 1071 | * @param status ID of the status. | |
| 1072 | * @param descr Description. | |
| 1073 | */ | |
| 15884 | 1074 | static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, |
| 12007 | 1075 | int status, const char *descr) |
| 11414 | 1076 | { |
| 1077 | gchar *from; | |
| 1078 | const char *st; | |
|
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
|
1079 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1080 | ggp_update_buddy_avatar(gc, uin); |
|
27388
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 | from = g_strdup_printf("%u", uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1083 | |
| 11414 | 1084 | switch (status) { |
| 1085 | case GG_STATUS_NOT_AVAIL: | |
| 1086 | 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
|
1087 | 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
|
1088 | break; |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1089 | case GG_STATUS_FFC: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1090 | case GG_STATUS_FFC_DESCR: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1091 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); |
| 11414 | 1092 | break; |
| 1093 | case GG_STATUS_AVAIL: | |
| 1094 | 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
|
1095 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); |
| 11414 | 1096 | break; |
| 1097 | case GG_STATUS_BUSY: | |
| 1098 | 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
|
1099 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AWAY); |
| 11414 | 1100 | break; |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1101 | case GG_STATUS_DND: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1102 | case GG_STATUS_DND_DESCR: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1103 | 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
|
1104 | break; |
| 11414 | 1105 | case GG_STATUS_BLOCKED: |
| 1106 | /* user is blocking us.... */ | |
| 1107 | st = "blocked"; | |
| 1108 | break; | |
| 1109 | default: | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1110 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); |
| 15884 | 1111 | purple_debug_info("gg", |
| 12007 | 1112 | "GG_EVENT_NOTIFY: Unknown status: %d\n", status); |
| 11414 | 1113 | break; |
| 1114 | } | |
| 1115 | ||
| 15884 | 1116 | purple_debug_info("gg", "st = %s\n", st); |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1117 | //msg = charset_convert(descr, "CP1250", "UTF-8"); |
|
30006
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1118 | if (descr == NULL) { |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1119 | purple_prpl_got_user_status(purple_connection_get_account(gc), |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1120 | from, st, NULL); |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1121 | } else { |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1122 | purple_prpl_got_user_status(purple_connection_get_account(gc), |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1123 | from, st, "message", descr, NULL); |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1124 | } |
| 11414 | 1125 | g_free(from); |
| 1126 | } | |
| 1127 | ||
| 13643 | 1128 | static void ggp_sr_close_cb(gpointer user_data) |
| 12220 | 1129 | { |
| 13643 | 1130 | GGPSearchForm *form = user_data; |
| 13641 | 1131 | GGPInfo *info = form->user_data; |
| 12220 | 1132 | |
| 13641 | 1133 | ggp_search_remove(info->searches, form->seq); |
|
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
|
1134 | purple_debug_info("gg", "ggp_sr_close_cb(): Removed seq %u", form->seq); |
| 13641 | 1135 | ggp_search_form_destroy(form); |
| 12220 | 1136 | } |
| 1137 | ||
| 13645 | 1138 | /** |
| 1139 | * Translate a status' ID to a more user-friendly name. | |
| 1140 | * | |
| 1141 | * @param id The ID of the status. | |
| 1142 | * | |
| 1143 | * @return The user-friendly name of the status. | |
| 1144 | */ | |
| 1145 | static const char *ggp_status_by_id(unsigned int id) | |
| 1146 | { | |
| 1147 | const char *st; | |
| 1148 | ||
| 15884 | 1149 | purple_debug_info("gg", "ggp_status_by_id: %d\n", id); |
| 13645 | 1150 | switch (id) { |
| 1151 | 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
|
1152 | case GG_STATUS_NOT_AVAIL_DESCR: |
| 13645 | 1153 | st = _("Offline"); |
| 1154 | break; | |
| 1155 | 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
|
1156 | case GG_STATUS_AVAIL_DESCR: |
| 13645 | 1157 | st = _("Available"); |
| 1158 | break; | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1159 | case GG_STATUS_FFC: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1160 | case GG_STATUS_FFC_DESCR: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1161 | return _("Chatty"); |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1162 | case GG_STATUS_DND: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1163 | case GG_STATUS_DND_DESCR: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1164 | return _("Do Not Disturb"); |
| 13645 | 1165 | 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
|
1166 | case GG_STATUS_BUSY_DESCR: |
| 13645 | 1167 | st = _("Away"); |
| 1168 | break; | |
| 1169 | default: | |
| 1170 | st = _("Unknown"); | |
| 1171 | break; | |
| 1172 | } | |
| 1173 | ||
| 1174 | return st; | |
| 1175 | } | |
| 1176 | ||
| 15884 | 1177 | static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, |
| 13643 | 1178 | GGPSearchForm *form) |
| 12007 | 1179 | { |
| 15884 | 1180 | PurpleNotifyUserInfo *user_info; |
| 1181 | PurpleBuddy *buddy; | |
| 13643 | 1182 | char *val, *who; |
| 1183 | ||
| 15884 | 1184 | user_info = purple_notify_user_info_new(); |
| 13643 | 1185 | |
| 1186 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS); | |
| 13645 | 1187 | /* XXX: Use of ggp_str_to_uin() is an ugly hack! */ |
| 15884 | 1188 | purple_notify_user_info_add_pair(user_info, _("Status"), ggp_status_by_id(ggp_str_to_uin(val))); |
| 13643 | 1189 | g_free(val); |
| 1190 | ||
| 1191 | who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN); | |
| 15884 | 1192 | purple_notify_user_info_add_pair(user_info, _("UIN"), who); |
| 13643 | 1193 | |
| 1194 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME); | |
| 15884 | 1195 | purple_notify_user_info_add_pair(user_info, _("First Name"), val); |
| 13643 | 1196 | g_free(val); |
| 1197 | ||
| 1198 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME); | |
| 15884 | 1199 | purple_notify_user_info_add_pair(user_info, _("Nickname"), val); |
| 13643 | 1200 | g_free(val); |
| 1201 | ||
| 1202 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY); | |
| 15884 | 1203 | purple_notify_user_info_add_pair(user_info, _("City"), val); |
| 13643 | 1204 | g_free(val); |
| 1205 | ||
| 1206 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR); | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1207 | if (strncmp(val, "0", 1)) { |
| 15884 | 1208 | purple_notify_user_info_add_pair(user_info, _("Birth Year"), val); |
| 13643 | 1209 | } |
| 1210 | g_free(val); | |
| 1211 | ||
| 15294 | 1212 | /* |
| 1213 | * Include a status message, if exists and buddy is in the blist. | |
| 1214 | */ | |
| 15884 | 1215 | buddy = purple_find_buddy(purple_connection_get_account(gc), who); |
| 15294 | 1216 | if (NULL != buddy) { |
| 15884 | 1217 | PurpleStatus *status; |
| 15294 | 1218 | const char *msg; |
| 1219 | char *text; | |
| 13643 | 1220 | |
| 15884 | 1221 | status = purple_presence_get_active_status(purple_buddy_get_presence(buddy)); |
| 1222 | msg = purple_status_get_attr_string(status, "message"); | |
| 13643 | 1223 | |
| 15294 | 1224 | if (msg != NULL) { |
| 1225 | text = g_markup_escape_text(msg, -1); | |
| 15884 | 1226 | purple_notify_user_info_add_pair(user_info, _("Message"), text); |
| 15294 | 1227 | g_free(text); |
| 1228 | } | |
| 1229 | } | |
| 1230 | ||
|
18629
9e78088bfc46
Close temporary Get Info window when showing the real one. Fixes #1720.
Bartosz Oler <bartosz@pidgin.im>
parents:
18190
diff
changeset
|
1231 | purple_notify_userinfo(gc, who, user_info, ggp_sr_close_cb, form); |
| 15294 | 1232 | g_free(who); |
| 15884 | 1233 | purple_notify_user_info_destroy(user_info); |
| 13643 | 1234 | } |
| 1235 | ||
| 15884 | 1236 | static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, |
| 13643 | 1237 | GGPSearchForm *form) |
| 1238 | { | |
| 15884 | 1239 | PurpleNotifySearchResults *results; |
| 1240 | PurpleNotifySearchColumn *column; | |
| 13643 | 1241 | int res_count; |
| 12007 | 1242 | int start; |
| 1243 | int i; | |
| 13641 | 1244 | |
| 13643 | 1245 | g_return_if_fail(form != NULL); |
| 12007 | 1246 | |
| 1247 | res_count = gg_pubdir50_count(req); | |
| 13643 | 1248 | res_count = (res_count > PUBDIR_RESULTS_MAX) ? PUBDIR_RESULTS_MAX : res_count; |
| 12007 | 1249 | |
| 15884 | 1250 | results = purple_notify_searchresults_new(); |
| 12007 | 1251 | |
| 12257 | 1252 | if (results == NULL) { |
| 15884 | 1253 | purple_debug_error("gg", "ggp_pubdir_reply_handler: " |
| 12257 | 1254 | "Unable to display the search results.\n"); |
| 15884 | 1255 | purple_notify_error(gc, NULL, |
| 12257 | 1256 | _("Unable to display the search results."), |
| 1257 | NULL); | |
| 13641 | 1258 | ggp_sr_close_cb(form); |
| 12257 | 1259 | return; |
| 1260 | } | |
| 1261 | ||
| 15884 | 1262 | column = purple_notify_searchresults_column_new(_("UIN")); |
| 1263 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1264 | |
| 15884 | 1265 | column = purple_notify_searchresults_column_new(_("First Name")); |
| 1266 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1267 | |
| 15884 | 1268 | column = purple_notify_searchresults_column_new(_("Nickname")); |
| 1269 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1270 | |
| 15884 | 1271 | column = purple_notify_searchresults_column_new(_("City")); |
| 1272 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1273 | |
| 15884 | 1274 | column = purple_notify_searchresults_column_new(_("Birth Year")); |
| 1275 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1276 | |
| 15884 | 1277 | purple_debug_info("gg", "Going with %d entries\n", res_count); |
| 12007 | 1278 | |
| 1279 | start = (int)ggp_str_to_uin(gg_pubdir50_get(req, 0, GG_PUBDIR50_START)); | |
| 15884 | 1280 | purple_debug_info("gg", "start = %d\n", start); |
| 12007 | 1281 | |
| 1282 | for (i = 0; i < res_count; i++) { | |
| 1283 | GList *row = NULL; | |
| 1284 | char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR); | |
| 1285 | ||
| 1286 | /* TODO: Status will be displayed as an icon. */ | |
| 1287 | /* row = g_list_append(row, ggp_search_get_result(req, i, GG_PUBDIR50_STATUS)); */ | |
| 1288 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1289 | GG_PUBDIR50_UIN)); | |
| 1290 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1291 | GG_PUBDIR50_FIRSTNAME)); | |
| 1292 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1293 | GG_PUBDIR50_NICKNAME)); | |
| 1294 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1295 | GG_PUBDIR50_CITY)); | |
| 1296 | row = g_list_append(row, | |
| 1297 | (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-")); | |
| 1298 | ||
| 15884 | 1299 | purple_notify_searchresults_row_add(results, row); |
| 12007 | 1300 | |
| 1301 | if (i == res_count - 1) { | |
| 13641 | 1302 | g_free(form->last_uin); |
| 1303 | form->last_uin = ggp_search_get_result(req, i, GG_PUBDIR50_UIN); | |
| 12007 | 1304 | } |
| 1305 | } | |
| 1306 | ||
| 15884 | 1307 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_CONTINUE, |
| 12007 | 1308 | ggp_callback_show_next); |
| 15884 | 1309 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, |
| 12007 | 1310 | ggp_callback_add_buddy); |
| 15884 | 1311 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_IM, |
| 13642 | 1312 | ggp_callback_im); |
| 13643 | 1313 | |
| 13641 | 1314 | if (form->window == NULL) { |
| 15884 | 1315 | void *h = purple_notify_searchresults(gc, |
| 12007 | 1316 | _("Gadu-Gadu Public Directory"), |
| 12220 | 1317 | _("Search results"), NULL, results, |
| 15884 | 1318 | (PurpleNotifyCloseCallback)ggp_sr_close_cb, |
| 13641 | 1319 | form); |
| 12257 | 1320 | |
|
12277
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1321 | if (h == NULL) { |
| 15884 | 1322 | purple_debug_error("gg", "ggp_pubdir_reply_handler: " |
|
12277
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1323 | "Unable to display the search results.\n"); |
| 15884 | 1324 | purple_notify_error(gc, NULL, |
|
12277
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1325 | _("Unable to display the search results."), |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1326 | NULL); |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1327 | return; |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1328 | } |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1329 | |
| 13641 | 1330 | form->window = h; |
| 12007 | 1331 | } else { |
| 15884 | 1332 | purple_notify_searchresults_new_rows(gc, results, form->window); |
| 12007 | 1333 | } |
| 1334 | } | |
| 1335 | ||
| 15884 | 1336 | static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) |
| 13643 | 1337 | { |
| 1338 | GGPInfo *info = gc->proto_data; | |
| 1339 | GGPSearchForm *form; | |
| 1340 | int res_count; | |
| 1341 | guint32 seq; | |
| 1342 | ||
| 1343 | seq = gg_pubdir50_seq(req); | |
| 1344 | form = ggp_search_get(info->searches, seq); | |
|
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
|
1345 | purple_debug_info("gg", "ggp_pubdir_reply_handler(): seq %u --> form %p", seq, form); |
| 13643 | 1346 | /* |
| 1347 | * this can happen when user will request more results | |
| 1348 | * and close the results window before they arrive. | |
| 1349 | */ | |
| 1350 | g_return_if_fail(form != NULL); | |
| 1351 | ||
| 1352 | res_count = gg_pubdir50_count(req); | |
| 1353 | if (res_count < 1) { | |
| 15884 | 1354 | purple_debug_info("gg", "GG_EVENT_PUBDIR50_SEARCH_REPLY: Nothing found\n"); |
| 1355 | purple_notify_error(gc, NULL, | |
| 13643 | 1356 | _("No matching users found"), |
| 1357 | _("There are no users matching your search criteria.")); | |
| 1358 | ggp_sr_close_cb(form); | |
| 1359 | return; | |
| 1360 | } | |
| 1361 | ||
| 1362 | switch (form->search_type) { | |
| 1363 | case GGP_SEARCH_TYPE_INFO: | |
| 1364 | ggp_pubdir_handle_info(gc, req, form); | |
| 1365 | break; | |
| 1366 | case GGP_SEARCH_TYPE_FULL: | |
| 1367 | ggp_pubdir_handle_full(gc, req, form); | |
| 1368 | break; | |
| 1369 | default: | |
| 15884 | 1370 | purple_debug_warning("gg", "Unknown search_type!\n"); |
| 13643 | 1371 | break; |
| 1372 | } | |
| 1373 | } | |
| 1374 | ||
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1375 | 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
|
1376 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1377 | gint imgid = 0; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1378 | GGPInfo *info = gc->proto_data; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1379 | 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
|
1380 | 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
|
1381 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1382 | 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
|
1383 | 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
|
1384 | 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
|
1385 | 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
|
1386 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1387 | 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
|
1388 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1389 | while(entry) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1390 | 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
|
1391 | 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
|
1392 | 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
|
1393 | 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
|
1394 | g_strfreev(split); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1395 | 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
|
1396 | /* 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
|
1397 | 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
|
1398 | 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
|
1399 | 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
|
1400 | g_free(buf); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1401 | 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
|
1402 | g_free(text); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1403 | break; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1404 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1405 | 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
|
1406 | break; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1407 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1408 | 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
|
1409 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1410 | g_free(handlerid); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1411 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1412 | return; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1413 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1414 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1415 | |
| 11414 | 1416 | /** |
| 1417 | * Dispatch a message received from a buddy. | |
| 1418 | * | |
| 15884 | 1419 | * @param gc PurpleConnection. |
| 11414 | 1420 | * @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
|
1421 | * |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1422 | * Image receiving, some code borrowed from Kadu http://www.kadu.net |
| 11414 | 1423 | */ |
| 15884 | 1424 | static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) |
| 11414 | 1425 | { |
| 1426 | GGPInfo *info = gc->proto_data; | |
| 15884 | 1427 | PurpleConversation *conv; |
| 11414 | 1428 | gchar *from; |
| 1429 | gchar *msg; | |
| 1430 | gchar *tmp; | |
| 1431 | ||
|
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
|
1432 | 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
|
1433 | { |
|
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
|
1434 | 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
|
1435 | 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
|
1436 | } |
|
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
|
1437 | |
| 11414 | 1438 | from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); |
| 1439 | ||
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1440 | /* |
| 12961 | 1441 | tmp = charset_convert((const char *)ev->event.msg.message, |
| 12007 | 1442 | "CP1250", "UTF-8"); |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1443 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1444 | tmp = g_strdup_printf("%s", ev->event.msg.message); |
| 15884 | 1445 | purple_str_strip_char(tmp, '\r'); |
| 12961 | 1446 | msg = g_markup_escape_text(tmp, -1); |
| 1447 | g_free(tmp); | |
| 11414 | 1448 | |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1449 | /* We got richtext message */ |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1450 | 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
|
1451 | { |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
1452 | 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
|
1453 | 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
|
1454 | 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
|
1455 | gint increased_len = 0; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1456 | 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
|
1457 | 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
|
1458 | 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
|
1459 | gchar *handlerid; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1460 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1461 | 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
|
1462 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1463 | while (cformats < cformats_end) |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1464 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1465 | gint byteoffset; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1466 | 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
|
1467 | 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
|
1468 | 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
|
1469 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1470 | 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
|
1471 | 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
|
1472 | continue; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1473 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1474 | 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
|
1475 | actformat->position, |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1476 | (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
|
1477 | (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
|
1478 | (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
|
1479 | (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
|
1480 | increased_len); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1481 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1482 | 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
|
1483 | got_image = TRUE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1484 | 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
|
1485 | 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
|
1486 | 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
|
1487 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1488 | /* 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
|
1489 | * 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
|
1490 | if (actimage->size > 255000) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1491 | 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
|
1492 | continue; |
|
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 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1495 | 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
|
1496 | actimage->size, actimage->crc32); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1497 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1498 | 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
|
1499 | 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
|
1500 | increased_len += strlen(handlerid); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1501 | g_free(handlerid); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1502 | continue; |
|
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 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1505 | 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
|
1506 | if (bold == FALSE) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1507 | 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
|
1508 | increased_len += 3; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1509 | bold = TRUE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1510 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1511 | } else if (bold) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1512 | 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
|
1513 | increased_len += 4; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1514 | bold = FALSE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1515 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1516 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1517 | 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
|
1518 | if (italic == FALSE) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1519 | 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
|
1520 | increased_len += 3; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1521 | italic = TRUE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1522 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1523 | } else if (italic) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1524 | 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
|
1525 | increased_len += 4; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1526 | italic = FALSE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1527 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1528 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1529 | 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
|
1530 | if (under == FALSE) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1531 | 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
|
1532 | increased_len += 3; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1533 | under = TRUE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1534 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1535 | } else if (under) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1536 | 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
|
1537 | increased_len += 4; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1538 | under = FALSE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1539 | } |
|
31386
85d81b2b1142
gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31294
diff
changeset
|
1540 | |
|
85d81b2b1142
gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31294
diff
changeset
|
1541 | 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
|
1542 | 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
|
1543 | } |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1544 | } |
|
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 | msg = message->str; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1547 | 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
|
1548 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1549 | if (got_image) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1550 | 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
|
1551 | return; |
|
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 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1554 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1555 | purple_debug_info("gg", "ggp_recv_message_handler: msg from (%s): %s (class = %d; rcpt_count = %d)\n", |
| 12961 | 1556 | from, msg, ev->event.msg.msgclass, |
| 12007 | 1557 | ev->event.msg.recipients_count); |
| 11414 | 1558 | |
| 1559 | if (ev->event.msg.recipients_count == 0) { | |
| 12961 | 1560 | serv_got_im(gc, from, msg, 0, ev->event.msg.time); |
| 11414 | 1561 | } else { |
|
12373
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1562 | const char *chat_name; |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1563 | int chat_id; |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1564 | char *buddy_name; |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1565 | |
| 11414 | 1566 | chat_name = ggp_confer_find_by_participants(gc, |
| 12007 | 1567 | ev->event.msg.recipients, |
| 1568 | ev->event.msg.recipients_count); | |
| 12961 | 1569 | |
| 11414 | 1570 | if (chat_name == NULL) { |
| 1571 | chat_name = ggp_confer_add_new(gc, NULL); | |
| 1572 | serv_got_joined_chat(gc, info->chats_count, chat_name); | |
| 12007 | 1573 | |
| 1574 | ggp_confer_participants_add_uin(gc, chat_name, | |
| 1575 | ev->event.msg.sender); | |
| 1576 | ||
| 1577 | ggp_confer_participants_add(gc, chat_name, | |
| 1578 | ev->event.msg.recipients, | |
| 1579 | ev->event.msg.recipients_count); | |
| 11414 | 1580 | } |
| 1581 | conv = ggp_confer_find_by_name(gc, chat_name); | |
| 15884 | 1582 | 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
|
1583 | |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1584 | buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender); |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1585 | serv_got_chat_in(gc, chat_id, buddy_name, |
| 15884 | 1586 | PURPLE_MESSAGE_RECV, msg, ev->event.msg.time); |
|
12373
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1587 | g_free(buddy_name); |
| 11414 | 1588 | } |
| 12961 | 1589 | g_free(msg); |
| 11414 | 1590 | g_free(from); |
| 1591 | } | |
| 1592 | ||
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1593 | 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
|
1594 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1595 | GGPInfo *info = gc->proto_data; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1596 | 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
|
1597 | 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
|
1598 | |
|
339576876d0b
Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31611
diff
changeset
|
1599 | 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
|
1600 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1601 | if(imgid) |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1602 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1603 | 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
|
1604 | 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
|
1605 | 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
|
1606 | 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
|
1607 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1608 | 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
|
1609 | 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
|
1610 | purple_imgstore_unref(image); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1611 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1612 | 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
|
1613 | } |
|
31628
339576876d0b
Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31611
diff
changeset
|
1614 | 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
|
1615 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1616 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1617 | |
|
31630
47b2ee63a797
Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31628
diff
changeset
|
1618 | 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
|
1619 | gchar *from; |
|
ee01a0566a86
Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31739
diff
changeset
|
1620 | |
|
ee01a0566a86
Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31739
diff
changeset
|
1621 | from = g_strdup_printf("%u", uin); |
|
ee01a0566a86
Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31739
diff
changeset
|
1622 | if (length) |
|
ee01a0566a86
Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31739
diff
changeset
|
1623 | 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
|
1624 | else |
|
ee01a0566a86
Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31739
diff
changeset
|
1625 | serv_got_typing_stopped(gc, from); |
|
ee01a0566a86
Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31739
diff
changeset
|
1626 | g_free(from); |
|
31630
47b2ee63a797
Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31628
diff
changeset
|
1627 | } |
|
47b2ee63a797
Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31628
diff
changeset
|
1628 | |
|
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
|
1629 | /** |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1630 | * 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
|
1631 | * |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1632 | * @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
|
1633 | * @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
|
1634 | * |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1635 | * @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
|
1636 | */ |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1637 | 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
|
1638 | { |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1639 | 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
|
1640 | 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
|
1641 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1642 | 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
|
1643 | 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
|
1644 | 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
|
1645 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1646 | 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
|
1647 | 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
|
1648 | { |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1649 | 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
|
1650 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1651 | 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
|
1652 | 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
|
1653 | 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
|
1654 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1655 | 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
|
1656 | 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
|
1657 | 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
|
1658 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1659 | 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
|
1660 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1661 | 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
|
1662 | 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
|
1663 | 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
|
1664 | 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
|
1665 | 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
|
1666 | 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
|
1667 | 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
|
1668 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1669 | 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
|
1670 | 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
|
1671 | { |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1672 | 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
|
1673 | 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
|
1674 | 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
|
1675 | 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
|
1676 | } |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1677 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1678 | 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
|
1679 | { |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1680 | 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
|
1681 | 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
|
1682 | "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
|
1683 | 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
|
1684 | 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
|
1685 | 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
|
1686 | 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
|
1687 | 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
|
1688 | "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
|
1689 | 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
|
1690 | } |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1691 | } |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1692 | |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1693 | 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
|
1694 | 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
|
1695 | 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
|
1696 | } |
|
1854b313a9bb
Recently I found out a small issue: if another user changes it's avatar, we
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31663
diff
changeset
|
1697 | |
| 15884 | 1698 | static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) |
| 11414 | 1699 | { |
| 15884 | 1700 | PurpleConnection *gc = _gc; |
| 11414 | 1701 | GGPInfo *info = gc->proto_data; |
| 1702 | struct gg_event *ev; | |
| 1703 | int i; | |
| 1704 | ||
| 1705 | if (!(ev = gg_watch_fd(info->session))) { | |
| 15884 | 1706 | purple_debug_error("gg", |
| 12007 | 1707 | "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
| 21279 | 1708 | purple_connection_error_reason (gc, |
| 1709 | 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
|
1710 | _("Unable to read from socket")); |
| 11414 | 1711 | return; |
| 1712 | } | |
|
31661
2a8aceaee628
Don't update last_received when receiving data on gg. Fixes #13699.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31649
diff
changeset
|
1713 | |
| 11414 | 1714 | switch (ev->type) { |
| 1715 | case GG_EVENT_NONE: | |
| 1716 | /* Nothing happened. */ | |
| 1717 | break; | |
| 1718 | case GG_EVENT_MSG: | |
| 1719 | ggp_recv_message_handler(gc, ev); | |
| 1720 | break; | |
| 1721 | 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
|
1722 | /* Changing %u to %i fixes compiler warning */ |
| 15884 | 1723 | 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
|
1724 | "ggp_callback_recv: message sent to: %i, delivery status=%d, seq=%d\n", |
| 12007 | 1725 | ev->event.ack.recipient, ev->event.ack.status, |
| 1726 | ev->event.ack.seq); | |
| 11414 | 1727 | break; |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1728 | 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
|
1729 | 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
|
1730 | break; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1731 | 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
|
1732 | 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
|
1733 | break; |
| 11414 | 1734 | case GG_EVENT_NOTIFY: |
| 1735 | case GG_EVENT_NOTIFY_DESCR: | |
| 1736 | { | |
| 1737 | struct gg_notify_reply *n; | |
| 1738 | char *descr; | |
| 1739 | ||
| 15884 | 1740 | purple_debug_info("gg", "notify_pre: (%d) status: %d\n", |
| 11414 | 1741 | ev->event.notify->uin, |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1742 | GG_S(ev->event.notify->status)); |
| 11414 | 1743 | |
| 1744 | n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify | |
| 1745 | : ev->event.notify_descr.notify; | |
| 1746 | ||
| 1747 | for (; n->uin; n++) { | |
| 1748 | descr = (ev->type == GG_EVENT_NOTIFY) ? NULL | |
| 12007 | 1749 | : ev->event.notify_descr.descr; |
| 1750 | ||
| 15884 | 1751 | purple_debug_info("gg", |
| 12007 | 1752 | "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
|
1753 | n->uin, GG_S(n->status), descr ? descr : "(null)"); |
| 11414 | 1754 | |
| 1755 | 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
|
1756 | n->uin, GG_S(n->status), descr); |
| 11414 | 1757 | } |
| 1758 | } | |
| 1759 | break; | |
| 1760 | case GG_EVENT_NOTIFY60: | |
| 1761 | for (i = 0; ev->event.notify60[i].uin; i++) { | |
| 15884 | 1762 | purple_debug_info("gg", |
| 12007 | 1763 | "notify60: (%d) status=%d; version=%d; descr=%s\n", |
| 1764 | 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
|
1765 | GG_S(ev->event.notify60[i].status), |
| 12007 | 1766 | ev->event.notify60[i].version, |
|
14524
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1767 | ev->event.notify60[i].descr ? ev->event.notify60[i].descr : "(null)"); |
| 11414 | 1768 | |
| 12007 | 1769 | 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
|
1770 | GG_S(ev->event.notify60[i].status), |
| 12007 | 1771 | ev->event.notify60[i].descr); |
| 11414 | 1772 | } |
| 1773 | break; | |
| 1774 | case GG_EVENT_STATUS: | |
| 15884 | 1775 | 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
|
1776 | ev->event.status.uin, GG_S(ev->event.status.status), |
|
14524
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1777 | ev->event.status.descr ? ev->event.status.descr : "(null)"); |
| 11414 | 1778 | |
| 12007 | 1779 | 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
|
1780 | GG_S(ev->event.status.status), ev->event.status.descr); |
| 11414 | 1781 | break; |
| 1782 | case GG_EVENT_STATUS60: | |
| 15884 | 1783 | purple_debug_info("gg", |
| 12007 | 1784 | "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
|
1785 | ev->event.status60.uin, GG_S(ev->event.status60.status), |
|
14524
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1786 | ev->event.status60.version, |
|
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1787 | ev->event.status60.descr ? ev->event.status60.descr : "(null)"); |
| 11414 | 1788 | |
| 12007 | 1789 | 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
|
1790 | GG_S(ev->event.status60.status), ev->event.status60.descr); |
| 11414 | 1791 | break; |
| 1792 | case GG_EVENT_USERLIST: | |
|
31795
ee01a0566a86
Small space to tab changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31739
diff
changeset
|
1793 | if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) { |
| 15884 | 1794 | purple_debug_info("gg", "GG_USERLIST_GET_REPLY\n"); |
| 1795 | purple_notify_info(gc, NULL, | |
| 12220 | 1796 | _("Buddy list downloaded"), |
| 1797 | _("Your buddy list was downloaded from the server.")); | |
| 11414 | 1798 | if (ev->event.userlist.reply != NULL) { |
| 12007 | 1799 | ggp_buddylist_load(gc, ev->event.userlist.reply); |
| 11414 | 1800 | } |
| 1801 | } else { | |
| 15884 | 1802 | purple_debug_info("gg", "GG_USERLIST_PUT_REPLY\n"); |
| 1803 | purple_notify_info(gc, NULL, | |
| 12220 | 1804 | _("Buddy list uploaded"), |
| 1805 | _("Your buddy list was stored on the server.")); | |
| 11414 | 1806 | } |
| 1807 | break; | |
| 1808 | case GG_EVENT_PUBDIR50_SEARCH_REPLY: | |
| 12007 | 1809 | ggp_pubdir_reply_handler(gc, ev->event.pubdir50); |
| 1810 | break; | |
|
31630
47b2ee63a797
Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31628
diff
changeset
|
1811 | case GG_EVENT_TYPING_NOTIFICATION: |
|
47b2ee63a797
Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31628
diff
changeset
|
1812 | 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
|
1813 | ev->event.typing_notification.length); |
|
47b2ee63a797
Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31628
diff
changeset
|
1814 | 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
|
1815 | 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
|
1816 | 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
|
1817 | 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
|
1818 | break; |
| 12007 | 1819 | default: |
| 15884 | 1820 | purple_debug_error("gg", |
| 12007 | 1821 | "unsupported event type=%d\n", ev->type); |
| 1822 | break; | |
| 1823 | } | |
| 11414 | 1824 | |
| 12007 | 1825 | gg_free_event(ev); |
| 1826 | } | |
| 11414 | 1827 | |
| 15884 | 1828 | static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond) |
| 12007 | 1829 | { |
| 15884 | 1830 | PurpleConnection *gc = _gc; |
|
15419
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1831 | GGPInfo *info; |
| 12007 | 1832 | struct gg_event *ev; |
| 11414 | 1833 | |
| 15884 | 1834 | g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
|
15419
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1835 | |
|
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1836 | info = gc->proto_data; |
|
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1837 | |
| 15884 | 1838 | purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
| 12007 | 1839 | info->session->check, info->session->state); |
| 11414 | 1840 | |
| 12007 | 1841 | switch (info->session->state) { |
| 1842 | case GG_STATE_RESOLVING: | |
| 15884 | 1843 | purple_debug_info("gg", "GG_STATE_RESOLVING\n"); |
| 12007 | 1844 | 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
|
1845 | 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
|
1846 | 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
|
1847 | break; |
| 12007 | 1848 | case GG_STATE_CONNECTING_HUB: |
| 15884 | 1849 | purple_debug_info("gg", "GG_STATE_CONNECTING_HUB\n"); |
| 12007 | 1850 | break; |
| 1851 | case GG_STATE_READING_DATA: | |
| 15884 | 1852 | purple_debug_info("gg", "GG_STATE_READING_DATA\n"); |
| 12007 | 1853 | break; |
| 1854 | case GG_STATE_CONNECTING_GG: | |
| 15884 | 1855 | purple_debug_info("gg", "GG_STATE_CONNECTING_GG\n"); |
| 12007 | 1856 | break; |
| 1857 | case GG_STATE_READING_KEY: | |
| 15884 | 1858 | purple_debug_info("gg", "GG_STATE_READING_KEY\n"); |
| 12007 | 1859 | break; |
| 1860 | case GG_STATE_READING_REPLY: | |
| 15884 | 1861 | purple_debug_info("gg", "GG_STATE_READING_REPLY\n"); |
| 11414 | 1862 | 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
|
1863 | 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
|
1864 | 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
|
1865 | break; |
| 11414 | 1866 | default: |
| 15884 | 1867 | purple_debug_error("gg", "unknown state = %d\n", |
| 12007 | 1868 | info->session->state); |
| 1869 | break; | |
| 1870 | } | |
| 1871 | ||
| 1872 | if (!(ev = gg_watch_fd(info->session))) { | |
| 15884 | 1873 | purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
| 21279 | 1874 | purple_connection_error_reason (gc, |
| 1875 | 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
|
1876 | _("Unable to read from socket")); |
| 12007 | 1877 | return; |
| 1878 | } | |
| 15884 | 1879 | purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
| 1880 | purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", | |
| 12007 | 1881 | info->session->check, info->session->state); |
| 1882 | ||
| 15884 | 1883 | purple_input_remove(gc->inpa); |
| 12007 | 1884 | |
| 1885 | /** 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
|
1886 | 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
|
1887 | 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
|
1888 | (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
|
1889 | 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
|
1890 | ggp_async_login_handler, gc); |
| 12007 | 1891 | |
| 1892 | switch (ev->type) { | |
| 1893 | case GG_EVENT_NONE: | |
| 1894 | /* Nothing happened. */ | |
| 15884 | 1895 | purple_debug_info("gg", "GG_EVENT_NONE\n"); |
| 12007 | 1896 | break; |
| 1897 | case GG_EVENT_CONN_SUCCESS: | |
| 12964 | 1898 | { |
| 15884 | 1899 | purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); |
| 1900 | purple_input_remove(gc->inpa); | |
| 1901 | gc->inpa = purple_input_add(info->session->fd, | |
| 1902 | PURPLE_INPUT_READ, | |
| 12964 | 1903 | ggp_callback_recv, gc); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
1904 | |
|
27642
6ae79601ad84
Patch from kkszysiu to make the GG prpl support
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27626
diff
changeset
|
1905 | ggp_buddylist_send(gc); |
|
30163
e43601d06035
gg: Fix misuse of update_progress. Fixes #11774
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
30138
diff
changeset
|
1906 | purple_connection_update_progress(gc, _("Connected"), 1, 2); |
| 15884 | 1907 | purple_connection_set_state(gc, PURPLE_CONNECTED); |
| 12964 | 1908 | } |
| 12007 | 1909 | break; |
| 1910 | case GG_EVENT_CONN_FAILED: | |
| 15884 | 1911 | purple_input_remove(gc->inpa); |
| 12007 | 1912 | gc->inpa = 0; |
|
20437
6596f4984a50
Modify gadu-gadu to use purple_connection_error_reason. I'm not sure about
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
1913 | purple_connection_error_reason (gc, |
| 21279 | 1914 | 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
|
1915 | _("Connection failed")); |
| 12007 | 1916 | break; |
|
31874
6ddbbcd38154
No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31795
diff
changeset
|
1917 | 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
|
1918 | if (ev->event.msg.sender == 0) |
|
6ddbbcd38154
No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31795
diff
changeset
|
1919 | /* 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
|
1920 | 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
|
1921 | 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
|
1922 | else |
|
6ddbbcd38154
No more warnings when receiving Gadu-Gadu system messages - fixes #13914
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31795
diff
changeset
|
1923 | 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
|
1924 | "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
|
1925 | 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
|
1926 | 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
|
1927 | break; |
| 12007 | 1928 | default: |
| 15884 | 1929 | purple_debug_error("gg", "strange event: %d\n", ev->type); |
| 11414 | 1930 | break; |
| 1931 | } | |
| 1932 | ||
| 1933 | gg_free_event(ev); | |
| 1934 | } | |
| 1935 | ||
| 1936 | /* ---------------------------------------------------------------------- */ | |
| 15884 | 1937 | /* ----- PurplePluginProtocolInfo ----------------------------------------- */ |
| 11360 | 1938 | /* ---------------------------------------------------------------------- */ |
| 1939 | ||
| 15884 | 1940 | static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) |
| 11360 | 1941 | { |
| 1942 | return "gadu-gadu"; | |
| 1943 | } | |
| 1944 | ||
| 15884 | 1945 | static char *ggp_status_text(PurpleBuddy *b) |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1946 | { |
| 15884 | 1947 | PurpleStatus *status; |
| 11360 | 1948 | const char *msg; |
| 1949 | char *text; | |
| 1950 | char *tmp; | |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1951 | |
| 15884 | 1952 | status = purple_presence_get_active_status(purple_buddy_get_presence(b)); |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1953 | |
| 15884 | 1954 | msg = purple_status_get_attr_string(status, "message"); |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1955 | |
| 11360 | 1956 | if (msg != NULL) { |
| 15884 | 1957 | tmp = purple_markup_strip_html(msg); |
| 11360 | 1958 | text = g_markup_escape_text(tmp, -1); |
| 1959 | g_free(tmp); | |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1960 | |
| 11360 | 1961 | return text; |
| 1962 | } else { | |
| 15884 | 1963 | tmp = purple_utf8_salvage(purple_status_get_name(status)); |
| 11360 | 1964 | text = g_markup_escape_text(tmp, -1); |
| 1965 | g_free(tmp); | |
| 1966 | ||
| 1967 | return text; | |
| 8997 | 1968 | } |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1969 | } |
|
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1970 | |
| 15884 | 1971 | static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
| 11360 | 1972 | { |
| 15884 | 1973 | PurpleStatus *status; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1974 | char *text, *tmp; |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1975 | const char *msg, *name, *alias; |
| 11360 | 1976 | |
| 15005 | 1977 | g_return_if_fail(b != NULL); |
| 1978 | ||
| 15884 | 1979 | status = purple_presence_get_active_status(purple_buddy_get_presence(b)); |
| 1980 | msg = purple_status_get_attr_string(status, "message"); | |
| 1981 | 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
|
1982 | 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
|
1983 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1984 | purple_notify_user_info_add_pair (user_info, _("Alias"), alias); |
| 11360 | 1985 | |
| 1986 | if (msg != NULL) { | |
| 13455 | 1987 | text = g_markup_escape_text(msg, -1); |
| 15884 | 1988 | if (PURPLE_BUDDY_IS_ONLINE(b)) { |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1989 | tmp = g_strdup_printf("%s: %s", name, text); |
| 15884 | 1990 | purple_notify_user_info_add_pair(user_info, _("Status"), tmp); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1991 | g_free(tmp); |
| 15196 | 1992 | } else { |
| 15884 | 1993 | purple_notify_user_info_add_pair(user_info, _("Message"), text); |
| 15196 | 1994 | } |
| 11360 | 1995 | g_free(text); |
| 15227 | 1996 | /* We don't want to duplicate 'Status: Offline'. */ |
| 15884 | 1997 | } else if (PURPLE_BUDDY_IS_ONLINE(b)) { |
| 1998 | purple_notify_user_info_add_pair(user_info, _("Status"), name); | |
| 11360 | 1999 | } |
| 2000 | } | |
| 2001 | ||
| 15884 | 2002 | static GList *ggp_status_types(PurpleAccount *account) |
| 11360 | 2003 | { |
| 15884 | 2004 | PurpleStatusType *type; |
| 11360 | 2005 | GList *types = NULL; |
| 2006 | ||
| 15884 | 2007 | type = purple_status_type_new_with_attrs( |
| 2008 | PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, | |
| 2009 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
2010 | NULL); |
| 11360 | 2011 | types = g_list_append(types, type); |
| 2012 | ||
| 2013 | /* | |
|
11638
1821b40269a3
[gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11565
diff
changeset
|
2014 | * Without this selecting Invisible as own status doesn't |
| 11360 | 2015 | * work. It's not used and not needed to show status of buddies. |
| 2016 | */ | |
| 15884 | 2017 | type = purple_status_type_new_with_attrs( |
| 2018 | PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE, TRUE, FALSE, | |
| 2019 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
2020 | NULL); |
| 11360 | 2021 | types = g_list_append(types, type); |
| 2022 | ||
| 15884 | 2023 | type = purple_status_type_new_with_attrs( |
| 2024 | PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, | |
| 2025 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
2026 | NULL); |
| 11360 | 2027 | types = g_list_append(types, type); |
| 2028 | ||
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2029 | /* |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2030 | * 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
|
2031 | * 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
|
2032 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2033 | 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
|
2034 | 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
|
2035 | "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
|
2036 | NULL); |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2037 | types = g_list_append(types, type); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2038 | |
| 12964 | 2039 | /* |
| 2040 | * This status is necessary to display guys who are blocking *us*. | |
| 2041 | */ | |
| 15884 | 2042 | type = purple_status_type_new_with_attrs( |
| 2043 | PURPLE_STATUS_INVISIBLE, "blocked", _("Blocked"), TRUE, FALSE, FALSE, | |
| 2044 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); | |
| 11360 | 2045 | types = g_list_append(types, type); |
| 2046 | ||
| 15884 | 2047 | type = purple_status_type_new_with_attrs( |
| 2048 | PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE, | |
| 2049 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
2050 | NULL); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
2051 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
2052 | |
| 11360 | 2053 | return types; |
| 2054 | } | |
| 2055 | ||
| 15884 | 2056 | static GList *ggp_blist_node_menu(PurpleBlistNode *node) |
| 2393 | 2057 | { |
| 15884 | 2058 | PurpleMenuAction *act; |
| 2393 | 2059 | 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
|
2060 | PurpleAccount *account; |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
2061 | GGPInfo *info; |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4229
diff
changeset
|
2062 | |
| 15884 | 2063 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) |
| 11360 | 2064 | return NULL; |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4229
diff
changeset
|
2065 | |
|
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
|
2066 | account = purple_buddy_get_account((PurpleBuddy *) node); |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
2067 | info = purple_account_get_connection(account)->proto_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
|
2068 | 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
|
2069 | 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
|
2070 | 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
|
2071 | 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
|
2072 | 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
|
2073 | } |
| 11410 | 2074 | |
| 12641 | 2075 | /* Using a blist node boolean here is also wrong. |
| 2076 | * Once the Block and Unblock actions are added to the core, | |
| 2077 | * this will have to go. -- rlaager */ | |
| 15884 | 2078 | if (purple_blist_node_get_bool(node, "blocked")) { |
| 2079 | act = purple_menu_action_new(_("Unblock"), | |
| 2080 | PURPLE_CALLBACK(ggp_bmenu_block), | |
| 12919 | 2081 | NULL, NULL); |
| 12007 | 2082 | } else { |
| 15884 | 2083 | act = purple_menu_action_new(_("Block"), |
| 2084 | PURPLE_CALLBACK(ggp_bmenu_block), | |
| 12919 | 2085 | NULL, NULL); |
| 12007 | 2086 | } |
| 11394 | 2087 | m = g_list_append(m, act); |
| 2393 | 2088 | |
| 2089 | return m; | |
| 2090 | } | |
| 2091 | ||
| 15884 | 2092 | static GList *ggp_chat_info(PurpleConnection *gc) |
| 11394 | 2093 | { |
| 2094 | GList *m = NULL; | |
| 2095 | struct proto_chat_entry *pce; | |
| 2096 | ||
| 2097 | pce = g_new0(struct proto_chat_entry, 1); | |
| 2098 | pce->label = _("Chat _name:"); | |
| 2099 | pce->identifier = "name"; | |
| 2100 | pce->required = TRUE; | |
| 2101 | m = g_list_append(m, pce); | |
| 2102 | ||
| 2103 | return m; | |
| 2104 | } | |
| 2105 | ||
| 15884 | 2106 | static void ggp_login(PurpleAccount *account) |
| 2393 | 2107 | { |
| 15884 | 2108 | PurpleConnection *gc; |
|
23382
8dfecaa62e66
Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents:
23381
diff
changeset
|
2109 | PurplePresence *presence; |
|
8dfecaa62e66
Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents:
23381
diff
changeset
|
2110 | PurpleStatus *status; |
| 13515 | 2111 | struct gg_login_params *glp; |
| 2112 | GGPInfo *info; | |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2113 | 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
|
2114 | const gchar *encryption_type; |
| 13515 | 2115 | |
| 2116 | if (ggp_setup_proxy(account) == -1) | |
| 2117 | return; | |
| 2118 | ||
| 15884 | 2119 | gc = purple_account_get_connection(account); |
| 13515 | 2120 | glp = g_new0(struct gg_login_params, 1); |
| 2121 | info = g_new0(GGPInfo, 1); | |
| 11360 | 2122 | |
| 12007 | 2123 | /* Probably this should be moved to *_new() function. */ |
| 11360 | 2124 | info->session = NULL; |
| 11394 | 2125 | info->chats = NULL; |
| 2126 | info->chats_count = 0; | |
| 12007 | 2127 | info->token = NULL; |
| 13641 | 2128 | 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
|
2129 | 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
|
2130 | 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
|
2131 | 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
|
2132 | |
| 11360 | 2133 | gc->proto_data = info; |
| 2134 | ||
| 2135 | glp->uin = ggp_get_uin(account); | |
| 15884 | 2136 | glp->password = (char *)purple_account_get_password(account); |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2137 | glp->image_size = 255; |
| 11360 | 2138 | |
|
23382
8dfecaa62e66
Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents:
23381
diff
changeset
|
2139 | 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
|
2140 | 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
|
2141 | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2142 | glp->encoding = GG_ENCODING_UTF8; |
|
31630
47b2ee63a797
Gadu-Gadu: Support receiving typing indications. Fixes #13362.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31628
diff
changeset
|
2143 | 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
|
2144 | |GG_FEATURE_TYPING_NOTIFICATION); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2145 | |
| 12007 | 2146 | 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
|
2147 | 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
|
2148 | |
|
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
|
2149 | encryption_type = purple_account_get_string(account, "encryption", "none"); |
|
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
|
2150 | purple_debug_info("gg", "Requested encryption type: %s\n", encryption_type); |
|
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
|
2151 | if (strcmp(encryption_type, "opportunistic_tls") == 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
|
2152 | glp->tls = 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
|
2153 | else |
|
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
|
2154 | glp->tls = 0; |
|
31649
a0893f99877d
Gadu-Gadu: Add encrypted (SSL) connection support for GNUTLS users.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31648
diff
changeset
|
2155 | purple_debug_info("gg", "TLS enabled: %d\n", glp->tls); |
| 11360 | 2156 | |
|
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
|
2157 | 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
|
2158 | 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
|
2159 | |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2160 | 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
|
2161 | 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
|
2162 | /* 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
|
2163 | 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
|
2164 | |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2165 | 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
|
2166 | |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2167 | 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
|
2168 | 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
|
2169 | address, g_strerror(errno)); |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2170 | purple_connection_error_reason(gc, |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2171 | 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
|
2172 | tmp); |
|
62fbae50be08
Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents:
27388
diff
changeset
|
2173 | g_free(tmp); |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2174 | return; |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2175 | } |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2176 | |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2177 | 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
|
2178 | glp->server_port = 8074; |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2179 | } else |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2180 | 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
|
2181 | |
| 11360 | 2182 | info->session = gg_login(glp); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2183 | purple_connection_update_progress(gc, _("Connecting"), 0, 2); |
| 11360 | 2184 | if (info->session == NULL) { |
| 21279 | 2185 | purple_connection_error_reason (gc, |
| 2186 | 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
|
2187 | _("Connection failed")); |
| 11360 | 2188 | g_free(glp); |
| 2189 | return; | |
| 2190 | } | |
| 15884 | 2191 | gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
| 12007 | 2192 | ggp_async_login_handler, gc); |
| 11360 | 2193 | } |
| 2194 | ||
| 15884 | 2195 | static void ggp_close(PurpleConnection *gc) |
| 11360 | 2196 | { |
| 8997 | 2197 | |
| 11360 | 2198 | if (gc == NULL) { |
| 15884 | 2199 | purple_debug_info("gg", "gc == NULL\n"); |
| 11360 | 2200 | return; |
| 2201 | } | |
| 2202 | ||
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2203 | if (gc->proto_data) { |
| 15884 | 2204 | PurpleAccount *account = purple_connection_get_account(gc); |
| 2205 | PurpleStatus *status; | |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2206 | GGPInfo *info = gc->proto_data; |
| 12964 | 2207 | |
| 15884 | 2208 | status = purple_account_get_active_status(account); |
| 12964 | 2209 | |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2210 | if (info->session != NULL) { |
| 12964 | 2211 | ggp_set_status(account, status); |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2212 | gg_logoff(info->session); |
|
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2213 | gg_free_session(info->session); |
|
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2214 | } |
| 13641 | 2215 | |
|
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
|
2216 | 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
|
2217 | |
|
14060
e1a87aabd80c
[gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents:
13645
diff
changeset
|
2218 | /* Immediately close any notifications on this handle since that process depends |
|
e1a87aabd80c
[gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents:
13645
diff
changeset
|
2219 | * 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
|
2220 | */ |
| 15884 | 2221 | purple_notify_close_with_handle(gc); |
|
14060
e1a87aabd80c
[gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents:
13645
diff
changeset
|
2222 | |
| 13641 | 2223 | 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
|
2224 | 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
|
2225 | g_hash_table_destroy(info->pending_images); |
|
11545
df2f9bb3fd6e
[gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents:
11544
diff
changeset
|
2226 | g_free(info); |
|
df2f9bb3fd6e
[gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents:
11544
diff
changeset
|
2227 | gc->proto_data = NULL; |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2228 | } |
| 11360 | 2229 | |
| 2230 | if (gc->inpa > 0) | |
| 15884 | 2231 | purple_input_remove(gc->inpa); |
| 11360 | 2232 | |
| 15884 | 2233 | purple_debug_info("gg", "Connection closed.\n"); |
| 11360 | 2234 | } |
| 2235 | ||
| 15884 | 2236 | static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, |
| 2237 | PurpleMessageFlags flags) | |
| 11360 | 2238 | { |
| 2239 | GGPInfo *info = gc->proto_data; | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2240 | char *tmp, *plain; |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2241 | int ret = 1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2242 | unsigned char format[1024]; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2243 | 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
|
2244 | gint pos = 0; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2245 | GData *attribs; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2246 | 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
|
2247 | |
|
24747
498c6dda6e48
Fix two warnings introduced by the image patch I committed earlier and make
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24746
diff
changeset
|
2248 | if (msg == NULL || *msg == '\0') { |
| 15287 | 2249 | return 0; |
| 2250 | } | |
| 2251 | ||
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2252 | last = msg; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2253 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2254 | /* 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
|
2255 | /* TODO: Check formatting, too */ |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2256 | 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
|
2257 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2258 | 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
|
2259 | 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
|
2260 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2261 | do { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2262 | PurpleStoredImage *image; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2263 | const char *id; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2264 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2265 | /* 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
|
2266 | if(start - last) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2267 | 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
|
2268 | 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
|
2269 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2270 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2271 | 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
|
2272 | 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
|
2273 | 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
|
2274 | 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
|
2275 | 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
|
2276 | 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
|
2277 | 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
|
2278 | |
|
31628
339576876d0b
Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31611
diff
changeset
|
2279 | 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
|
2280 | 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
|
2281 | 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
|
2282 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2283 | 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
|
2284 | actformat.position = pos; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2285 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2286 | actimage.unknown1 = 0x0109; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2287 | 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
|
2288 | 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
|
2289 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2290 | if (actimage.size > 255000) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2291 | 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
|
2292 | } else { |
|
339576876d0b
Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31611
diff
changeset
|
2293 | 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
|
2294 | |
|
339576876d0b
Gadu-Gadu: Fix sending inline images to remote users. Also fix sending images
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31611
diff
changeset
|
2295 | 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
|
2296 | 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
|
2297 | 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
|
2298 | 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
|
2299 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2300 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2301 | 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
|
2302 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2303 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2304 | last = end + 1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2305 | g_datalist_clear(&attribs); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2306 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2307 | } 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
|
2308 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2309 | /* 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
|
2310 | if(last && *last) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2311 | 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
|
2312 | 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
|
2313 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2314 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2315 | fmt.flag = 2; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2316 | 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
|
2317 | 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
|
2318 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2319 | 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
|
2320 | 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
|
2321 | 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
|
2322 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2323 | 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
|
2324 | 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
|
2325 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2326 | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2327 | /* |
| 15287 | 2328 | 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
|
2329 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2330 | tmp = g_strdup_printf("%s", plain); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2331 | |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2332 | 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
|
2333 | 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
|
2334 | ret = -1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2335 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2336 | ret = 1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2337 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2338 | } else if (NULL == tmp || *tmp == 0) { |
| 15287 | 2339 | ret = 0; |
| 2340 | } else if (strlen(tmp) > GG_MSG_MAXSIZE) { | |
| 2341 | ret = -E2BIG; | |
| 2342 | } else if (gg_send_message(info->session, GG_CLASS_CHAT, | |
| 2343 | ggp_str_to_uin(who), (unsigned char *)tmp) < 0) { | |
| 2344 | ret = -1; | |
| 2345 | } else { | |
| 2346 | ret = 1; | |
| 2347 | } | |
| 2348 | ||
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2349 | g_free(plain); |
| 11565 | 2350 | g_free(tmp); |
| 11360 | 2351 | |
| 15287 | 2352 | return ret; |
| 11360 | 2353 | } |
| 2354 | ||
|
31648
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2355 | 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
|
2356 | { |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2357 | 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
|
2358 | |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2359 | 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
|
2360 | return 1; |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2361 | |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2362 | if (state == PURPLE_TYPING) |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2363 | 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
|
2364 | else // PURPLE_NOT_TYPING |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2365 | dummy_length = 0; |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2366 | |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2367 | gg_typing_notification( |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2368 | ((GGPInfo*)gc->proto_data)->session, |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2369 | 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
|
2370 | dummy_length); |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2371 | |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2372 | 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
|
2373 | } |
|
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2374 | |
| 15884 | 2375 | static void ggp_get_info(PurpleConnection *gc, const char *name) |
| 11360 | 2376 | { |
| 2377 | GGPInfo *info = gc->proto_data; | |
| 2378 | GGPSearchForm *form; | |
| 13641 | 2379 | guint32 seq; |
| 2393 | 2380 | |
| 13641 | 2381 | form = ggp_search_form_new(GGP_SEARCH_TYPE_INFO); |
| 12220 | 2382 | |
| 13641 | 2383 | form->user_data = info; |
| 11360 | 2384 | form->uin = g_strdup(name); |
| 2385 | form->offset = g_strdup("0"); | |
| 2386 | form->last_uin = g_strdup("0"); | |
| 2387 | ||
| 13641 | 2388 | seq = ggp_search_start(gc, form); |
| 2389 | 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
|
2390 | purple_debug_info("gg", "ggp_get_info(): Added seq %u", seq); |
| 11360 | 2391 | } |
| 2392 | ||
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2393 | static int ggp_to_gg_status(PurpleStatus *status, char **msg) |
| 11360 | 2394 | { |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2395 | const char *status_id = purple_status_get_id(status); |
| 11360 | 2396 | 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
|
2397 | const char *new_msg; |
| 11360 | 2398 | |
|
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
|
2399 | g_return_val_if_fail(msg != NULL, 0); |
| 11360 | 2400 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2401 | purple_debug_info("gg", "ggp_to_gg_status: Requested status = %s\n", |
| 12007 | 2402 | status_id); |
| 2393 | 2403 | |
| 11360 | 2404 | if (strcmp(status_id, "available") == 0) { |
| 2405 | new_status = GG_STATUS_AVAIL; | |
| 2406 | new_status_descr = GG_STATUS_AVAIL_DESCR; | |
| 2407 | } else if (strcmp(status_id, "away") == 0) { | |
| 2408 | new_status = GG_STATUS_BUSY; | |
| 2409 | 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
|
2410 | } 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
|
2411 | new_status = GG_STATUS_DND; |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2412 | new_status_descr = GG_STATUS_DND_DESCR; |
| 11360 | 2413 | } else if (strcmp(status_id, "invisible") == 0) { |
| 2414 | new_status = GG_STATUS_INVISIBLE; | |
| 2415 | new_status_descr = GG_STATUS_INVISIBLE_DESCR; | |
| 12964 | 2416 | } else if (strcmp(status_id, "offline") == 0) { |
| 2417 | new_status = GG_STATUS_NOT_AVAIL; | |
| 2418 | new_status_descr = GG_STATUS_NOT_AVAIL_DESCR; | |
| 11360 | 2419 | } else { |
| 2420 | new_status = GG_STATUS_AVAIL; | |
| 2421 | new_status_descr = GG_STATUS_AVAIL_DESCR; | |
| 15884 | 2422 | 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
|
2423 | "ggp_set_status: unknown status requested (status_id=%s)\n", |
| 12007 | 2424 | status_id); |
| 11360 | 2425 | } |
| 4916 | 2426 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2427 | 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
|
2428 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2429 | if(new_msg) { |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2430 | /* |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2431 | 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
|
2432 | *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
|
2433 | g_free(tmp); |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2434 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2435 | *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
|
2436 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2437 | 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
|
2438 | } else { |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2439 | *msg = NULL; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2440 | 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
|
2441 | } |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2442 | } |
| 11360 | 2443 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2444 | 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
|
2445 | { |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2446 | PurpleConnection *gc; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2447 | GGPInfo *info; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2448 | 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
|
2449 | 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
|
2450 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2451 | 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
|
2452 | return; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2453 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2454 | gc = purple_account_get_connection(account); |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2455 | info = gc->proto_data; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2456 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2457 | 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
|
2458 | |
|
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
|
2459 | 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
|
2460 | 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
|
2461 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2462 | if (new_msg == NULL) { |
| 11360 | 2463 | gg_change_status(info->session, new_status); |
| 2464 | } else { | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2465 | gg_change_status_descr(info->session, new_status, new_msg); |
| 12964 | 2466 | g_free(new_msg); |
| 11360 | 2467 | } |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2468 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2469 | ggp_status_fake_to_self(account); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2470 | |
| 11360 | 2471 | } |
| 2472 | ||
| 15884 | 2473 | static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 11360 | 2474 | { |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2475 | PurpleAccount *account; |
| 11360 | 2476 | GGPInfo *info = gc->proto_data; |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
24043
diff
changeset
|
2477 | const gchar *name = purple_buddy_get_name(buddy); |
| 11360 | 2478 | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
24043
diff
changeset
|
2479 | 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
|
2480 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2481 | 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
|
2482 | if (strcmp(purple_account_get_username(account), name) == 0) { |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2483 | ggp_status_fake_to_self(account); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2484 | } |
| 11360 | 2485 | } |
| 2486 | ||
| 15884 | 2487 | static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
| 2488 | PurpleGroup *group) | |
| 11360 | 2489 | { |
| 2490 | GGPInfo *info = gc->proto_data; | |
| 2491 | ||
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
24043
diff
changeset
|
2492 | gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy))); |
| 11360 | 2493 | } |
| 2494 | ||
| 15884 | 2495 | static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) |
| 11394 | 2496 | { |
| 2497 | GGPInfo *info = gc->proto_data; | |
| 2498 | GGPChat *chat; | |
| 2499 | char *chat_name; | |
| 2500 | GList *l; | |
| 15884 | 2501 | PurpleConversation *conv; |
| 2502 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 11394 | 2503 | |
| 2504 | chat_name = g_hash_table_lookup(data, "name"); | |
| 2505 | ||
| 2506 | if (chat_name == NULL) | |
| 2507 | return; | |
| 2508 | ||
| 15884 | 2509 | purple_debug_info("gg", "joined %s chat\n", chat_name); |
| 11394 | 2510 | |
| 2511 | for (l = info->chats; l != NULL; l = l->next) { | |
| 2512 | chat = l->data; | |
| 2513 | ||
| 2514 | if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) { | |
| 15884 | 2515 | purple_notify_error(gc, _("Chat error"), |
| 12007 | 2516 | _("This chat name is already in use"), NULL); |
| 11394 | 2517 | return; |
| 2518 | } | |
| 2519 | } | |
| 2520 | ||
| 11414 | 2521 | ggp_confer_add_new(gc, chat_name); |
| 12961 | 2522 | conv = serv_got_joined_chat(gc, info->chats_count, chat_name); |
| 15884 | 2523 | purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), |
| 2524 | purple_account_get_username(account), NULL, | |
| 2525 | PURPLE_CBFLAGS_NONE, TRUE); | |
| 11394 | 2526 | } |
| 2527 | ||
| 2528 | static char *ggp_get_chat_name(GHashTable *data) { | |
| 2529 | return g_strdup(g_hash_table_lookup(data, "name")); | |
| 2530 | } | |
| 2531 | ||
| 15884 | 2532 | static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) |
| 11394 | 2533 | { |
| 15884 | 2534 | PurpleConversation *conv; |
| 11394 | 2535 | GGPInfo *info = gc->proto_data; |
| 2536 | GGPChat *chat = NULL; | |
| 2537 | GList *l; | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2538 | /* char *msg, *plain; */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2539 | gchar *msg; |
| 11394 | 2540 | uin_t *uins; |
| 2541 | int count = 0; | |
| 2542 | ||
| 15884 | 2543 | if ((conv = purple_find_chat(gc, id)) == NULL) |
| 11394 | 2544 | return -EINVAL; |
| 2545 | ||
| 2546 | for (l = info->chats; l != NULL; l = l->next) { | |
| 2547 | chat = l->data; | |
| 2548 | ||
| 2549 | if (g_utf8_collate(chat->name, conv->name) == 0) { | |
| 2550 | break; | |
| 2551 | } | |
| 2552 | ||
| 2553 | chat = NULL; | |
| 2554 | } | |
| 2555 | ||
| 2556 | if (chat == NULL) { | |
| 15884 | 2557 | purple_debug_error("gg", |
| 12007 | 2558 | "ggp_chat_send: Hm... that's strange. No such chat?\n"); |
| 11394 | 2559 | return -EINVAL; |
| 2560 | } | |
| 2561 | ||
| 2562 | uins = g_new0(uin_t, g_list_length(chat->participants)); | |
| 12961 | 2563 | |
| 11394 | 2564 | for (l = chat->participants; l != NULL; l = l->next) { |
| 12961 | 2565 | uin_t uin = GPOINTER_TO_INT(l->data); |
| 11394 | 2566 | |
| 12961 | 2567 | uins[count++] = uin; |
| 11394 | 2568 | } |
| 2569 | ||
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2570 | /* |
| 15884 | 2571 | plain = purple_unescape_html(message); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2572 | msg = charset_convert(plain, "UTF-8", "CP1250"); |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2573 | g_free(plain); |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2574 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2575 | msg = purple_unescape_html(message); |
| 12007 | 2576 | gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins, |
| 12961 | 2577 | (unsigned char *)msg); |
| 11394 | 2578 | g_free(msg); |
| 2579 | g_free(uins); | |
| 2580 | ||
| 12007 | 2581 | serv_got_chat_in(gc, id, |
| 15884 | 2582 | 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
|
2583 | flags, message, time(NULL)); |
| 11394 | 2584 | |
| 2585 | return 0; | |
| 2586 | } | |
| 2587 | ||
| 15884 | 2588 | static void ggp_keepalive(PurpleConnection *gc) |
| 11360 | 2589 | { |
| 2590 | GGPInfo *info = gc->proto_data; | |
| 2591 | ||
| 15884 | 2592 | /* purple_debug_info("gg", "Keeping connection alive....\n"); */ |
| 11360 | 2593 | |
| 2594 | if (gg_ping(info->session) < 0) { | |
| 15884 | 2595 | purple_debug_info("gg", "Not connected to the server " |
| 11360 | 2596 | "or gg_session is not correct\n"); |
| 21279 | 2597 | purple_connection_error_reason (gc, |
| 2598 | 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
|
2599 | _("Not connected to the server")); |
| 4916 | 2600 | } |
| 2393 | 2601 | } |
| 11360 | 2602 | |
| 15884 | 2603 | static void ggp_register_user(PurpleAccount *account) |
| 11360 | 2604 | { |
| 15884 | 2605 | PurpleConnection *gc = purple_account_get_connection(account); |
| 11360 | 2606 | |
| 12007 | 2607 | ggp_token_request(gc, ggp_register_user_dialog); |
| 2393 | 2608 | } |
| 2609 | ||
| 15884 | 2610 | static GList *ggp_actions(PurplePlugin *plugin, gpointer context) |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2611 | { |
| 11360 | 2612 | GList *m = NULL; |
| 15884 | 2613 | PurplePluginAction *act; |
| 11360 | 2614 | |
| 15884 | 2615 | act = purple_plugin_action_new(_("Find buddies..."), |
| 12007 | 2616 | ggp_find_buddies); |
| 11360 | 2617 | m = g_list_append(m, act); |
| 2618 | ||
| 2619 | m = g_list_append(m, NULL); | |
| 2620 | ||
| 15884 | 2621 | act = purple_plugin_action_new(_("Change password..."), |
| 12007 | 2622 | ggp_change_passwd); |
| 11360 | 2623 | m = g_list_append(m, act); |
| 2624 | ||
| 2625 | m = g_list_append(m, NULL); | |
| 2626 | ||
| 15884 | 2627 | act = purple_plugin_action_new(_("Upload buddylist to Server"), |
| 12007 | 2628 | ggp_action_buddylist_put); |
| 11360 | 2629 | m = g_list_append(m, act); |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2630 | |
| 15884 | 2631 | act = purple_plugin_action_new(_("Download buddylist from Server"), |
| 12007 | 2632 | ggp_action_buddylist_get); |
| 11360 | 2633 | m = g_list_append(m, act); |
| 2634 | ||
| 15884 | 2635 | act = purple_plugin_action_new(_("Delete buddylist from Server"), |
| 12007 | 2636 | ggp_action_buddylist_delete); |
| 11360 | 2637 | m = g_list_append(m, act); |
| 2638 | ||
| 15884 | 2639 | act = purple_plugin_action_new(_("Save buddylist to file..."), |
| 12007 | 2640 | ggp_action_buddylist_save); |
| 11360 | 2641 | m = g_list_append(m, act); |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2642 | |
| 15884 | 2643 | act = purple_plugin_action_new(_("Load buddylist from file..."), |
| 12007 | 2644 | ggp_action_buddylist_load); |
| 11360 | 2645 | m = g_list_append(m, act); |
| 2646 | ||
|
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
|
2647 | act = purple_plugin_action_new(_("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
|
2648 | ggp_action_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
|
2649 | m = g_list_append(m, act); |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
2650 | |
| 11360 | 2651 | return m; |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2652 | } |
|
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2653 | |
| 15884 | 2654 | static gboolean ggp_offline_message(const PurpleBuddy *buddy) |
|
13298
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2655 | { |
|
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2656 | return TRUE; |
|
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2657 | } |
|
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2658 | |
| 15884 | 2659 | static PurplePluginProtocolInfo prpl_info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2660 | { |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2661 | OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, |
| 12007 | 2662 | NULL, /* user_splits */ |
| 2663 | 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
|
2664 | {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ |
| 11360 | 2665 | ggp_list_icon, /* list_icon */ |
| 15524 | 2666 | NULL, /* list_emblem */ |
| 11360 | 2667 | ggp_status_text, /* status_text */ |
| 2668 | ggp_tooltip_text, /* tooltip_text */ | |
| 2669 | ggp_status_types, /* status_types */ | |
| 12007 | 2670 | ggp_blist_node_menu, /* blist_node_menu */ |
| 11394 | 2671 | ggp_chat_info, /* chat_info */ |
| 12007 | 2672 | NULL, /* chat_info_defaults */ |
| 2673 | ggp_login, /* login */ | |
| 2674 | ggp_close, /* close */ | |
| 11360 | 2675 | ggp_send_im, /* send_im */ |
| 12007 | 2676 | NULL, /* set_info */ |
|
31648
03cb811f6382
This patch from kkszysiu and tomkiewicz implements full typing notification
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31630
diff
changeset
|
2677 | ggp_send_typing, /* send_typing */ |
| 11360 | 2678 | ggp_get_info, /* get_info */ |
| 2679 | ggp_set_status, /* set_away */ | |
| 12007 | 2680 | NULL, /* set_idle */ |
| 2681 | NULL, /* change_passwd */ | |
| 11360 | 2682 | ggp_add_buddy, /* add_buddy */ |
| 12007 | 2683 | NULL, /* add_buddies */ |
| 11360 | 2684 | ggp_remove_buddy, /* remove_buddy */ |
| 12007 | 2685 | NULL, /* remove_buddies */ |
| 2686 | NULL, /* add_permit */ | |
| 2687 | NULL, /* add_deny */ | |
| 2688 | NULL, /* rem_permit */ | |
| 2689 | NULL, /* rem_deny */ | |
| 2690 | NULL, /* set_permit_deny */ | |
| 11394 | 2691 | ggp_join_chat, /* join_chat */ |
| 12007 | 2692 | NULL, /* reject_chat */ |
| 11394 | 2693 | ggp_get_chat_name, /* get_chat_name */ |
| 12007 | 2694 | NULL, /* chat_invite */ |
| 2695 | NULL, /* chat_leave */ | |
| 2696 | NULL, /* chat_whisper */ | |
| 11394 | 2697 | ggp_chat_send, /* chat_send */ |
| 11360 | 2698 | ggp_keepalive, /* keepalive */ |
| 2699 | ggp_register_user, /* register_user */ | |
| 12007 | 2700 | NULL, /* get_cb_info */ |
| 2701 | NULL, /* get_cb_away */ | |
| 2702 | NULL, /* alias_buddy */ | |
| 2703 | NULL, /* group_buddy */ | |
| 2704 | NULL, /* rename_group */ | |
| 2705 | NULL, /* buddy_free */ | |
| 2706 | NULL, /* convo_closed */ | |
| 2707 | NULL, /* normalize */ | |
| 2708 | NULL, /* set_buddy_icon */ | |
| 2709 | NULL, /* remove_group */ | |
| 2710 | NULL, /* get_cb_real_name */ | |
| 2711 | NULL, /* set_chat_topic */ | |
| 2712 | NULL, /* find_blist_chat */ | |
| 2713 | NULL, /* roomlist_get_list */ | |
| 2714 | NULL, /* roomlist_cancel */ | |
| 2715 | NULL, /* roomlist_expand_category */ | |
| 2716 | NULL, /* can_receive_file */ | |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
12007
diff
changeset
|
2717 | NULL, /* send_file */ |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12595
diff
changeset
|
2718 | NULL, /* new_xfer */ |
|
13298
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2719 | ggp_offline_message, /* offline_message */ |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12595
diff
changeset
|
2720 | NULL, /* whiteboard_prpl_ops */ |
| 14604 | 2721 | NULL, /* send_raw */ |
| 15185 | 2722 | 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
|
2723 | 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
|
2724 | 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
|
2725 | NULL, /* get_attention_types */ |
|
23276
f4944cfaa1ff
Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22622
diff
changeset
|
2726 | sizeof(PurplePluginProtocolInfo), /* struct_size */ |
|
23707
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
2727 | NULL, /* get_account_text_table */ |
|
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
2728 | NULL, /* initiate_media */ |
| 29404 | 2729 | 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
|
2730 | 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
|
2731 | NULL, /* set_public_alias */ |
|
31595
ffc150f21bec
Update PRPL structs with new fields.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
2732 | NULL, /* get_public_alias */ |
|
ffc150f21bec
Update PRPL structs with new fields.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
2733 | NULL, /* add_buddy_with_invite */ |
|
ffc150f21bec
Update PRPL structs with new fields.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
2734 | NULL /* add_buddies_with_invite */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2735 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2736 | |
| 15884 | 2737 | static PurplePluginInfo info = { |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2738 | PURPLE_PLUGIN_MAGIC, /* magic */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2739 | 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
|
2740 | 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
|
2741 | 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
|
2742 | NULL, /* ui_requirement */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2743 | 0, /* flags */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2744 | NULL, /* dependencies */ |
| 15884 | 2745 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
| 11360 | 2746 | |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2747 | "prpl-gg", /* id */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2748 | "Gadu-Gadu", /* name */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2749 | DISPLAY_VERSION, /* version */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2750 | |
| 11360 | 2751 | N_("Gadu-Gadu Protocol Plugin"), /* summary */ |
| 2752 | 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
|
2753 | "boler@sourceforge.net", /* author */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2754 | PURPLE_WEBSITE, /* homepage */ |
| 11360 | 2755 | |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2756 | NULL, /* load */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2757 | NULL, /* unload */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2758 | NULL, /* destroy */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2759 | |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2760 | NULL, /* ui_info */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2761 | &prpl_info, /* extra_info */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2762 | NULL, /* prefs_info */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2763 | ggp_actions, /* actions */ |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2764 | |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2765 | /* padding */ |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2766 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2767 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2768 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2769 | NULL |
| 11360 | 2770 | }; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2771 | |
| 15884 | 2772 | static void purple_gg_debug_handler(int level, const char * format, va_list args) { |
| 2773 | PurpleDebugLevel purple_level; | |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2774 | char *msg = g_strdup_vprintf(format, args); |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2775 | |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2776 | /* This is pretty pointless since the GG_DEBUG levels don't correspond to |
| 15884 | 2777 | * the purple ones */ |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2778 | switch (level) { |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2779 | case GG_DEBUG_FUNCTION: |
| 15884 | 2780 | purple_level = PURPLE_DEBUG_INFO; |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2781 | break; |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2782 | case GG_DEBUG_MISC: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2783 | case GG_DEBUG_NET: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2784 | case GG_DEBUG_DUMP: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2785 | case GG_DEBUG_TRAFFIC: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2786 | default: |
| 15884 | 2787 | purple_level = PURPLE_DEBUG_MISC; |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2788 | break; |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2789 | } |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2790 | |
|
24683
3481a3320313
Backport the 'purple_debug_*(msg)' -> 'purple_debug_*("%s", msg);' fixes.
Richard Laager <rlaager@pidgin.im>
parents:
24569
diff
changeset
|
2791 | purple_debug(purple_level, "gg", "%s", msg); |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2792 | g_free(msg); |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2793 | } |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2794 | |
| 15884 | 2795 | static void init_plugin(PurplePlugin *plugin) |
| 2393 | 2796 | { |
| 15884 | 2797 | 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
|
2798 | GList *encryption_options = NULL; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2799 | |
| 15884 | 2800 | option = purple_account_option_string_new(_("Nickname"), |
| 12007 | 2801 | "nick", _("Gadu-Gadu User")); |
| 2802 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, | |
| 2803 | option); | |
| 3572 | 2804 | |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2805 | 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
|
2806 | "gg_server", ""); |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2807 | 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
|
2808 | option); |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2809 | |
|
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
|
2810 | #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
|
2811 | 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
|
2812 | 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
|
2813 | 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
|
2814 | 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
|
2815 | } |
|
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
|
2816 | |
|
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
|
2817 | ADD_VALUE(encryption_options, _("Don't use encryption"), "none"); |
|
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
|
2818 | 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
|
2819 | "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
|
2820 | #if 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
|
2821 | /* TODO */ |
|
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
|
2822 | ADD_VALUE(encryption_options, _("Require encryption"), "require_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
|
2823 | #endif |
|
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
|
2824 | |
|
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
|
2825 | 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
|
2826 | "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
|
2827 | 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
|
2828 | 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
|
2829 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2830 | my_protocol = plugin; |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2831 | |
| 15884 | 2832 | gg_debug_handler = purple_gg_debug_handler; |
| 2393 | 2833 | } |
| 2834 | ||
| 15884 | 2835 | PURPLE_INIT_PLUGIN(gg, init_plugin, info); |
| 11360 | 2836 | |
| 12007 | 2837 | /* vim: set ts=8 sts=0 sw=8 noet: */ |