Sun, 13 Mar 2011 16:10:16 +0000
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Fixes #13358.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
| 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")); |
|
909496097dcf
Gadu-Gadu: Allow showing your status only to people on your buddy list.
Mateusz Piękos <mateuszpiekos@gmail.com>
parents:
31386
diff
changeset
|
798 | purple_request_field_choice_add(field, _("Only friends")); |
|
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 | GGPInfo *info; |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
822 | PurpleConnection *conn; |
| 15884 | 823 | 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
|
824 | GList *sel; |
| 11394 | 825 | |
|
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
|
826 | 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
|
827 | |
|
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 | 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
|
829 | |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
830 | info = conn->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
|
831 | |
| 15884 | 832 | field = purple_request_fields_get_field(fields, "name"); |
| 833 | sel = purple_request_field_list_get_selected(field); | |
| 11394 | 834 | |
|
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
|
835 | 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
|
836 | 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
|
837 | 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
|
838 | } |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
839 | |
|
78be70c986d3
Fix some bogocity related to the GG "Add To Chat" menu item. Fixes #8112.
Daniel Atallah <datallah@pidgin.im>
parents:
24747
diff
changeset
|
840 | 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
|
841 | ggp_str_to_uin(purple_buddy_get_name(buddy))); |
| 11394 | 842 | } |
| 843 | ||
| 15884 | 844 | static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) |
| 11394 | 845 | { |
| 15884 | 846 | PurpleBuddy *buddy; |
| 847 | PurpleConnection *gc; | |
| 11394 | 848 | GGPInfo *info; |
| 849 | ||
| 15884 | 850 | PurpleRequestFields *fields; |
| 851 | PurpleRequestFieldGroup *group; | |
| 852 | PurpleRequestField *field; | |
| 11394 | 853 | |
| 854 | GList *l; | |
| 855 | gchar *msg; | |
| 856 | ||
| 15884 | 857 | buddy = (PurpleBuddy *)node; |
| 858 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | |
| 11394 | 859 | info = gc->proto_data; |
| 860 | ||
| 15884 | 861 | fields = purple_request_fields_new(); |
| 862 | group = purple_request_field_group_new(NULL); | |
| 863 | purple_request_fields_add_group(fields, group); | |
| 11394 | 864 | |
| 15884 | 865 | field = purple_request_field_list_new("name", "Chat name"); |
| 11394 | 866 | for (l = info->chats; l != NULL; l = l->next) { |
| 867 | 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
|
868 | purple_request_field_list_add(field, chat->name, chat->name); |
| 11394 | 869 | } |
| 15884 | 870 | purple_request_field_group_add_field(group, field); |
| 11394 | 871 | |
| 12007 | 872 | msg = g_strdup_printf(_("Select a chat for buddy: %s"), |
| 15884 | 873 | purple_buddy_get_alias(buddy)); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
874 | purple_request_fields(gc, |
| 11394 | 875 | _("Add to chat..."), |
| 876 | _("Add to chat..."), | |
| 877 | msg, | |
| 878 | fields, | |
| 879 | _("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
|
880 | _("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
|
881 | 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
|
882 | buddy); |
| 11394 | 883 | g_free(msg); |
| 884 | } | |
| 885 | ||
| 11414 | 886 | /* ----- BLOCK BUDDIES -------------------------------------------------- */ |
| 887 | ||
| 15884 | 888 | static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) |
| 11410 | 889 | { |
| 15884 | 890 | PurpleConnection *gc; |
| 891 | PurpleBuddy *buddy; | |
| 11410 | 892 | GGPInfo *info; |
| 893 | uin_t uin; | |
| 894 | ||
| 15884 | 895 | buddy = (PurpleBuddy *)node; |
| 896 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | |
| 11410 | 897 | info = gc->proto_data; |
| 898 | ||
| 15884 | 899 | uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); |
| 11410 | 900 | |
| 15884 | 901 | if (purple_blist_node_get_bool(node, "blocked")) { |
| 902 | purple_blist_node_set_bool(node, "blocked", FALSE); | |
| 11410 | 903 | gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); |
| 904 | gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); | |
| 15884 | 905 | purple_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin); |
| 11410 | 906 | } else { |
| 15884 | 907 | purple_blist_node_set_bool(node, "blocked", TRUE); |
| 11410 | 908 | gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); |
| 909 | gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); | |
| 15884 | 910 | purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); |
| 11410 | 911 | } |
| 912 | } | |
| 913 | ||
| 11360 | 914 | /* ---------------------------------------------------------------------- */ |
| 11414 | 915 | /* ----- INTERNAL CALLBACKS --------------------------------------------- */ |
| 916 | /* ---------------------------------------------------------------------- */ | |
| 917 | ||
|
27388
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
918 | struct gg_fetch_avatar_data |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
919 | { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
920 | PurpleConnection *gc; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
921 | gchar *uin; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
922 | gchar *avatar_url; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
923 | }; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
924 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
925 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
926 | 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
|
927 | 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
|
928 | 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
|
929 | PurpleAccount *account; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
930 | PurpleBuddy *buddy; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
931 | gpointer buddy_icon_data; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
932 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
933 | /* FIXME: This shouldn't be necessary */ |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
934 | if (!PURPLE_CONNECTION_IS_VALID(d->gc)) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
935 | g_free(d->uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
936 | g_free(d->avatar_url); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
937 | g_free(d); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
938 | g_return_if_reached(); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
939 | } |
|
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 | account = purple_connection_get_account(d->gc); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
942 | buddy = purple_find_buddy(account, d->uin); |
|
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 | if (buddy == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
945 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
946 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
947 | buddy_icon_data = g_memdup(data, len); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
948 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
949 | 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
|
950 | buddy_icon_data, len, d->avatar_url); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
951 | 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
|
952 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
953 | out: |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
954 | g_free(d->uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
955 | g_free(d->avatar_url); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
956 | g_free(d); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
957 | } |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
958 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
959 | 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
|
960 | 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
|
961 | struct gg_fetch_avatar_data *data; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
962 | PurpleConnection *gc = user_data; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
963 | PurpleAccount *account; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
964 | PurpleBuddy *buddy; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
965 | const char *uin; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
966 | const char *is_blank; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
967 | const char *checksum; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
968 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
969 | gchar *bigavatar = NULL; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
970 | xmlnode *xml = NULL; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
971 | xmlnode *xmlnode_users; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
972 | xmlnode *xmlnode_user; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
973 | xmlnode *xmlnode_avatars; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
974 | xmlnode *xmlnode_avatar; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
975 | xmlnode *xmlnode_bigavatar; |
|
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 | 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
|
978 | account = purple_connection_get_account(gc); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
979 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
980 | if (error_message != NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
981 | 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
|
982 | 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
|
983 | xml = xmlnode_from_str(url_text, -1); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
984 | if (xml == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
985 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
986 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
987 | xmlnode_users = xmlnode_get_child(xml, "users"); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
988 | if (xmlnode_users == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
989 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
990 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
991 | 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
|
992 | if (xmlnode_user == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
993 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
994 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
995 | uin = xmlnode_get_attrib(xmlnode_user, "uin"); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
996 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
997 | 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
|
998 | if (xmlnode_avatars == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
999 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1000 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1001 | 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
|
1002 | if (xmlnode_avatar == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1003 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1004 | |
|
29182
f11475f964ac
Fix Gadu-Gadu avatars. The server's response format has changed. Fixes #11050.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27642
diff
changeset
|
1005 | 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
|
1006 | if (xmlnode_bigavatar == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1007 | goto out; |
|
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 | 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
|
1010 | bigavatar = xmlnode_get_data(xmlnode_bigavatar); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1011 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1012 | 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
|
1013 | "URL %s\n", |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1014 | 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
|
1015 | bigavatar ? bigavatar : "(null)"); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1016 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1017 | if (uin != NULL && bigavatar != NULL) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1018 | buddy = purple_find_buddy(account, uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1019 | if (buddy == NULL) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1020 | goto out; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1021 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1022 | 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
|
1023 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1024 | if (purple_strequal(is_blank, "1")) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1025 | purple_buddy_icons_set_for_user(account, |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1026 | 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
|
1027 | } else if (!purple_strequal(checksum, bigavatar)) { |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1028 | 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
|
1029 | data->gc = gc; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1030 | data->uin = g_strdup(uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1031 | data->avatar_url = g_strdup(bigavatar); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1032 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1033 | 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
|
1034 | 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
|
1035 | 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
|
1036 | } |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1037 | } |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1038 | } |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1039 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1040 | out: |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1041 | if (xml) |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1042 | xmlnode_free(xml); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1043 | g_free(bigavatar); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1044 | } |
| 12964 | 1045 | |
| 11414 | 1046 | /** |
| 1047 | * Handle change of the status of the buddy. | |
| 1048 | * | |
| 15884 | 1049 | * @param gc PurpleConnection |
| 11414 | 1050 | * @param uin UIN of the buddy. |
| 1051 | * @param status ID of the status. | |
| 1052 | * @param descr Description. | |
| 1053 | */ | |
| 15884 | 1054 | static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, |
| 12007 | 1055 | int status, const char *descr) |
| 11414 | 1056 | { |
| 1057 | gchar *from; | |
| 1058 | const char *st; | |
|
27388
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1059 | gchar *avatarurl; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1060 | PurpleUtilFetchUrlData *url_data; |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1061 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1062 | from = g_strdup_printf("%u", uin); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1063 | avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%s/0.xml", from); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1064 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1065 | url_data = purple_util_fetch_url_request_len_with_account( |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1066 | purple_connection_get_account(gc), avatarurl, TRUE, |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1067 | "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1068 | gg_get_avatar_url_cb, gc); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1069 | |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1070 | g_free(avatarurl); |
|
e72ccf802d25
Support fetching Gadu-Gadu avatars. Closes #9371.
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
27371
diff
changeset
|
1071 | |
| 11414 | 1072 | switch (status) { |
| 1073 | case GG_STATUS_NOT_AVAIL: | |
| 1074 | 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
|
1075 | 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
|
1076 | break; |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1077 | case GG_STATUS_FFC: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1078 | case GG_STATUS_FFC_DESCR: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1079 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); |
| 11414 | 1080 | break; |
| 1081 | case GG_STATUS_AVAIL: | |
| 1082 | 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
|
1083 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); |
| 11414 | 1084 | break; |
| 1085 | case GG_STATUS_BUSY: | |
| 1086 | 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
|
1087 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AWAY); |
| 11414 | 1088 | break; |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1089 | case GG_STATUS_DND: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1090 | case GG_STATUS_DND_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_UNAVAILABLE); |
|
30055
1aa76ed6cda6
gadu-gadu: Add a missing 'break;'
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
30006
diff
changeset
|
1092 | break; |
| 11414 | 1093 | case GG_STATUS_BLOCKED: |
| 1094 | /* user is blocking us.... */ | |
| 1095 | st = "blocked"; | |
| 1096 | break; | |
| 1097 | default: | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1098 | st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); |
| 15884 | 1099 | purple_debug_info("gg", |
| 12007 | 1100 | "GG_EVENT_NOTIFY: Unknown status: %d\n", status); |
| 11414 | 1101 | break; |
| 1102 | } | |
| 1103 | ||
| 15884 | 1104 | 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
|
1105 | //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
|
1106 | if (descr == NULL) { |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1107 | 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
|
1108 | from, st, NULL); |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1109 | } else { |
|
3587e1e5fbe5
gadu-gadu: (NULL)-like descriptions and packet size problems. Fixes #11676
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29824
diff
changeset
|
1110 | 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
|
1111 | 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
|
1112 | } |
| 11414 | 1113 | g_free(from); |
| 1114 | } | |
| 1115 | ||
| 13643 | 1116 | static void ggp_sr_close_cb(gpointer user_data) |
| 12220 | 1117 | { |
| 13643 | 1118 | GGPSearchForm *form = user_data; |
| 13641 | 1119 | GGPInfo *info = form->user_data; |
| 12220 | 1120 | |
| 13641 | 1121 | 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
|
1122 | purple_debug_info("gg", "ggp_sr_close_cb(): Removed seq %u", form->seq); |
| 13641 | 1123 | ggp_search_form_destroy(form); |
| 12220 | 1124 | } |
| 1125 | ||
| 13645 | 1126 | /** |
| 1127 | * Translate a status' ID to a more user-friendly name. | |
| 1128 | * | |
| 1129 | * @param id The ID of the status. | |
| 1130 | * | |
| 1131 | * @return The user-friendly name of the status. | |
| 1132 | */ | |
| 1133 | static const char *ggp_status_by_id(unsigned int id) | |
| 1134 | { | |
| 1135 | const char *st; | |
| 1136 | ||
| 15884 | 1137 | purple_debug_info("gg", "ggp_status_by_id: %d\n", id); |
| 13645 | 1138 | switch (id) { |
| 1139 | 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
|
1140 | case GG_STATUS_NOT_AVAIL_DESCR: |
| 13645 | 1141 | st = _("Offline"); |
| 1142 | break; | |
| 1143 | 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
|
1144 | case GG_STATUS_AVAIL_DESCR: |
| 13645 | 1145 | st = _("Available"); |
| 1146 | break; | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1147 | case GG_STATUS_FFC: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1148 | case GG_STATUS_FFC_DESCR: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1149 | return _("Chatty"); |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1150 | case GG_STATUS_DND: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1151 | case GG_STATUS_DND_DESCR: |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1152 | return _("Do Not Disturb"); |
| 13645 | 1153 | 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
|
1154 | case GG_STATUS_BUSY_DESCR: |
| 13645 | 1155 | st = _("Away"); |
| 1156 | break; | |
| 1157 | default: | |
| 1158 | st = _("Unknown"); | |
| 1159 | break; | |
| 1160 | } | |
| 1161 | ||
| 1162 | return st; | |
| 1163 | } | |
| 1164 | ||
| 15884 | 1165 | static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, |
| 13643 | 1166 | GGPSearchForm *form) |
| 12007 | 1167 | { |
| 15884 | 1168 | PurpleNotifyUserInfo *user_info; |
| 1169 | PurpleBuddy *buddy; | |
| 13643 | 1170 | char *val, *who; |
| 1171 | ||
| 15884 | 1172 | user_info = purple_notify_user_info_new(); |
| 13643 | 1173 | |
| 1174 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS); | |
| 13645 | 1175 | /* XXX: Use of ggp_str_to_uin() is an ugly hack! */ |
| 15884 | 1176 | purple_notify_user_info_add_pair(user_info, _("Status"), ggp_status_by_id(ggp_str_to_uin(val))); |
| 13643 | 1177 | g_free(val); |
| 1178 | ||
| 1179 | who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN); | |
| 15884 | 1180 | purple_notify_user_info_add_pair(user_info, _("UIN"), who); |
| 13643 | 1181 | |
| 1182 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME); | |
| 15884 | 1183 | purple_notify_user_info_add_pair(user_info, _("First Name"), val); |
| 13643 | 1184 | g_free(val); |
| 1185 | ||
| 1186 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME); | |
| 15884 | 1187 | purple_notify_user_info_add_pair(user_info, _("Nickname"), val); |
| 13643 | 1188 | g_free(val); |
| 1189 | ||
| 1190 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY); | |
| 15884 | 1191 | purple_notify_user_info_add_pair(user_info, _("City"), val); |
| 13643 | 1192 | g_free(val); |
| 1193 | ||
| 1194 | val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR); | |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1195 | if (strncmp(val, "0", 1)) { |
| 15884 | 1196 | purple_notify_user_info_add_pair(user_info, _("Birth Year"), val); |
| 13643 | 1197 | } |
| 1198 | g_free(val); | |
| 1199 | ||
| 15294 | 1200 | /* |
| 1201 | * Include a status message, if exists and buddy is in the blist. | |
| 1202 | */ | |
| 15884 | 1203 | buddy = purple_find_buddy(purple_connection_get_account(gc), who); |
| 15294 | 1204 | if (NULL != buddy) { |
| 15884 | 1205 | PurpleStatus *status; |
| 15294 | 1206 | const char *msg; |
| 1207 | char *text; | |
| 13643 | 1208 | |
| 15884 | 1209 | status = purple_presence_get_active_status(purple_buddy_get_presence(buddy)); |
| 1210 | msg = purple_status_get_attr_string(status, "message"); | |
| 13643 | 1211 | |
| 15294 | 1212 | if (msg != NULL) { |
| 1213 | text = g_markup_escape_text(msg, -1); | |
| 15884 | 1214 | purple_notify_user_info_add_pair(user_info, _("Message"), text); |
| 15294 | 1215 | g_free(text); |
| 1216 | } | |
| 1217 | } | |
| 1218 | ||
|
18629
9e78088bfc46
Close temporary Get Info window when showing the real one. Fixes #1720.
Bartosz Oler <bartosz@pidgin.im>
parents:
18190
diff
changeset
|
1219 | purple_notify_userinfo(gc, who, user_info, ggp_sr_close_cb, form); |
| 15294 | 1220 | g_free(who); |
| 15884 | 1221 | purple_notify_user_info_destroy(user_info); |
| 13643 | 1222 | } |
| 1223 | ||
| 15884 | 1224 | static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, |
| 13643 | 1225 | GGPSearchForm *form) |
| 1226 | { | |
| 15884 | 1227 | PurpleNotifySearchResults *results; |
| 1228 | PurpleNotifySearchColumn *column; | |
| 13643 | 1229 | int res_count; |
| 12007 | 1230 | int start; |
| 1231 | int i; | |
| 13641 | 1232 | |
| 13643 | 1233 | g_return_if_fail(form != NULL); |
| 12007 | 1234 | |
| 1235 | res_count = gg_pubdir50_count(req); | |
| 13643 | 1236 | res_count = (res_count > PUBDIR_RESULTS_MAX) ? PUBDIR_RESULTS_MAX : res_count; |
| 12007 | 1237 | |
| 15884 | 1238 | results = purple_notify_searchresults_new(); |
| 12007 | 1239 | |
| 12257 | 1240 | if (results == NULL) { |
| 15884 | 1241 | purple_debug_error("gg", "ggp_pubdir_reply_handler: " |
| 12257 | 1242 | "Unable to display the search results.\n"); |
| 15884 | 1243 | purple_notify_error(gc, NULL, |
| 12257 | 1244 | _("Unable to display the search results."), |
| 1245 | NULL); | |
| 13641 | 1246 | ggp_sr_close_cb(form); |
| 12257 | 1247 | return; |
| 1248 | } | |
| 1249 | ||
| 15884 | 1250 | column = purple_notify_searchresults_column_new(_("UIN")); |
| 1251 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1252 | |
| 15884 | 1253 | column = purple_notify_searchresults_column_new(_("First Name")); |
| 1254 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1255 | |
| 15884 | 1256 | column = purple_notify_searchresults_column_new(_("Nickname")); |
| 1257 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1258 | |
| 15884 | 1259 | column = purple_notify_searchresults_column_new(_("City")); |
| 1260 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1261 | |
| 15884 | 1262 | column = purple_notify_searchresults_column_new(_("Birth Year")); |
| 1263 | purple_notify_searchresults_column_add(results, column); | |
| 12007 | 1264 | |
| 15884 | 1265 | purple_debug_info("gg", "Going with %d entries\n", res_count); |
| 12007 | 1266 | |
| 1267 | start = (int)ggp_str_to_uin(gg_pubdir50_get(req, 0, GG_PUBDIR50_START)); | |
| 15884 | 1268 | purple_debug_info("gg", "start = %d\n", start); |
| 12007 | 1269 | |
| 1270 | for (i = 0; i < res_count; i++) { | |
| 1271 | GList *row = NULL; | |
| 1272 | char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR); | |
| 1273 | ||
| 1274 | /* TODO: Status will be displayed as an icon. */ | |
| 1275 | /* row = g_list_append(row, ggp_search_get_result(req, i, GG_PUBDIR50_STATUS)); */ | |
| 1276 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1277 | GG_PUBDIR50_UIN)); | |
| 1278 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1279 | GG_PUBDIR50_FIRSTNAME)); | |
| 1280 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1281 | GG_PUBDIR50_NICKNAME)); | |
| 1282 | row = g_list_append(row, ggp_search_get_result(req, i, | |
| 1283 | GG_PUBDIR50_CITY)); | |
| 1284 | row = g_list_append(row, | |
| 1285 | (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-")); | |
| 1286 | ||
| 15884 | 1287 | purple_notify_searchresults_row_add(results, row); |
| 12007 | 1288 | |
| 1289 | if (i == res_count - 1) { | |
| 13641 | 1290 | g_free(form->last_uin); |
| 1291 | form->last_uin = ggp_search_get_result(req, i, GG_PUBDIR50_UIN); | |
| 12007 | 1292 | } |
| 1293 | } | |
| 1294 | ||
| 15884 | 1295 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_CONTINUE, |
| 12007 | 1296 | ggp_callback_show_next); |
| 15884 | 1297 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, |
| 12007 | 1298 | ggp_callback_add_buddy); |
| 15884 | 1299 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_IM, |
| 13642 | 1300 | ggp_callback_im); |
| 13643 | 1301 | |
| 13641 | 1302 | if (form->window == NULL) { |
| 15884 | 1303 | void *h = purple_notify_searchresults(gc, |
| 12007 | 1304 | _("Gadu-Gadu Public Directory"), |
| 12220 | 1305 | _("Search results"), NULL, results, |
| 15884 | 1306 | (PurpleNotifyCloseCallback)ggp_sr_close_cb, |
| 13641 | 1307 | form); |
| 12257 | 1308 | |
|
12277
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1309 | if (h == NULL) { |
| 15884 | 1310 | purple_debug_error("gg", "ggp_pubdir_reply_handler: " |
|
12277
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1311 | "Unable to display the search results.\n"); |
| 15884 | 1312 | purple_notify_error(gc, NULL, |
|
12277
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1313 | _("Unable to display the search results."), |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1314 | NULL); |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1315 | return; |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1316 | } |
|
6e45a609022c
[gaim-migrate @ 14581]
Richard Laager <rlaager@pidgin.im>
parents:
12258
diff
changeset
|
1317 | |
| 13641 | 1318 | form->window = h; |
| 12007 | 1319 | } else { |
| 15884 | 1320 | purple_notify_searchresults_new_rows(gc, results, form->window); |
| 12007 | 1321 | } |
| 1322 | } | |
| 1323 | ||
| 15884 | 1324 | static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) |
| 13643 | 1325 | { |
| 1326 | GGPInfo *info = gc->proto_data; | |
| 1327 | GGPSearchForm *form; | |
| 1328 | int res_count; | |
| 1329 | guint32 seq; | |
| 1330 | ||
| 1331 | seq = gg_pubdir50_seq(req); | |
| 1332 | 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
|
1333 | purple_debug_info("gg", "ggp_pubdir_reply_handler(): seq %u --> form %p", seq, form); |
| 13643 | 1334 | /* |
| 1335 | * this can happen when user will request more results | |
| 1336 | * and close the results window before they arrive. | |
| 1337 | */ | |
| 1338 | g_return_if_fail(form != NULL); | |
| 1339 | ||
| 1340 | res_count = gg_pubdir50_count(req); | |
| 1341 | if (res_count < 1) { | |
| 15884 | 1342 | purple_debug_info("gg", "GG_EVENT_PUBDIR50_SEARCH_REPLY: Nothing found\n"); |
| 1343 | purple_notify_error(gc, NULL, | |
| 13643 | 1344 | _("No matching users found"), |
| 1345 | _("There are no users matching your search criteria.")); | |
| 1346 | ggp_sr_close_cb(form); | |
| 1347 | return; | |
| 1348 | } | |
| 1349 | ||
| 1350 | switch (form->search_type) { | |
| 1351 | case GGP_SEARCH_TYPE_INFO: | |
| 1352 | ggp_pubdir_handle_info(gc, req, form); | |
| 1353 | break; | |
| 1354 | case GGP_SEARCH_TYPE_FULL: | |
| 1355 | ggp_pubdir_handle_full(gc, req, form); | |
| 1356 | break; | |
| 1357 | default: | |
| 15884 | 1358 | purple_debug_warning("gg", "Unknown search_type!\n"); |
| 13643 | 1359 | break; |
| 1360 | } | |
| 1361 | } | |
| 1362 | ||
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1363 | 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
|
1364 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1365 | gint imgid = 0; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1366 | 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
|
1367 | 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
|
1368 | 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
|
1369 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1370 | 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
|
1371 | 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
|
1372 | 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
|
1373 | 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
|
1374 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1375 | 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
|
1376 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1377 | while(entry) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1378 | 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
|
1379 | 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
|
1380 | 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
|
1381 | 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
|
1382 | g_strfreev(split); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1383 | 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
|
1384 | /* 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
|
1385 | if (strstr(text, "<IMG ID=\"IMGID_HANDLER") == NULL) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1386 | gchar *buf = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1387 | serv_got_im(gc, buf, text, PURPLE_MESSAGE_IMAGES, ev->event.msg.time); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1388 | g_free(buf); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1389 | 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
|
1390 | g_free(text); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1391 | break; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1392 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1393 | 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
|
1394 | break; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1395 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1396 | 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
|
1397 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1398 | g_free(handlerid); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1399 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1400 | return; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1401 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1402 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1403 | |
| 11414 | 1404 | /** |
| 1405 | * Dispatch a message received from a buddy. | |
| 1406 | * | |
| 15884 | 1407 | * @param gc PurpleConnection. |
| 11414 | 1408 | * @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
|
1409 | * |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1410 | * Image receiving, some code borrowed from Kadu http://www.kadu.net |
| 11414 | 1411 | */ |
| 15884 | 1412 | static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) |
| 11414 | 1413 | { |
| 1414 | GGPInfo *info = gc->proto_data; | |
| 15884 | 1415 | PurpleConversation *conv; |
| 11414 | 1416 | gchar *from; |
| 1417 | gchar *msg; | |
| 1418 | gchar *tmp; | |
| 1419 | ||
| 1420 | from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); | |
| 1421 | ||
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1422 | /* |
| 12961 | 1423 | tmp = charset_convert((const char *)ev->event.msg.message, |
| 12007 | 1424 | "CP1250", "UTF-8"); |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1425 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1426 | tmp = g_strdup_printf("%s", ev->event.msg.message); |
| 15884 | 1427 | purple_str_strip_char(tmp, '\r'); |
| 12961 | 1428 | msg = g_markup_escape_text(tmp, -1); |
| 1429 | g_free(tmp); | |
| 11414 | 1430 | |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1431 | /* We got richtext message */ |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1432 | 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
|
1433 | { |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
1434 | 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
|
1435 | 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
|
1436 | 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
|
1437 | gint increased_len = 0; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1438 | 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
|
1439 | 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
|
1440 | 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
|
1441 | gchar *handlerid; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1442 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1443 | 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
|
1444 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1445 | while (cformats < cformats_end) |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1446 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1447 | gint byteoffset; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1448 | 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
|
1449 | 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
|
1450 | 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
|
1451 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1452 | 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
|
1453 | 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
|
1454 | continue; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1455 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1456 | 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
|
1457 | actformat->position, |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1458 | (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
|
1459 | (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
|
1460 | (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
|
1461 | (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
|
1462 | increased_len); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1463 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1464 | 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
|
1465 | got_image = TRUE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1466 | 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
|
1467 | 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
|
1468 | 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
|
1469 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1470 | /* 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
|
1471 | * 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
|
1472 | if (actimage->size > 255000) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1473 | 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
|
1474 | continue; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1475 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1476 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1477 | 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
|
1478 | actimage->size, actimage->crc32); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1479 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1480 | 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
|
1481 | 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
|
1482 | increased_len += strlen(handlerid); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1483 | g_free(handlerid); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1484 | continue; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1485 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1486 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1487 | 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
|
1488 | if (bold == FALSE) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1489 | 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
|
1490 | increased_len += 3; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1491 | bold = TRUE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1492 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1493 | } else if (bold) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1494 | 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
|
1495 | increased_len += 4; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1496 | bold = FALSE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1497 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1498 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1499 | 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
|
1500 | if (italic == FALSE) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1501 | 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
|
1502 | increased_len += 3; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1503 | italic = TRUE; |
|
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 | } else if (italic) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1506 | 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
|
1507 | increased_len += 4; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1508 | italic = FALSE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1509 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1510 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1511 | 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
|
1512 | if (under == FALSE) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1513 | 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
|
1514 | increased_len += 3; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1515 | under = TRUE; |
|
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 | } else if (under) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1518 | 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
|
1519 | increased_len += 4; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1520 | under = FALSE; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1521 | } |
|
31386
85d81b2b1142
gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31294
diff
changeset
|
1522 | |
|
85d81b2b1142
gg: Prevent dropping whole messages when the text is colored. Fixes #13259.
Jan Zachorowski <quantifier666@gmail.com>
parents:
31294
diff
changeset
|
1523 | 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
|
1524 | 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
|
1525 | } |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1526 | } |
|
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 | msg = message->str; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1529 | 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
|
1530 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1531 | if (got_image) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1532 | 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
|
1533 | return; |
|
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 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1536 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1537 | purple_debug_info("gg", "ggp_recv_message_handler: msg from (%s): %s (class = %d; rcpt_count = %d)\n", |
| 12961 | 1538 | from, msg, ev->event.msg.msgclass, |
| 12007 | 1539 | ev->event.msg.recipients_count); |
| 11414 | 1540 | |
| 1541 | if (ev->event.msg.recipients_count == 0) { | |
| 12961 | 1542 | serv_got_im(gc, from, msg, 0, ev->event.msg.time); |
| 11414 | 1543 | } else { |
|
12373
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1544 | const char *chat_name; |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1545 | int chat_id; |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1546 | char *buddy_name; |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1547 | |
| 11414 | 1548 | chat_name = ggp_confer_find_by_participants(gc, |
| 12007 | 1549 | ev->event.msg.recipients, |
| 1550 | ev->event.msg.recipients_count); | |
| 12961 | 1551 | |
| 11414 | 1552 | if (chat_name == NULL) { |
| 1553 | chat_name = ggp_confer_add_new(gc, NULL); | |
| 1554 | serv_got_joined_chat(gc, info->chats_count, chat_name); | |
| 12007 | 1555 | |
| 1556 | ggp_confer_participants_add_uin(gc, chat_name, | |
| 1557 | ev->event.msg.sender); | |
| 1558 | ||
| 1559 | ggp_confer_participants_add(gc, chat_name, | |
| 1560 | ev->event.msg.recipients, | |
| 1561 | ev->event.msg.recipients_count); | |
| 11414 | 1562 | } |
| 1563 | conv = ggp_confer_find_by_name(gc, chat_name); | |
| 15884 | 1564 | 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
|
1565 | |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1566 | buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender); |
|
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1567 | serv_got_chat_in(gc, chat_id, buddy_name, |
| 15884 | 1568 | PURPLE_MESSAGE_RECV, msg, ev->event.msg.time); |
|
12373
a8f71f73576d
[gaim-migrate @ 14677]
Richard Laager <rlaager@pidgin.im>
parents:
12277
diff
changeset
|
1569 | g_free(buddy_name); |
| 11414 | 1570 | } |
| 12961 | 1571 | g_free(msg); |
| 11414 | 1572 | g_free(from); |
| 1573 | } | |
| 1574 | ||
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1575 | 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
|
1576 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1577 | 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
|
1578 | PurpleStoredImage *image; |
|
24747
498c6dda6e48
Fix two warnings introduced by the image patch I committed earlier and make
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24746
diff
changeset
|
1579 | gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, &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
|
1580 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1581 | purple_debug_info("gg", "ggp_send_image_handler: image request received, crc32: %u\n", 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
|
1582 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1583 | if(imgid) |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1584 | { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1585 | 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
|
1586 | 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
|
1587 | 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
|
1588 | 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
|
1589 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1590 | 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
|
1591 | 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
|
1592 | purple_imgstore_unref(image); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1593 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1594 | 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
|
1595 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1596 | g_hash_table_remove(info->pending_images, &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
|
1597 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1598 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1599 | |
| 15884 | 1600 | static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) |
| 11414 | 1601 | { |
| 15884 | 1602 | PurpleConnection *gc = _gc; |
| 11414 | 1603 | GGPInfo *info = gc->proto_data; |
| 1604 | struct gg_event *ev; | |
| 1605 | int i; | |
| 1606 | ||
| 1607 | if (!(ev = gg_watch_fd(info->session))) { | |
| 15884 | 1608 | purple_debug_error("gg", |
| 12007 | 1609 | "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
| 21279 | 1610 | purple_connection_error_reason (gc, |
| 1611 | 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
|
1612 | _("Unable to read from socket")); |
| 11414 | 1613 | return; |
| 1614 | } | |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
21630
diff
changeset
|
1615 | gc->last_received = time(NULL); |
| 11414 | 1616 | switch (ev->type) { |
| 1617 | case GG_EVENT_NONE: | |
| 1618 | /* Nothing happened. */ | |
| 1619 | break; | |
| 1620 | case GG_EVENT_MSG: | |
| 1621 | ggp_recv_message_handler(gc, ev); | |
| 1622 | break; | |
| 1623 | 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
|
1624 | /* Changing %u to %i fixes compiler warning */ |
| 15884 | 1625 | 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
|
1626 | "ggp_callback_recv: message sent to: %i, delivery status=%d, seq=%d\n", |
| 12007 | 1627 | ev->event.ack.recipient, ev->event.ack.status, |
| 1628 | ev->event.ack.seq); | |
| 11414 | 1629 | break; |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1630 | 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
|
1631 | 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
|
1632 | break; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1633 | 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
|
1634 | 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
|
1635 | break; |
| 11414 | 1636 | case GG_EVENT_NOTIFY: |
| 1637 | case GG_EVENT_NOTIFY_DESCR: | |
| 1638 | { | |
| 1639 | struct gg_notify_reply *n; | |
| 1640 | char *descr; | |
| 1641 | ||
| 15884 | 1642 | purple_debug_info("gg", "notify_pre: (%d) status: %d\n", |
| 11414 | 1643 | ev->event.notify->uin, |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1644 | GG_S(ev->event.notify->status)); |
| 11414 | 1645 | |
| 1646 | n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify | |
| 1647 | : ev->event.notify_descr.notify; | |
| 1648 | ||
| 1649 | for (; n->uin; n++) { | |
| 1650 | descr = (ev->type == GG_EVENT_NOTIFY) ? NULL | |
| 12007 | 1651 | : ev->event.notify_descr.descr; |
| 1652 | ||
| 15884 | 1653 | purple_debug_info("gg", |
| 12007 | 1654 | "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
|
1655 | n->uin, GG_S(n->status), descr ? descr : "(null)"); |
| 11414 | 1656 | |
| 1657 | 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
|
1658 | n->uin, GG_S(n->status), descr); |
| 11414 | 1659 | } |
| 1660 | } | |
| 1661 | break; | |
| 1662 | case GG_EVENT_NOTIFY60: | |
| 1663 | for (i = 0; ev->event.notify60[i].uin; i++) { | |
| 15884 | 1664 | purple_debug_info("gg", |
| 12007 | 1665 | "notify60: (%d) status=%d; version=%d; descr=%s\n", |
| 1666 | 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
|
1667 | GG_S(ev->event.notify60[i].status), |
| 12007 | 1668 | ev->event.notify60[i].version, |
|
14524
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1669 | ev->event.notify60[i].descr ? ev->event.notify60[i].descr : "(null)"); |
| 11414 | 1670 | |
| 12007 | 1671 | 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
|
1672 | GG_S(ev->event.notify60[i].status), |
| 12007 | 1673 | ev->event.notify60[i].descr); |
| 11414 | 1674 | } |
| 1675 | break; | |
| 1676 | case GG_EVENT_STATUS: | |
| 15884 | 1677 | 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
|
1678 | ev->event.status.uin, GG_S(ev->event.status.status), |
|
14524
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1679 | ev->event.status.descr ? ev->event.status.descr : "(null)"); |
| 11414 | 1680 | |
| 12007 | 1681 | 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
|
1682 | GG_S(ev->event.status.status), ev->event.status.descr); |
| 11414 | 1683 | break; |
| 1684 | case GG_EVENT_STATUS60: | |
| 15884 | 1685 | purple_debug_info("gg", |
| 12007 | 1686 | "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
|
1687 | ev->event.status60.uin, GG_S(ev->event.status60.status), |
|
14524
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1688 | ev->event.status60.version, |
|
9637518e9703
[gaim-migrate @ 17176]
Daniel Atallah <datallah@pidgin.im>
parents:
14521
diff
changeset
|
1689 | ev->event.status60.descr ? ev->event.status60.descr : "(null)"); |
| 11414 | 1690 | |
| 12007 | 1691 | 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
|
1692 | GG_S(ev->event.status60.status), ev->event.status60.descr); |
| 11414 | 1693 | break; |
| 1694 | case GG_EVENT_USERLIST: | |
| 1695 | if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) { | |
| 15884 | 1696 | purple_debug_info("gg", "GG_USERLIST_GET_REPLY\n"); |
| 1697 | purple_notify_info(gc, NULL, | |
| 12220 | 1698 | _("Buddy list downloaded"), |
| 1699 | _("Your buddy list was downloaded from the server.")); | |
| 11414 | 1700 | if (ev->event.userlist.reply != NULL) { |
| 12007 | 1701 | ggp_buddylist_load(gc, ev->event.userlist.reply); |
| 11414 | 1702 | } |
| 1703 | } else { | |
| 15884 | 1704 | purple_debug_info("gg", "GG_USERLIST_PUT_REPLY\n"); |
| 1705 | purple_notify_info(gc, NULL, | |
| 12220 | 1706 | _("Buddy list uploaded"), |
| 1707 | _("Your buddy list was stored on the server.")); | |
| 11414 | 1708 | } |
| 1709 | break; | |
| 1710 | case GG_EVENT_PUBDIR50_SEARCH_REPLY: | |
| 12007 | 1711 | ggp_pubdir_reply_handler(gc, ev->event.pubdir50); |
| 1712 | break; | |
| 1713 | default: | |
| 15884 | 1714 | purple_debug_error("gg", |
| 12007 | 1715 | "unsupported event type=%d\n", ev->type); |
| 1716 | break; | |
| 1717 | } | |
| 11414 | 1718 | |
| 12007 | 1719 | gg_free_event(ev); |
| 1720 | } | |
| 11414 | 1721 | |
| 15884 | 1722 | static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond) |
| 12007 | 1723 | { |
| 15884 | 1724 | PurpleConnection *gc = _gc; |
|
15419
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1725 | GGPInfo *info; |
| 12007 | 1726 | struct gg_event *ev; |
| 11414 | 1727 | |
| 15884 | 1728 | g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
|
15419
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1729 | |
|
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1730 | info = gc->proto_data; |
|
c8f83c72739d
[gaim-migrate @ 18150]
Evan Schoenberg <evands@pidgin.im>
parents:
15294
diff
changeset
|
1731 | |
| 15884 | 1732 | purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
| 12007 | 1733 | info->session->check, info->session->state); |
| 11414 | 1734 | |
| 12007 | 1735 | switch (info->session->state) { |
| 1736 | case GG_STATE_RESOLVING: | |
| 15884 | 1737 | purple_debug_info("gg", "GG_STATE_RESOLVING\n"); |
| 12007 | 1738 | break; |
| 1739 | case GG_STATE_CONNECTING_HUB: | |
| 15884 | 1740 | purple_debug_info("gg", "GG_STATE_CONNECTING_HUB\n"); |
| 12007 | 1741 | break; |
| 1742 | case GG_STATE_READING_DATA: | |
| 15884 | 1743 | purple_debug_info("gg", "GG_STATE_READING_DATA\n"); |
| 12007 | 1744 | break; |
| 1745 | case GG_STATE_CONNECTING_GG: | |
| 15884 | 1746 | purple_debug_info("gg", "GG_STATE_CONNECTING_GG\n"); |
| 12007 | 1747 | break; |
| 1748 | case GG_STATE_READING_KEY: | |
| 15884 | 1749 | purple_debug_info("gg", "GG_STATE_READING_KEY\n"); |
| 12007 | 1750 | break; |
| 1751 | case GG_STATE_READING_REPLY: | |
| 15884 | 1752 | purple_debug_info("gg", "GG_STATE_READING_REPLY\n"); |
| 11414 | 1753 | break; |
| 1754 | default: | |
| 15884 | 1755 | purple_debug_error("gg", "unknown state = %d\n", |
| 12007 | 1756 | info->session->state); |
| 1757 | break; | |
| 1758 | } | |
| 1759 | ||
| 1760 | if (!(ev = gg_watch_fd(info->session))) { | |
| 15884 | 1761 | purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
| 21279 | 1762 | purple_connection_error_reason (gc, |
| 1763 | 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
|
1764 | _("Unable to read from socket")); |
| 12007 | 1765 | return; |
| 1766 | } | |
| 15884 | 1767 | purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
| 1768 | purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", | |
| 12007 | 1769 | info->session->check, info->session->state); |
| 1770 | ||
| 15884 | 1771 | purple_input_remove(gc->inpa); |
| 12007 | 1772 | |
| 1773 | /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ | |
| 15884 | 1774 | gc->inpa = purple_input_add(info->session->fd, |
| 1775 | (info->session->check == 1) ? PURPLE_INPUT_WRITE | |
| 1776 | : PURPLE_INPUT_READ, | |
| 12007 | 1777 | ggp_async_login_handler, gc); |
| 1778 | ||
| 1779 | switch (ev->type) { | |
| 1780 | case GG_EVENT_NONE: | |
| 1781 | /* Nothing happened. */ | |
| 15884 | 1782 | purple_debug_info("gg", "GG_EVENT_NONE\n"); |
| 12007 | 1783 | break; |
| 1784 | case GG_EVENT_CONN_SUCCESS: | |
| 12964 | 1785 | { |
| 15884 | 1786 | purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); |
| 1787 | purple_input_remove(gc->inpa); | |
| 1788 | gc->inpa = purple_input_add(info->session->fd, | |
| 1789 | PURPLE_INPUT_READ, | |
| 12964 | 1790 | ggp_callback_recv, gc); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
1791 | |
|
27642
6ae79601ad84
Patch from kkszysiu to make the GG prpl support
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27626
diff
changeset
|
1792 | ggp_buddylist_send(gc); |
|
30163
e43601d06035
gg: Fix misuse of update_progress. Fixes #11774
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
30138
diff
changeset
|
1793 | purple_connection_update_progress(gc, _("Connected"), 1, 2); |
| 15884 | 1794 | purple_connection_set_state(gc, PURPLE_CONNECTED); |
| 12964 | 1795 | } |
| 12007 | 1796 | break; |
| 1797 | case GG_EVENT_CONN_FAILED: | |
| 15884 | 1798 | purple_input_remove(gc->inpa); |
| 12007 | 1799 | 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
|
1800 | purple_connection_error_reason (gc, |
| 21279 | 1801 | 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
|
1802 | _("Connection failed")); |
| 12007 | 1803 | break; |
| 1804 | default: | |
| 15884 | 1805 | purple_debug_error("gg", "strange event: %d\n", ev->type); |
| 11414 | 1806 | break; |
| 1807 | } | |
| 1808 | ||
| 1809 | gg_free_event(ev); | |
| 1810 | } | |
| 1811 | ||
| 1812 | /* ---------------------------------------------------------------------- */ | |
| 15884 | 1813 | /* ----- PurplePluginProtocolInfo ----------------------------------------- */ |
| 11360 | 1814 | /* ---------------------------------------------------------------------- */ |
| 1815 | ||
| 15884 | 1816 | static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) |
| 11360 | 1817 | { |
| 1818 | return "gadu-gadu"; | |
| 1819 | } | |
| 1820 | ||
| 15884 | 1821 | static char *ggp_status_text(PurpleBuddy *b) |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1822 | { |
| 15884 | 1823 | PurpleStatus *status; |
| 11360 | 1824 | const char *msg; |
| 1825 | char *text; | |
| 1826 | char *tmp; | |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1827 | |
| 15884 | 1828 | 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
|
1829 | |
| 15884 | 1830 | msg = purple_status_get_attr_string(status, "message"); |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1831 | |
| 11360 | 1832 | if (msg != NULL) { |
| 15884 | 1833 | tmp = purple_markup_strip_html(msg); |
| 11360 | 1834 | text = g_markup_escape_text(tmp, -1); |
| 1835 | g_free(tmp); | |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1836 | |
| 11360 | 1837 | return text; |
| 1838 | } else { | |
| 15884 | 1839 | tmp = purple_utf8_salvage(purple_status_get_name(status)); |
| 11360 | 1840 | text = g_markup_escape_text(tmp, -1); |
| 1841 | g_free(tmp); | |
| 1842 | ||
| 1843 | return text; | |
| 8997 | 1844 | } |
|
2846
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1845 | } |
|
4f0435806f95
[gaim-migrate @ 2859]
Arkadiusz Miskiewicz <arekm@maven.pl>
parents:
2835
diff
changeset
|
1846 | |
| 15884 | 1847 | static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
| 11360 | 1848 | { |
| 15884 | 1849 | PurpleStatus *status; |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1850 | char *text, *tmp; |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1851 | const char *msg, *name, *alias; |
| 11360 | 1852 | |
| 15005 | 1853 | g_return_if_fail(b != NULL); |
| 1854 | ||
| 15884 | 1855 | status = purple_presence_get_active_status(purple_buddy_get_presence(b)); |
| 1856 | msg = purple_status_get_attr_string(status, "message"); | |
| 1857 | 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
|
1858 | 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
|
1859 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
1860 | purple_notify_user_info_add_pair (user_info, _("Alias"), alias); |
| 11360 | 1861 | |
| 1862 | if (msg != NULL) { | |
| 13455 | 1863 | text = g_markup_escape_text(msg, -1); |
| 15884 | 1864 | if (PURPLE_BUDDY_IS_ONLINE(b)) { |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1865 | tmp = g_strdup_printf("%s: %s", name, text); |
| 15884 | 1866 | purple_notify_user_info_add_pair(user_info, _("Status"), tmp); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15196
diff
changeset
|
1867 | g_free(tmp); |
| 15196 | 1868 | } else { |
| 15884 | 1869 | purple_notify_user_info_add_pair(user_info, _("Message"), text); |
| 15196 | 1870 | } |
| 11360 | 1871 | g_free(text); |
| 15227 | 1872 | /* We don't want to duplicate 'Status: Offline'. */ |
| 15884 | 1873 | } else if (PURPLE_BUDDY_IS_ONLINE(b)) { |
| 1874 | purple_notify_user_info_add_pair(user_info, _("Status"), name); | |
| 11360 | 1875 | } |
| 1876 | } | |
| 1877 | ||
| 15884 | 1878 | static GList *ggp_status_types(PurpleAccount *account) |
| 11360 | 1879 | { |
| 15884 | 1880 | PurpleStatusType *type; |
| 11360 | 1881 | GList *types = NULL; |
| 1882 | ||
| 15884 | 1883 | type = purple_status_type_new_with_attrs( |
| 1884 | PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, | |
| 1885 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
1886 | NULL); |
| 11360 | 1887 | types = g_list_append(types, type); |
| 1888 | ||
| 1889 | /* | |
|
11638
1821b40269a3
[gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11565
diff
changeset
|
1890 | * Without this selecting Invisible as own status doesn't |
| 11360 | 1891 | * work. It's not used and not needed to show status of buddies. |
| 1892 | */ | |
| 15884 | 1893 | type = purple_status_type_new_with_attrs( |
| 1894 | PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE, TRUE, FALSE, | |
| 1895 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
1896 | NULL); |
| 11360 | 1897 | types = g_list_append(types, type); |
| 1898 | ||
| 15884 | 1899 | type = purple_status_type_new_with_attrs( |
| 1900 | PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, | |
| 1901 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
1902 | NULL); |
| 11360 | 1903 | types = g_list_append(types, type); |
| 1904 | ||
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1905 | /* |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
1906 | * 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
|
1907 | * 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
|
1908 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1909 | 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
|
1910 | 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
|
1911 | "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
|
1912 | NULL); |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
1913 | types = g_list_append(types, type); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
1914 | |
| 12964 | 1915 | /* |
| 1916 | * This status is necessary to display guys who are blocking *us*. | |
| 1917 | */ | |
| 15884 | 1918 | type = purple_status_type_new_with_attrs( |
| 1919 | PURPLE_STATUS_INVISIBLE, "blocked", _("Blocked"), TRUE, FALSE, FALSE, | |
| 1920 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); | |
| 11360 | 1921 | types = g_list_append(types, type); |
| 1922 | ||
| 15884 | 1923 | type = purple_status_type_new_with_attrs( |
| 1924 | PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE, | |
| 1925 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
1926 | NULL); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
1927 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
1928 | |
| 11360 | 1929 | return types; |
| 1930 | } | |
| 1931 | ||
| 15884 | 1932 | static GList *ggp_blist_node_menu(PurpleBlistNode *node) |
| 2393 | 1933 | { |
| 15884 | 1934 | PurpleMenuAction *act; |
| 2393 | 1935 | 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
|
1936 | 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
|
1937 | GGPInfo *info; |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4229
diff
changeset
|
1938 | |
| 15884 | 1939 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) |
| 11360 | 1940 | return NULL; |
|
4333
f4c095774bc2
[gaim-migrate @ 4597]
Mark Doliner <markdoliner@pidgin.im>
parents:
4229
diff
changeset
|
1941 | |
|
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
|
1942 | 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
|
1943 | 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
|
1944 | 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
|
1945 | 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
|
1946 | 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
|
1947 | 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
|
1948 | 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
|
1949 | } |
| 11410 | 1950 | |
| 12641 | 1951 | /* Using a blist node boolean here is also wrong. |
| 1952 | * Once the Block and Unblock actions are added to the core, | |
| 1953 | * this will have to go. -- rlaager */ | |
| 15884 | 1954 | if (purple_blist_node_get_bool(node, "blocked")) { |
| 1955 | act = purple_menu_action_new(_("Unblock"), | |
| 1956 | PURPLE_CALLBACK(ggp_bmenu_block), | |
| 12919 | 1957 | NULL, NULL); |
| 12007 | 1958 | } else { |
| 15884 | 1959 | act = purple_menu_action_new(_("Block"), |
| 1960 | PURPLE_CALLBACK(ggp_bmenu_block), | |
| 12919 | 1961 | NULL, NULL); |
| 12007 | 1962 | } |
| 11394 | 1963 | m = g_list_append(m, act); |
| 2393 | 1964 | |
| 1965 | return m; | |
| 1966 | } | |
| 1967 | ||
| 15884 | 1968 | static GList *ggp_chat_info(PurpleConnection *gc) |
| 11394 | 1969 | { |
| 1970 | GList *m = NULL; | |
| 1971 | struct proto_chat_entry *pce; | |
| 1972 | ||
| 1973 | pce = g_new0(struct proto_chat_entry, 1); | |
| 1974 | pce->label = _("Chat _name:"); | |
| 1975 | pce->identifier = "name"; | |
| 1976 | pce->required = TRUE; | |
| 1977 | m = g_list_append(m, pce); | |
| 1978 | ||
| 1979 | return m; | |
| 1980 | } | |
| 1981 | ||
| 15884 | 1982 | static void ggp_login(PurpleAccount *account) |
| 2393 | 1983 | { |
| 15884 | 1984 | PurpleConnection *gc; |
|
23382
8dfecaa62e66
Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents:
23381
diff
changeset
|
1985 | PurplePresence *presence; |
|
8dfecaa62e66
Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents:
23381
diff
changeset
|
1986 | PurpleStatus *status; |
| 13515 | 1987 | struct gg_login_params *glp; |
| 1988 | GGPInfo *info; | |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
1989 | const char *address; |
| 13515 | 1990 | |
| 1991 | if (ggp_setup_proxy(account) == -1) | |
| 1992 | return; | |
| 1993 | ||
| 15884 | 1994 | gc = purple_account_get_connection(account); |
| 13515 | 1995 | glp = g_new0(struct gg_login_params, 1); |
| 1996 | info = g_new0(GGPInfo, 1); | |
| 11360 | 1997 | |
| 12007 | 1998 | /* Probably this should be moved to *_new() function. */ |
| 11360 | 1999 | info->session = NULL; |
| 11394 | 2000 | info->chats = NULL; |
| 2001 | info->chats_count = 0; | |
| 12007 | 2002 | info->token = NULL; |
| 13641 | 2003 | 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
|
2004 | info->pending_richtext_messages = NULL; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2005 | info->pending_images = g_hash_table_new(g_int_hash, g_int_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
|
2006 | 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
|
2007 | |
| 11360 | 2008 | gc->proto_data = info; |
| 2009 | ||
| 2010 | glp->uin = ggp_get_uin(account); | |
| 15884 | 2011 | 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
|
2012 | glp->image_size = 255; |
| 11360 | 2013 | |
|
23382
8dfecaa62e66
Restore status on login on GG, rather than setting Available first.
Will Thompson <resiak@pidgin.im>
parents:
23381
diff
changeset
|
2014 | 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
|
2015 | 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
|
2016 | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2017 | glp->encoding = GG_ENCODING_UTF8; |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2018 | glp->protocol_features = (GG_FEATURE_STATUS80|GG_FEATURE_DND_FFC); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2019 | |
| 12007 | 2020 | 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
|
2021 | glp->status = ggp_to_gg_status(status, &glp->status_descr); |
| 11360 | 2022 | glp->tls = 0; |
| 2023 | ||
|
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
|
2024 | 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
|
2025 | 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
|
2026 | |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2027 | 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
|
2028 | 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
|
2029 | /* 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
|
2030 | 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
|
2031 | |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2032 | 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
|
2033 | |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2034 | 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
|
2035 | 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
|
2036 | 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
|
2037 | 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
|
2038 | 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
|
2039 | tmp); |
|
62fbae50be08
Connection error message changes for gg, and a few other strings changes.
Mark Doliner <markdoliner@pidgin.im>
parents:
27388
diff
changeset
|
2040 | g_free(tmp); |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2041 | return; |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2042 | } |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2043 | |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2044 | 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
|
2045 | glp->server_port = 8074; |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2046 | } else |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2047 | 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
|
2048 | |
| 11360 | 2049 | info->session = gg_login(glp); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2050 | purple_connection_update_progress(gc, _("Connecting"), 0, 2); |
| 11360 | 2051 | if (info->session == NULL) { |
| 21279 | 2052 | purple_connection_error_reason (gc, |
| 2053 | 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
|
2054 | _("Connection failed")); |
| 11360 | 2055 | g_free(glp); |
| 2056 | return; | |
| 2057 | } | |
| 15884 | 2058 | gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
| 12007 | 2059 | ggp_async_login_handler, gc); |
| 11360 | 2060 | } |
| 2061 | ||
| 15884 | 2062 | static void ggp_close(PurpleConnection *gc) |
| 11360 | 2063 | { |
| 8997 | 2064 | |
| 11360 | 2065 | if (gc == NULL) { |
| 15884 | 2066 | purple_debug_info("gg", "gc == NULL\n"); |
| 11360 | 2067 | return; |
| 2068 | } | |
| 2069 | ||
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2070 | if (gc->proto_data) { |
| 15884 | 2071 | PurpleAccount *account = purple_connection_get_account(gc); |
| 2072 | PurpleStatus *status; | |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2073 | GGPInfo *info = gc->proto_data; |
| 12964 | 2074 | |
| 15884 | 2075 | status = purple_account_get_active_status(account); |
| 12964 | 2076 | |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2077 | if (info->session != NULL) { |
| 12964 | 2078 | ggp_set_status(account, status); |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2079 | gg_logoff(info->session); |
|
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2080 | gg_free_session(info->session); |
|
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2081 | } |
| 13641 | 2082 | |
|
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
|
2083 | 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
|
2084 | |
|
14060
e1a87aabd80c
[gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents:
13645
diff
changeset
|
2085 | /* Immediately close any notifications on this handle since that process depends |
|
e1a87aabd80c
[gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents:
13645
diff
changeset
|
2086 | * 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
|
2087 | */ |
| 15884 | 2088 | purple_notify_close_with_handle(gc); |
|
14060
e1a87aabd80c
[gaim-migrate @ 16583]
Evan Schoenberg <evands@pidgin.im>
parents:
13645
diff
changeset
|
2089 | |
| 13641 | 2090 | 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
|
2091 | 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
|
2092 | g_hash_table_destroy(info->pending_images); |
|
11545
df2f9bb3fd6e
[gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents:
11544
diff
changeset
|
2093 | g_free(info); |
|
df2f9bb3fd6e
[gaim-migrate @ 13800]
Daniel Atallah <datallah@pidgin.im>
parents:
11544
diff
changeset
|
2094 | gc->proto_data = NULL; |
|
11538
d87f3717d5a5
[gaim-migrate @ 13792]
Daniel Atallah <datallah@pidgin.im>
parents:
11522
diff
changeset
|
2095 | } |
| 11360 | 2096 | |
| 2097 | if (gc->inpa > 0) | |
| 15884 | 2098 | purple_input_remove(gc->inpa); |
| 11360 | 2099 | |
| 15884 | 2100 | purple_debug_info("gg", "Connection closed.\n"); |
| 11360 | 2101 | } |
| 2102 | ||
| 15884 | 2103 | static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, |
| 2104 | PurpleMessageFlags flags) | |
| 11360 | 2105 | { |
| 2106 | GGPInfo *info = gc->proto_data; | |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2107 | char *tmp, *plain; |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2108 | int ret = 1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2109 | unsigned char format[1024]; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2110 | 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
|
2111 | gint pos = 0; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2112 | GData *attribs; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2113 | 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
|
2114 | |
|
24747
498c6dda6e48
Fix two warnings introduced by the image patch I committed earlier and make
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24746
diff
changeset
|
2115 | if (msg == NULL || *msg == '\0') { |
| 15287 | 2116 | return 0; |
| 2117 | } | |
| 2118 | ||
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2119 | last = msg; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2120 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2121 | /* 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
|
2122 | /* TODO: Check formatting, too */ |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2123 | 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
|
2124 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2125 | 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
|
2126 | 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
|
2127 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2128 | do { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2129 | PurpleStoredImage *image; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2130 | const char *id; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2131 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2132 | /* 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
|
2133 | if(start - last) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2134 | 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
|
2135 | 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
|
2136 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2137 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2138 | 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
|
2139 | 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
|
2140 | 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
|
2141 | 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
|
2142 | 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
|
2143 | 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
|
2144 | 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
|
2145 | |
|
24747
498c6dda6e48
Fix two warnings introduced by the image patch I committed earlier and make
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24746
diff
changeset
|
2146 | g_hash_table_insert(info->pending_images, &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
|
2147 | purple_imgstore_ref(image); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2148 | purple_debug_info("gg", "ggp_send_im_richtext: got crc: %i for imgid: %i\n", crc32, atoi(id)); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2149 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2150 | 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
|
2151 | actformat.position = pos; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2152 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2153 | actimage.unknown1 = 0x0109; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2154 | 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
|
2155 | 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
|
2156 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2157 | if (actimage.size > 255000) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2158 | purple_debug_warning("gg", "ggp_send_im_richtext: image over 255kb!\n"); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2159 | continue; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2160 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2161 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2162 | 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); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2163 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2164 | memcpy(format + format_length, &actformat, sizeof(actformat)); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2165 | format_length += sizeof(actformat); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2166 | memcpy(format + format_length, &actimage, sizeof(actimage)); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2167 | format_length += sizeof(actimage); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2168 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2169 | 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
|
2170 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2171 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2172 | last = end + 1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2173 | g_datalist_clear(&attribs); |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2174 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2175 | } 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
|
2176 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2177 | /* 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
|
2178 | if(last && *last) { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2179 | 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
|
2180 | 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
|
2181 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2182 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2183 | fmt.flag = 2; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2184 | 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
|
2185 | 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
|
2186 | |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2187 | 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
|
2188 | 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
|
2189 | 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
|
2190 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2191 | 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
|
2192 | 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
|
2193 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2194 | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2195 | /* |
| 15287 | 2196 | 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
|
2197 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2198 | tmp = g_strdup_printf("%s", plain); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30163
diff
changeset
|
2199 | |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2200 | 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
|
2201 | 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
|
2202 | ret = -1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2203 | } else { |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2204 | ret = 1; |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2205 | } |
|
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2206 | } else if (NULL == tmp || *tmp == 0) { |
| 15287 | 2207 | ret = 0; |
| 2208 | } else if (strlen(tmp) > GG_MSG_MAXSIZE) { | |
| 2209 | ret = -E2BIG; | |
| 2210 | } else if (gg_send_message(info->session, GG_CLASS_CHAT, | |
| 2211 | ggp_str_to_uin(who), (unsigned char *)tmp) < 0) { | |
| 2212 | ret = -1; | |
| 2213 | } else { | |
| 2214 | ret = 1; | |
| 2215 | } | |
| 2216 | ||
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2217 | g_free(plain); |
| 11565 | 2218 | g_free(tmp); |
| 11360 | 2219 | |
| 15287 | 2220 | return ret; |
| 11360 | 2221 | } |
| 2222 | ||
| 15884 | 2223 | static void ggp_get_info(PurpleConnection *gc, const char *name) |
| 11360 | 2224 | { |
| 2225 | GGPInfo *info = gc->proto_data; | |
| 2226 | GGPSearchForm *form; | |
| 13641 | 2227 | guint32 seq; |
| 2393 | 2228 | |
| 13641 | 2229 | form = ggp_search_form_new(GGP_SEARCH_TYPE_INFO); |
| 12220 | 2230 | |
| 13641 | 2231 | form->user_data = info; |
| 11360 | 2232 | form->uin = g_strdup(name); |
| 2233 | form->offset = g_strdup("0"); | |
| 2234 | form->last_uin = g_strdup("0"); | |
| 2235 | ||
| 13641 | 2236 | seq = ggp_search_start(gc, form); |
| 2237 | 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
|
2238 | purple_debug_info("gg", "ggp_get_info(): Added seq %u", seq); |
| 11360 | 2239 | } |
| 2240 | ||
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2241 | static int ggp_to_gg_status(PurpleStatus *status, char **msg) |
| 11360 | 2242 | { |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2243 | const char *status_id = purple_status_get_id(status); |
| 11360 | 2244 | 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
|
2245 | const char *new_msg; |
| 11360 | 2246 | |
|
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
|
2247 | g_return_val_if_fail(msg != NULL, 0); |
| 11360 | 2248 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2249 | purple_debug_info("gg", "ggp_to_gg_status: Requested status = %s\n", |
| 12007 | 2250 | status_id); |
| 2393 | 2251 | |
| 11360 | 2252 | if (strcmp(status_id, "available") == 0) { |
| 2253 | new_status = GG_STATUS_AVAIL; | |
| 2254 | new_status_descr = GG_STATUS_AVAIL_DESCR; | |
| 2255 | } else if (strcmp(status_id, "away") == 0) { | |
| 2256 | new_status = GG_STATUS_BUSY; | |
| 2257 | 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
|
2258 | } 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
|
2259 | new_status = GG_STATUS_DND; |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2260 | new_status_descr = GG_STATUS_DND_DESCR; |
| 11360 | 2261 | } else if (strcmp(status_id, "invisible") == 0) { |
| 2262 | new_status = GG_STATUS_INVISIBLE; | |
| 2263 | new_status_descr = GG_STATUS_INVISIBLE_DESCR; | |
| 12964 | 2264 | } else if (strcmp(status_id, "offline") == 0) { |
| 2265 | new_status = GG_STATUS_NOT_AVAIL; | |
| 2266 | new_status_descr = GG_STATUS_NOT_AVAIL_DESCR; | |
| 11360 | 2267 | } else { |
| 2268 | new_status = GG_STATUS_AVAIL; | |
| 2269 | new_status_descr = GG_STATUS_AVAIL_DESCR; | |
| 15884 | 2270 | 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
|
2271 | "ggp_set_status: unknown status requested (status_id=%s)\n", |
| 12007 | 2272 | status_id); |
| 11360 | 2273 | } |
| 4916 | 2274 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2275 | 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
|
2276 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2277 | if(new_msg) { |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2278 | /* |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2279 | 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
|
2280 | *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
|
2281 | g_free(tmp); |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2282 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2283 | *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
|
2284 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2285 | 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
|
2286 | } else { |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2287 | *msg = NULL; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2288 | 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
|
2289 | } |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2290 | } |
| 11360 | 2291 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2292 | 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
|
2293 | { |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2294 | PurpleConnection *gc; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2295 | GGPInfo *info; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2296 | 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
|
2297 | 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
|
2298 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2299 | 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
|
2300 | return; |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2301 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2302 | 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
|
2303 | 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
|
2304 | |
|
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2305 | 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
|
2306 | |
|
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
|
2307 | 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
|
2308 | 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
|
2309 | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2310 | if (new_msg == NULL) { |
| 11360 | 2311 | gg_change_status(info->session, new_status); |
| 2312 | } else { | |
|
23380
1f2dda5756b9
Extract converting a PurpleStatus to GG's format to its own function.
Will Thompson <resiak@pidgin.im>
parents:
23379
diff
changeset
|
2313 | gg_change_status_descr(info->session, new_status, new_msg); |
| 12964 | 2314 | g_free(new_msg); |
| 11360 | 2315 | } |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2316 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2317 | ggp_status_fake_to_self(account); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2318 | |
| 11360 | 2319 | } |
| 2320 | ||
| 15884 | 2321 | static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 11360 | 2322 | { |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2323 | PurpleAccount *account; |
| 11360 | 2324 | 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
|
2325 | const gchar *name = purple_buddy_get_name(buddy); |
| 11360 | 2326 | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
24043
diff
changeset
|
2327 | 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
|
2328 | |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2329 | 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
|
2330 | if (strcmp(purple_account_get_username(account), name) == 0) { |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2331 | ggp_status_fake_to_self(account); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
2332 | } |
| 11360 | 2333 | } |
| 2334 | ||
| 15884 | 2335 | static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
| 2336 | PurpleGroup *group) | |
| 11360 | 2337 | { |
| 2338 | GGPInfo *info = gc->proto_data; | |
| 2339 | ||
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
24043
diff
changeset
|
2340 | gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy))); |
| 11360 | 2341 | } |
| 2342 | ||
| 15884 | 2343 | static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) |
| 11394 | 2344 | { |
| 2345 | GGPInfo *info = gc->proto_data; | |
| 2346 | GGPChat *chat; | |
| 2347 | char *chat_name; | |
| 2348 | GList *l; | |
| 15884 | 2349 | PurpleConversation *conv; |
| 2350 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 11394 | 2351 | |
| 2352 | chat_name = g_hash_table_lookup(data, "name"); | |
| 2353 | ||
| 2354 | if (chat_name == NULL) | |
| 2355 | return; | |
| 2356 | ||
| 15884 | 2357 | purple_debug_info("gg", "joined %s chat\n", chat_name); |
| 11394 | 2358 | |
| 2359 | for (l = info->chats; l != NULL; l = l->next) { | |
| 2360 | chat = l->data; | |
| 2361 | ||
| 2362 | if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) { | |
| 15884 | 2363 | purple_notify_error(gc, _("Chat error"), |
| 12007 | 2364 | _("This chat name is already in use"), NULL); |
| 11394 | 2365 | return; |
| 2366 | } | |
| 2367 | } | |
| 2368 | ||
| 11414 | 2369 | ggp_confer_add_new(gc, chat_name); |
| 12961 | 2370 | conv = serv_got_joined_chat(gc, info->chats_count, chat_name); |
| 15884 | 2371 | purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), |
| 2372 | purple_account_get_username(account), NULL, | |
| 2373 | PURPLE_CBFLAGS_NONE, TRUE); | |
| 11394 | 2374 | } |
| 2375 | ||
| 2376 | static char *ggp_get_chat_name(GHashTable *data) { | |
| 2377 | return g_strdup(g_hash_table_lookup(data, "name")); | |
| 2378 | } | |
| 2379 | ||
| 15884 | 2380 | static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) |
| 11394 | 2381 | { |
| 15884 | 2382 | PurpleConversation *conv; |
| 11394 | 2383 | GGPInfo *info = gc->proto_data; |
| 2384 | GGPChat *chat = NULL; | |
| 2385 | GList *l; | |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2386 | /* char *msg, *plain; */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2387 | gchar *msg; |
| 11394 | 2388 | uin_t *uins; |
| 2389 | int count = 0; | |
| 2390 | ||
| 15884 | 2391 | if ((conv = purple_find_chat(gc, id)) == NULL) |
| 11394 | 2392 | return -EINVAL; |
| 2393 | ||
| 2394 | for (l = info->chats; l != NULL; l = l->next) { | |
| 2395 | chat = l->data; | |
| 2396 | ||
| 2397 | if (g_utf8_collate(chat->name, conv->name) == 0) { | |
| 2398 | break; | |
| 2399 | } | |
| 2400 | ||
| 2401 | chat = NULL; | |
| 2402 | } | |
| 2403 | ||
| 2404 | if (chat == NULL) { | |
| 15884 | 2405 | purple_debug_error("gg", |
| 12007 | 2406 | "ggp_chat_send: Hm... that's strange. No such chat?\n"); |
| 11394 | 2407 | return -EINVAL; |
| 2408 | } | |
| 2409 | ||
| 2410 | uins = g_new0(uin_t, g_list_length(chat->participants)); | |
| 12961 | 2411 | |
| 11394 | 2412 | for (l = chat->participants; l != NULL; l = l->next) { |
| 12961 | 2413 | uin_t uin = GPOINTER_TO_INT(l->data); |
| 11394 | 2414 | |
| 12961 | 2415 | uins[count++] = uin; |
| 11394 | 2416 | } |
| 2417 | ||
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2418 | /* |
| 15884 | 2419 | plain = purple_unescape_html(message); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2420 | msg = charset_convert(plain, "UTF-8", "CP1250"); |
|
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
2421 | g_free(plain); |
|
29824
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2422 | */ |
|
9878119b5d78
Finish making libgadu compile on Windows. Fixes #10542 finally!
Krzysztof Klinikowski <kkszysiu@gmail.com>
parents:
29404
diff
changeset
|
2423 | msg = purple_unescape_html(message); |
| 12007 | 2424 | gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins, |
| 12961 | 2425 | (unsigned char *)msg); |
| 11394 | 2426 | g_free(msg); |
| 2427 | g_free(uins); | |
| 2428 | ||
| 12007 | 2429 | serv_got_chat_in(gc, id, |
| 15884 | 2430 | 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
|
2431 | flags, message, time(NULL)); |
| 11394 | 2432 | |
| 2433 | return 0; | |
| 2434 | } | |
| 2435 | ||
| 15884 | 2436 | static void ggp_keepalive(PurpleConnection *gc) |
| 11360 | 2437 | { |
| 2438 | GGPInfo *info = gc->proto_data; | |
| 2439 | ||
| 15884 | 2440 | /* purple_debug_info("gg", "Keeping connection alive....\n"); */ |
| 11360 | 2441 | |
| 2442 | if (gg_ping(info->session) < 0) { | |
| 15884 | 2443 | purple_debug_info("gg", "Not connected to the server " |
| 11360 | 2444 | "or gg_session is not correct\n"); |
| 21279 | 2445 | purple_connection_error_reason (gc, |
| 2446 | 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
|
2447 | _("Not connected to the server")); |
| 4916 | 2448 | } |
| 2393 | 2449 | } |
| 11360 | 2450 | |
| 15884 | 2451 | static void ggp_register_user(PurpleAccount *account) |
| 11360 | 2452 | { |
| 15884 | 2453 | PurpleConnection *gc = purple_account_get_connection(account); |
| 11360 | 2454 | GGPInfo *info; |
| 2455 | ||
| 12007 | 2456 | info = gc->proto_data = g_new0(GGPInfo, 1); |
| 11360 | 2457 | |
| 12007 | 2458 | ggp_token_request(gc, ggp_register_user_dialog); |
| 2393 | 2459 | } |
| 2460 | ||
| 15884 | 2461 | static GList *ggp_actions(PurplePlugin *plugin, gpointer context) |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2462 | { |
| 11360 | 2463 | GList *m = NULL; |
| 15884 | 2464 | PurplePluginAction *act; |
| 11360 | 2465 | |
| 15884 | 2466 | act = purple_plugin_action_new(_("Find buddies..."), |
| 12007 | 2467 | ggp_find_buddies); |
| 11360 | 2468 | m = g_list_append(m, act); |
| 2469 | ||
| 2470 | m = g_list_append(m, NULL); | |
| 2471 | ||
| 15884 | 2472 | act = purple_plugin_action_new(_("Change password..."), |
| 12007 | 2473 | ggp_change_passwd); |
| 11360 | 2474 | m = g_list_append(m, act); |
| 2475 | ||
| 2476 | m = g_list_append(m, NULL); | |
| 2477 | ||
| 15884 | 2478 | act = purple_plugin_action_new(_("Upload buddylist to Server"), |
| 12007 | 2479 | ggp_action_buddylist_put); |
| 11360 | 2480 | m = g_list_append(m, act); |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2481 | |
| 15884 | 2482 | act = purple_plugin_action_new(_("Download buddylist from Server"), |
| 12007 | 2483 | ggp_action_buddylist_get); |
| 11360 | 2484 | m = g_list_append(m, act); |
| 2485 | ||
| 15884 | 2486 | act = purple_plugin_action_new(_("Delete buddylist from Server"), |
| 12007 | 2487 | ggp_action_buddylist_delete); |
| 11360 | 2488 | m = g_list_append(m, act); |
| 2489 | ||
| 15884 | 2490 | act = purple_plugin_action_new(_("Save buddylist to file..."), |
| 12007 | 2491 | ggp_action_buddylist_save); |
| 11360 | 2492 | m = g_list_append(m, act); |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2493 | |
| 15884 | 2494 | act = purple_plugin_action_new(_("Load buddylist from file..."), |
| 12007 | 2495 | ggp_action_buddylist_load); |
| 11360 | 2496 | m = g_list_append(m, act); |
| 2497 | ||
|
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
|
2498 | 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
|
2499 | 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
|
2500 | 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
|
2501 | |
| 11360 | 2502 | return m; |
|
8775
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2503 | } |
|
6cb5dddaad4f
[gaim-migrate @ 9537]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8749
diff
changeset
|
2504 | |
| 15884 | 2505 | static gboolean ggp_offline_message(const PurpleBuddy *buddy) |
|
13298
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2506 | { |
|
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2507 | return TRUE; |
|
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2508 | } |
|
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2509 | |
| 15884 | 2510 | static PurplePluginProtocolInfo prpl_info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2511 | { |
|
24745
511df62cb366
Support displaying buddy icons from Gadu-Gadu buddies. Fixes #220.
Adam Strzelecki <ono@java.pl>
parents:
24683
diff
changeset
|
2512 | OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, |
| 12007 | 2513 | NULL, /* user_splits */ |
| 2514 | 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
|
2515 | {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ |
| 11360 | 2516 | ggp_list_icon, /* list_icon */ |
| 15524 | 2517 | NULL, /* list_emblem */ |
| 11360 | 2518 | ggp_status_text, /* status_text */ |
| 2519 | ggp_tooltip_text, /* tooltip_text */ | |
| 2520 | ggp_status_types, /* status_types */ | |
| 12007 | 2521 | ggp_blist_node_menu, /* blist_node_menu */ |
| 11394 | 2522 | ggp_chat_info, /* chat_info */ |
| 12007 | 2523 | NULL, /* chat_info_defaults */ |
| 2524 | ggp_login, /* login */ | |
| 2525 | ggp_close, /* close */ | |
| 11360 | 2526 | ggp_send_im, /* send_im */ |
| 12007 | 2527 | NULL, /* set_info */ |
| 2528 | NULL, /* send_typing */ | |
| 11360 | 2529 | ggp_get_info, /* get_info */ |
| 2530 | ggp_set_status, /* set_away */ | |
| 12007 | 2531 | NULL, /* set_idle */ |
| 2532 | NULL, /* change_passwd */ | |
| 11360 | 2533 | ggp_add_buddy, /* add_buddy */ |
| 12007 | 2534 | NULL, /* add_buddies */ |
| 11360 | 2535 | ggp_remove_buddy, /* remove_buddy */ |
| 12007 | 2536 | NULL, /* remove_buddies */ |
| 2537 | NULL, /* add_permit */ | |
| 2538 | NULL, /* add_deny */ | |
| 2539 | NULL, /* rem_permit */ | |
| 2540 | NULL, /* rem_deny */ | |
| 2541 | NULL, /* set_permit_deny */ | |
| 11394 | 2542 | ggp_join_chat, /* join_chat */ |
| 12007 | 2543 | NULL, /* reject_chat */ |
| 11394 | 2544 | ggp_get_chat_name, /* get_chat_name */ |
| 12007 | 2545 | NULL, /* chat_invite */ |
| 2546 | NULL, /* chat_leave */ | |
| 2547 | NULL, /* chat_whisper */ | |
| 11394 | 2548 | ggp_chat_send, /* chat_send */ |
| 11360 | 2549 | ggp_keepalive, /* keepalive */ |
| 2550 | ggp_register_user, /* register_user */ | |
| 12007 | 2551 | NULL, /* get_cb_info */ |
| 2552 | NULL, /* get_cb_away */ | |
| 2553 | NULL, /* alias_buddy */ | |
| 2554 | NULL, /* group_buddy */ | |
| 2555 | NULL, /* rename_group */ | |
| 2556 | NULL, /* buddy_free */ | |
| 2557 | NULL, /* convo_closed */ | |
| 2558 | NULL, /* normalize */ | |
| 2559 | NULL, /* set_buddy_icon */ | |
| 2560 | NULL, /* remove_group */ | |
| 2561 | NULL, /* get_cb_real_name */ | |
| 2562 | NULL, /* set_chat_topic */ | |
| 2563 | NULL, /* find_blist_chat */ | |
| 2564 | NULL, /* roomlist_get_list */ | |
| 2565 | NULL, /* roomlist_cancel */ | |
| 2566 | NULL, /* roomlist_expand_category */ | |
| 2567 | NULL, /* can_receive_file */ | |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
12007
diff
changeset
|
2568 | NULL, /* send_file */ |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12595
diff
changeset
|
2569 | NULL, /* new_xfer */ |
|
13298
7a41e676010b
[gaim-migrate @ 15663]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
2570 | ggp_offline_message, /* offline_message */ |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12595
diff
changeset
|
2571 | NULL, /* whiteboard_prpl_ops */ |
| 14604 | 2572 | NULL, /* send_raw */ |
| 15185 | 2573 | 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
|
2574 | 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
|
2575 | 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
|
2576 | 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
|
2577 | sizeof(PurplePluginProtocolInfo), /* struct_size */ |
|
23707
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
2578 | NULL, /* get_account_text_table */ |
|
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
2579 | NULL, /* initiate_media */ |
| 29404 | 2580 | 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
|
2581 | 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
|
2582 | NULL, /* set_public_alias */ |
|
cca9685df785
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents:
30134
diff
changeset
|
2583 | NULL /* get_public_alias */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2584 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2585 | |
| 15884 | 2586 | static PurplePluginInfo info = { |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2587 | PURPLE_PLUGIN_MAGIC, /* magic */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2588 | 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
|
2589 | 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
|
2590 | 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
|
2591 | NULL, /* ui_requirement */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2592 | 0, /* flags */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2593 | NULL, /* dependencies */ |
| 15884 | 2594 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
| 11360 | 2595 | |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2596 | "prpl-gg", /* id */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2597 | "Gadu-Gadu", /* name */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2598 | DISPLAY_VERSION, /* version */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2599 | |
| 11360 | 2600 | N_("Gadu-Gadu Protocol Plugin"), /* summary */ |
| 2601 | 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
|
2602 | "boler@sourceforge.net", /* author */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2603 | PURPLE_WEBSITE, /* homepage */ |
| 11360 | 2604 | |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2605 | NULL, /* load */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2606 | NULL, /* unload */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2607 | NULL, /* destroy */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2608 | |
|
24746
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2609 | NULL, /* ui_info */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2610 | &prpl_info, /* extra_info */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2611 | NULL, /* prefs_info */ |
|
ffee942a34b2
Kill off a bajillion comments that just needlessly duplicate function
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24745
diff
changeset
|
2612 | ggp_actions, /* actions */ |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2613 | |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2614 | /* padding */ |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2615 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2616 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2617 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
2618 | NULL |
| 11360 | 2619 | }; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2620 | |
| 15884 | 2621 | static void purple_gg_debug_handler(int level, const char * format, va_list args) { |
| 2622 | PurpleDebugLevel purple_level; | |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2623 | char *msg = g_strdup_vprintf(format, args); |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2624 | |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2625 | /* This is pretty pointless since the GG_DEBUG levels don't correspond to |
| 15884 | 2626 | * the purple ones */ |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2627 | switch (level) { |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2628 | case GG_DEBUG_FUNCTION: |
| 15884 | 2629 | purple_level = PURPLE_DEBUG_INFO; |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2630 | break; |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2631 | case GG_DEBUG_MISC: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2632 | case GG_DEBUG_NET: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2633 | case GG_DEBUG_DUMP: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2634 | case GG_DEBUG_TRAFFIC: |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2635 | default: |
| 15884 | 2636 | purple_level = PURPLE_DEBUG_MISC; |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2637 | break; |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2638 | } |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2639 | |
|
24683
3481a3320313
Backport the 'purple_debug_*(msg)' -> 'purple_debug_*("%s", msg);' fixes.
Richard Laager <rlaager@pidgin.im>
parents:
24569
diff
changeset
|
2640 | purple_debug(purple_level, "gg", "%s", msg); |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2641 | g_free(msg); |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2642 | } |
|
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2643 | |
| 15884 | 2644 | static void init_plugin(PurplePlugin *plugin) |
| 2393 | 2645 | { |
| 15884 | 2646 | PurpleAccountOption *option; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2647 | |
| 15884 | 2648 | option = purple_account_option_string_new(_("Nickname"), |
| 12007 | 2649 | "nick", _("Gadu-Gadu User")); |
| 2650 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, | |
| 2651 | option); | |
| 3572 | 2652 | |
|
27255
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2653 | 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
|
2654 | "gg_server", ""); |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2655 | 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
|
2656 | option); |
|
d2284774cfed
Allow Gadu-Gadu accounts to specify Connect Server. Refs #6691.
Paul Aurich <darkrain42@pidgin.im>
parents:
27197
diff
changeset
|
2657 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2658 | my_protocol = plugin; |
|
11541
b1468184879c
[gaim-migrate @ 13796]
Daniel Atallah <datallah@pidgin.im>
parents:
11538
diff
changeset
|
2659 | |
| 15884 | 2660 | gg_debug_handler = purple_gg_debug_handler; |
| 2393 | 2661 | } |
| 2662 | ||
| 15884 | 2663 | PURPLE_INIT_PLUGIN(gg, init_plugin, info); |
| 11360 | 2664 | |
| 12007 | 2665 | /* vim: set ts=8 sts=0 sw=8 noet: */ |