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