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