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