Wed, 14 May 2008 23:36:37 +0000
When calling serv_got_chat_in() after sending a group chat message (to let
the core know that it was sent, since unlike sending an IM conversation
message it is not immedately written out to the conversation by
common_send()), pass back the flags initially sent to the prpl. This maintains
the PURPLE_MESSAGE_SEND flag as well as anything else which might be
helpful to the UI, such as PURPLE_MESSAGE_IMAGES.
| 6729 | 1 | /* |
| 15884 | 2 | * purple |
| 6729 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 6729 | 8 | * Some code copyright 2003 Tim Ringenbach <omarvo@hotmail.com> |
| 9 | * (marv on irc.freenode.net) | |
| 10 | * Some code borrowed from libyahoo2, copyright (C) 2002, Philip | |
| 11 | * S Tellis <philip . tellis AT gmx . net> | |
| 12 | * | |
| 13 | * This program is free software; you can redistribute it and/or modify | |
| 14 | * it under the terms of the GNU General Public License as published by | |
| 15 | * the Free Software Foundation; either version 2 of the License, or | |
| 16 | * (at your option) any later version. | |
| 17 | * | |
| 18 | * This program is distributed in the hope that it will be useful, | |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 21 | * GNU General Public License for more details. | |
| 22 | * | |
| 23 | * You should have received a copy of the GNU General Public License | |
| 24 | * 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:
19716
diff
changeset
|
25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6729 | 26 | * |
| 27 | */ | |
| 28 | ||
|
18273
e61c53184c52
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18122
diff
changeset
|
29 | #include "internal.h" |
|
e61c53184c52
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18122
diff
changeset
|
30 | |
| 6729 | 31 | #ifdef HAVE_CONFIG_H |
| 32 | #include "config.h" | |
| 33 | #endif | |
| 34 | ||
| 35 | #include "debug.h" | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
36 | #include "privacy.h" |
| 6729 | 37 | #include "prpl.h" |
| 38 | ||
| 39 | #include "conversation.h" | |
| 40 | #include "notify.h" | |
| 41 | #include "util.h" | |
| 42 | ||
| 43 | #include "yahoo.h" | |
| 10392 | 44 | #include "yahoo_packet.h" |
| 6729 | 45 | #include "yahoochat.h" |
| 9376 | 46 | #include "ycht.h" |
| 6729 | 47 | |
| 48 | #define YAHOO_CHAT_ID (1) | |
| 49 | ||
| 7186 | 50 | /* prototype(s) */ |
| 15884 | 51 | static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout); |
| 7186 | 52 | |
| 6729 | 53 | /* special function to log us on to the yahoo chat service */ |
| 15884 | 54 | static void yahoo_chat_online(PurpleConnection *gc) |
| 6729 | 55 | { |
| 56 | struct yahoo_data *yd = gc->proto_data; | |
| 57 | struct yahoo_packet *pkt; | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
58 | const char *rll; |
| 6729 | 59 | |
| 9376 | 60 | if (yd->wm) { |
| 61 | ycht_connection_open(gc); | |
| 62 | return; | |
| 63 | } | |
| 6729 | 64 | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
65 | rll = purple_account_get_string(purple_connection_get_account(gc), |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
66 | "room_list_locale", YAHOO_ROOMLIST_LOCALE); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
67 | |
| 6729 | 68 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATONLINE, YAHOO_STATUS_AVAILABLE,0); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
69 | yahoo_packet_hash(pkt, "sssss", |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
70 | 109, purple_connection_get_display_name(gc), |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
71 | 1, purple_connection_get_display_name(gc), |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
72 | 6, "abcde", |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
73 | /* I'm not sure this is the correct way to set this. */ |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
74 | 98, rll, |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
75 | 135, "ym8.1.0.415"); |
| 10392 | 76 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 77 | } |
| 78 | ||
| 15884 | 79 | /* this is slow, and different from the purple_* version in that it (hopefully) won't add a user twice */ |
| 80 | void yahoo_chat_add_users(PurpleConvChat *chat, GList *newusers) | |
| 6729 | 81 | { |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
82 | GList *i; |
| 6729 | 83 | |
| 84 | for (i = newusers; i; i = i->next) { | |
| 15884 | 85 | if (purple_conv_chat_find_user(chat, i->data)) |
| 6729 | 86 | continue; |
| 15884 | 87 | purple_conv_chat_add_user(chat, i->data, NULL, PURPLE_CBFLAGS_NONE, TRUE); |
| 6729 | 88 | } |
| 89 | } | |
| 90 | ||
| 15884 | 91 | void yahoo_chat_add_user(PurpleConvChat *chat, const char *user, const char *reason) |
| 6729 | 92 | { |
| 15884 | 93 | if (purple_conv_chat_find_user(chat, user)) |
| 6729 | 94 | return; |
| 95 | ||
| 15884 | 96 | purple_conv_chat_add_user(chat, user, reason, PURPLE_CBFLAGS_NONE, TRUE); |
| 6729 | 97 | } |
| 98 | ||
| 15884 | 99 | static PurpleConversation *yahoo_find_conference(PurpleConnection *gc, const char *name) |
| 6729 | 100 | { |
| 101 | struct yahoo_data *yd; | |
| 102 | GSList *l; | |
| 103 | ||
| 104 | yd = gc->proto_data; | |
| 105 | ||
| 106 | for (l = yd->confs; l; l = l->next) { | |
| 15884 | 107 | PurpleConversation *c = l->data; |
| 108 | if (!purple_utf8_strcasecmp(purple_conversation_get_name(c), name)) | |
| 6729 | 109 | return c; |
| 110 | } | |
| 111 | return NULL; | |
| 112 | } | |
| 113 | ||
| 114 | ||
| 15884 | 115 | void yahoo_process_conference_invite(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 116 | { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
117 | PurpleAccount *account; |
| 6729 | 118 | GSList *l; |
| 119 | char *room = NULL; | |
| 120 | char *who = NULL; | |
| 121 | char *msg = NULL; | |
| 122 | GString *members = NULL; | |
| 123 | GHashTable *components; | |
| 124 | ||
| 125 | if (pkt->status == 2) | |
| 126 | return; /* XXX */ | |
| 127 | ||
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
128 | account = purple_connection_get_account(gc); |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
129 | |
| 6729 | 130 | members = g_string_sized_new(512); |
| 131 | ||
| 132 | for (l = pkt->hash; l; l = l->next) { | |
| 133 | struct yahoo_pair *pair = l->data; | |
| 134 | ||
| 135 | switch (pair->key) { | |
| 136 | case 1: /* us, but we already know who we are */ | |
| 137 | break; | |
| 138 | case 57: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
139 | g_free(room); |
| 7827 | 140 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 141 | break; |
| 142 | case 50: /* inviter */ | |
| 143 | who = pair->value; | |
| 144 | g_string_append_printf(members, "%s\n", who); | |
| 145 | break; | |
|
9780
99680462fa73
[gaim-migrate @ 10648]
Peter Lawler <pidgin@bleeter.id.au>
parents:
9768
diff
changeset
|
146 | case 52: /* invitee (me) */ |
|
99680462fa73
[gaim-migrate @ 10648]
Peter Lawler <pidgin@bleeter.id.au>
parents:
9768
diff
changeset
|
147 | case 53: /* members */ |
| 6729 | 148 | g_string_append_printf(members, "%s\n", pair->value); |
| 149 | break; | |
| 150 | case 58: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
151 | g_free(msg); |
| 7827 | 152 | msg = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 153 | break; |
| 154 | case 13: /* ? */ | |
| 155 | break; | |
| 156 | } | |
| 157 | } | |
| 158 | ||
| 159 | if (!room) { | |
| 160 | g_string_free(members, TRUE); | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
161 | g_free(msg); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
162 | return; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
163 | } |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
164 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
165 | if (!purple_privacy_check(account, who) || |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
166 | (purple_account_get_bool(account, "ignore_invites", FALSE))) |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
167 | { |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
168 | purple_debug_info("yahoo", |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
169 | "Invite to conference %s from %s has been dropped.\n", room, who); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
170 | g_free(room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
171 | g_free(msg); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
172 | g_string_free(members, TRUE); |
| 6729 | 173 | return; |
| 174 | } | |
| 175 | ||
| 176 | components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 7827 | 177 | g_hash_table_replace(components, g_strdup("room"), room); |
| 6729 | 178 | if (msg) |
| 7827 | 179 | g_hash_table_replace(components, g_strdup("topic"), msg); |
| 6729 | 180 | g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
181 | g_hash_table_replace(components, g_strdup("members"), g_string_free(members, FALSE)); |
| 6729 | 182 | serv_got_chat_invite(gc, room, who, msg, components); |
| 183 | ||
| 184 | } | |
| 185 | ||
| 15884 | 186 | void yahoo_process_conference_decline(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 187 | { |
| 188 | GSList *l; | |
| 189 | char *room = NULL; | |
| 190 | char *who = NULL; | |
| 191 | char *msg = NULL; | |
| 192 | ||
| 193 | for (l = pkt->hash; l; l = l->next) { | |
| 194 | struct yahoo_pair *pair = l->data; | |
| 195 | ||
| 196 | switch (pair->key) { | |
| 197 | case 57: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
198 | g_free(room); |
| 7827 | 199 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 200 | break; |
| 201 | case 54: | |
| 202 | who = pair->value; | |
| 203 | break; | |
| 204 | case 14: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
205 | g_free(msg); |
| 7827 | 206 | msg = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 207 | break; |
| 208 | } | |
| 209 | } | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
210 | if (!purple_privacy_check(purple_connection_get_account(gc), who)) |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
211 | { |
|
11044
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
212 | g_free(room); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
213 | g_free(msg); |
|
11044
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
214 | return; |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
215 | } |
| 6729 | 216 | |
| 217 | if (who && room) { | |
| 9575 | 218 | /* make sure we're in the room before we process a decline message for it */ |
| 9576 | 219 | if(yahoo_find_conference(gc, room)) { |
| 9575 | 220 | char *tmp; |
| 6729 | 221 | |
| 9575 | 222 | tmp = g_strdup_printf(_("%s declined your conference invitation to room \"%s\" because \"%s\"."), |
| 223 | who, room, msg?msg:""); | |
| 15884 | 224 | purple_notify_info(gc, NULL, _("Invitation Rejected"), tmp); |
| 9575 | 225 | g_free(tmp); |
| 226 | } | |
| 227 | ||
| 7827 | 228 | g_free(room); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
229 | g_free(msg); |
| 6729 | 230 | } |
| 231 | } | |
| 232 | ||
| 15884 | 233 | void yahoo_process_conference_logon(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 234 | { |
| 235 | GSList *l; | |
| 236 | char *room = NULL; | |
| 237 | char *who = NULL; | |
| 15884 | 238 | PurpleConversation *c; |
| 6729 | 239 | |
| 240 | for (l = pkt->hash; l; l = l->next) { | |
| 241 | struct yahoo_pair *pair = l->data; | |
| 242 | ||
| 243 | switch (pair->key) { | |
| 244 | case 57: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
245 | g_free(room); |
| 7827 | 246 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 247 | break; |
| 248 | case 53: | |
| 249 | who = pair->value; | |
| 250 | break; | |
| 251 | } | |
| 252 | } | |
| 253 | ||
| 254 | if (who && room) { | |
| 255 | c = yahoo_find_conference(gc, room); | |
| 256 | if (c) | |
| 15884 | 257 | yahoo_chat_add_user(PURPLE_CONV_CHAT(c), who, NULL); |
| 7827 | 258 | g_free(room); |
| 6729 | 259 | } |
| 260 | } | |
| 261 | ||
| 15884 | 262 | void yahoo_process_conference_logoff(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 263 | { |
| 264 | GSList *l; | |
| 265 | char *room = NULL; | |
| 266 | char *who = NULL; | |
| 15884 | 267 | PurpleConversation *c; |
| 6729 | 268 | |
| 269 | for (l = pkt->hash; l; l = l->next) { | |
| 270 | struct yahoo_pair *pair = l->data; | |
| 271 | ||
| 272 | switch (pair->key) { | |
| 273 | case 57: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
274 | g_free(room); |
| 7827 | 275 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 276 | break; |
| 277 | case 56: | |
| 278 | who = pair->value; | |
| 279 | break; | |
| 280 | } | |
| 281 | } | |
| 282 | ||
| 283 | if (who && room) { | |
| 284 | c = yahoo_find_conference(gc, room); | |
| 285 | if (c) | |
| 15884 | 286 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); |
| 7827 | 287 | g_free(room); |
| 6729 | 288 | } |
| 289 | } | |
| 290 | ||
| 15884 | 291 | void yahoo_process_conference_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 292 | { |
| 293 | GSList *l; | |
| 294 | char *room = NULL; | |
| 295 | char *who = NULL; | |
| 296 | char *msg = NULL; | |
| 7827 | 297 | int utf8 = 0; |
| 15884 | 298 | PurpleConversation *c; |
| 6729 | 299 | |
| 300 | for (l = pkt->hash; l; l = l->next) { | |
| 301 | struct yahoo_pair *pair = l->data; | |
| 302 | ||
| 303 | switch (pair->key) { | |
| 304 | case 57: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
305 | g_free(room); |
| 7827 | 306 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 307 | break; |
| 308 | case 3: | |
| 309 | who = pair->value; | |
| 310 | break; | |
| 311 | case 14: | |
| 312 | msg = pair->value; | |
| 313 | break; | |
| 7827 | 314 | case 97: |
| 315 | utf8 = strtol(pair->value, NULL, 10); | |
| 316 | break; | |
| 6729 | 317 | } |
| 318 | } | |
| 319 | ||
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
320 | if (room && who && msg) { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
321 | char *msg2; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
322 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
323 | c = yahoo_find_conference(gc, room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
324 | if (!c) { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
325 | g_free(room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
326 | return; |
| 6729 | 327 | } |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
328 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
329 | msg2 = yahoo_string_decode(gc, msg, utf8); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
330 | msg = yahoo_codes_to_html(msg2); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
331 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), who, 0, msg, time(NULL)); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
332 | g_free(msg); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
333 | g_free(msg2); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
334 | } |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
335 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
336 | g_free(room); |
| 6729 | 337 | } |
| 338 | ||
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
339 | static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id) |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
340 | { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
341 | struct yahoo_data *yd = gc->proto_data; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
342 | struct yahoo_packet *pkt; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
343 | char *room2; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
344 | gboolean utf8 = TRUE; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
345 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
346 | if (yd->wm) { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
347 | g_return_if_fail(yd->ycht != NULL); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
348 | ycht_chat_join(yd->ycht, room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
349 | return; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
350 | } |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
351 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
352 | /* apparently room names are always utf8, or else always not utf8, |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
353 | * so we don't have to actually pass the flag in the packet. Or something. */ |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
354 | room2 = yahoo_string_encode(gc, room, &utf8); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
355 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
356 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, 0); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
357 | yahoo_packet_hash(pkt, "ssss", |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
358 | 1, purple_connection_get_display_name(gc), |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
359 | 104, room2, |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
360 | 62, "2", |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
361 | 129, id ? id : "0"); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
362 | yahoo_packet_send_and_free(pkt, yd); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
363 | g_free(room2); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
364 | } |
| 6729 | 365 | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8584
diff
changeset
|
366 | /* this is a confirmation of yahoo_chat_online(); */ |
| 15884 | 367 | void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 368 | { |
| 369 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; | |
| 370 | ||
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
371 | if (pkt->status == 1) { |
| 6729 | 372 | yd->chat_online = 1; |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
373 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
374 | /* We need to goto a user in chat */ |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
375 | if (yd->pending_chat_goto) { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
376 | struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, 0); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
377 | yahoo_packet_hash(pkt, "sss", |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
378 | 109, yd->pending_chat_goto, |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
379 | 1, purple_connection_get_display_name(gc), |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
380 | 62, "2"); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
381 | yahoo_packet_send_and_free(pkt, yd); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
382 | } else if (yd->pending_chat_room) { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
383 | yahoo_chat_join(gc, purple_connection_get_display_name(gc), yd->pending_chat_room, |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
384 | yd->pending_chat_topic, yd->pending_chat_id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
385 | } |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
386 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
387 | g_free(yd->pending_chat_room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
388 | yd->pending_chat_room = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
389 | g_free(yd->pending_chat_id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
390 | yd->pending_chat_id = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
391 | g_free(yd->pending_chat_topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
392 | yd->pending_chat_topic = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
393 | g_free(yd->pending_chat_goto); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
394 | yd->pending_chat_goto = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
395 | } |
| 6729 | 396 | } |
| 397 | ||
| 398 | /* this is basicly the opposite of chat_online */ | |
| 15884 | 399 | void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 400 | { |
| 401 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; | |
| 7186 | 402 | GSList *l; |
| 7827 | 403 | |
| 7186 | 404 | for (l = pkt->hash; l; l = l->next) { |
| 405 | struct yahoo_pair *pair = l->data; | |
| 6729 | 406 | |
| 7186 | 407 | if (pair->key == 1) |
| 408 | if (g_ascii_strcasecmp(pair->value, | |
| 15884 | 409 | purple_connection_get_display_name(gc))) |
| 7186 | 410 | return; |
| 411 | } | |
| 7827 | 412 | |
| 7186 | 413 | if (pkt->status == 1) { |
| 6729 | 414 | yd->chat_online = 0; |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
415 | g_free(yd->pending_chat_room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
416 | yd->pending_chat_room = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
417 | g_free(yd->pending_chat_id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
418 | yd->pending_chat_id = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
419 | g_free(yd->pending_chat_topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
420 | yd->pending_chat_topic = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
421 | g_free(yd->pending_chat_goto); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
422 | yd->pending_chat_goto = NULL; |
| 7186 | 423 | if (yd->in_chat) |
| 424 | yahoo_c_leave(gc, YAHOO_CHAT_ID); | |
| 425 | } | |
| 6729 | 426 | } |
| 427 | ||
| 15884 | 428 | void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 429 | { |
| 15884 | 430 | PurpleAccount *account = purple_connection_get_account(gc); |
| 6729 | 431 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; |
| 15884 | 432 | PurpleConversation *c = NULL; |
| 6729 | 433 | GSList *l; |
| 434 | GList *members = NULL; | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
435 | GList *roomies = NULL; |
| 6729 | 436 | char *room = NULL; |
| 437 | char *topic = NULL; | |
| 438 | char *someid, *someotherid, *somebase64orhashosomething, *somenegativenumber; | |
| 439 | ||
| 440 | if (pkt->status == -1) { | |
|
12998
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
441 | /* We can't join */ |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
442 | struct yahoo_pair *pair = pkt->hash->data; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
443 | gchar const *failed_to_join = _("Failed to join chat"); |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
444 | switch (atoi(pair->value)) { |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
445 | case 0xFFFFFFFA: /* -6 */ |
| 15884 | 446 | purple_notify_error(gc, NULL, failed_to_join, _("Unknown room")); |
|
12998
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
447 | break; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
448 | case 0xFFFFFFF1: /* -15 */ |
| 15884 | 449 | purple_notify_error(gc, NULL, failed_to_join, _("Maybe the room is full")); |
|
12998
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
450 | break; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
451 | case 0xFFFFFFDD: /* -35 */ |
| 15884 | 452 | purple_notify_error(gc, NULL, failed_to_join, _("Not available")); |
|
12998
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
453 | break; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
454 | default: |
| 15884 | 455 | purple_notify_error(gc, NULL, failed_to_join, |
|
12998
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
456 | _("Unknown error. You may need to logout and wait five minutes before being able to rejoin a chatroom")); |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
457 | } |
| 6729 | 458 | return; |
| 459 | } | |
| 460 | ||
| 461 | for (l = pkt->hash; l; l = l->next) { | |
| 462 | struct yahoo_pair *pair = l->data; | |
| 463 | ||
| 464 | switch (pair->key) { | |
| 465 | ||
| 466 | case 104: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
467 | g_free(room); |
| 8410 | 468 | room = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 469 | break; |
| 470 | case 105: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
471 | g_free(topic); |
| 8410 | 472 | topic = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 473 | break; |
| 474 | case 128: | |
| 475 | someid = pair->value; | |
| 476 | break; | |
| 477 | case 108: /* number of joiners */ | |
| 478 | break; | |
| 479 | case 129: | |
| 480 | someotherid = pair->value; | |
| 481 | break; | |
| 482 | case 130: | |
| 483 | somebase64orhashosomething = pair->value; | |
| 484 | break; | |
| 485 | case 126: | |
| 486 | somenegativenumber = pair->value; | |
| 487 | break; | |
| 488 | case 13: /* this is 1. maybe its the type of room? (normal, user created, private, etc?) */ | |
| 489 | break; | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8584
diff
changeset
|
490 | case 61: /*this looks similar to 130 */ |
| 6729 | 491 | break; |
| 492 | ||
| 493 | /* the previous section was just room info. this next section is | |
| 494 | info about individual room members, (including us) */ | |
| 495 | ||
| 496 | case 109: /* the yahoo id */ | |
| 497 | members = g_list_append(members, pair->value); | |
| 498 | break; | |
| 499 | case 110: /* age */ | |
| 500 | break; | |
| 501 | case 141: /* nickname */ | |
| 502 | break; | |
| 503 | case 142: /* location */ | |
| 504 | break; | |
| 505 | case 113: /* bitmask */ | |
| 506 | break; | |
| 507 | } | |
| 508 | } | |
| 509 | ||
| 15884 | 510 | if (room && yd->chat_name && purple_utf8_strcasecmp(room, yd->chat_name)) |
| 7186 | 511 | yahoo_chat_leave(gc, room, |
| 15884 | 512 | purple_connection_get_display_name(gc), FALSE); |
| 6729 | 513 | |
| 15884 | 514 | c = purple_find_chat(gc, YAHOO_CHAT_ID); |
| 6729 | 515 | |
| 15884 | 516 | if (room && (!c || purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) && members && |
| 8357 | 517 | ((g_list_length(members) > 1) || |
| 15884 | 518 | !g_ascii_strcasecmp(members->data, purple_connection_get_display_name(gc)))) { |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
519 | int i; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
520 | GList *flags = NULL; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
521 | for (i = 0; i < g_list_length(members); i++) |
| 15884 | 522 | flags = g_list_append(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE)); |
| 523 | if (c && purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) { | |
| 8357 | 524 | /* this might be a hack, but oh well, it should nicely */ |
| 525 | char *tmpmsg; | |
| 526 | ||
| 15884 | 527 | purple_conversation_set_name(c, room); |
| 8357 | 528 | |
| 529 | c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
530 | if (topic) { |
| 15884 | 531 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
532 | /* Also print the topic to the backlog so that the captcha link is clickable */ |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
533 | purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", topic, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
534 | } |
| 8357 | 535 | yd->in_chat = 1; |
| 536 | yd->chat_name = g_strdup(room); | |
| 15884 | 537 | purple_conv_chat_add_users(PURPLE_CONV_CHAT(c), members, NULL, flags, FALSE); |
| 8357 | 538 | |
| 539 | tmpmsg = g_strdup_printf(_("You are now chatting in %s."), room); | |
| 15884 | 540 | purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", tmpmsg, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 8357 | 541 | g_free(tmpmsg); |
| 542 | } else { | |
| 543 | c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
544 | if (topic) { |
| 15884 | 545 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
546 | /* Also print the topic to the backlog so that the captcha link is clickable */ |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
547 | purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", topic, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
548 | } |
| 8357 | 549 | yd->in_chat = 1; |
| 550 | yd->chat_name = g_strdup(room); | |
| 15884 | 551 | purple_conv_chat_add_users(PURPLE_CONV_CHAT(c), members, NULL, flags, FALSE); |
| 8357 | 552 | } |
|
14031
c9283f5bf3da
[gaim-migrate @ 16527]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13272
diff
changeset
|
553 | g_list_free(flags); |
| 7186 | 554 | } else if (c) { |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
555 | if (topic) { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
556 | const char *cur_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(c)); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
557 | if (cur_topic == NULL || strcmp(cur_topic, topic) != 0) |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
558 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
559 | } |
| 15884 | 560 | yahoo_chat_add_users(PURPLE_CONV_CHAT(c), members); |
| 6729 | 561 | } |
| 562 | ||
|
11527
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
563 | if (account->deny && c) { |
| 15884 | 564 | PurpleConversationUiOps *ops = purple_conversation_get_ui_ops(c); |
|
11527
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
565 | for (l = account->deny; l != NULL; l = l->next) { |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
566 | for (roomies = members; roomies; roomies = roomies->next) { |
| 15884 | 567 | if (!purple_utf8_strcasecmp((char *)l->data, roomies->data)) { |
|
22709
6bd336964410
Printf warning fixes.
Daniel Atallah <datallah@pidgin.im>
parents:
22366
diff
changeset
|
568 | purple_debug_info("yahoo", "Ignoring room member %s in room %s\n" , (char *)roomies->data, room ? room : ""); |
| 15884 | 569 | purple_conv_chat_ignore(PURPLE_CONV_CHAT(c),roomies->data); |
|
11527
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
570 | ops->chat_update_user(c, roomies->data); |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
571 | } |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
572 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
573 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
574 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
575 | g_list_free(roomies); |
| 6729 | 576 | g_list_free(members); |
| 7827 | 577 | g_free(room); |
|
11527
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
578 | g_free(topic); |
| 6729 | 579 | } |
| 580 | ||
| 15884 | 581 | void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 582 | { |
| 583 | char *who = NULL; | |
| 7186 | 584 | char *room = NULL; |
| 6729 | 585 | GSList *l; |
| 586 | struct yahoo_data *yd; | |
| 587 | ||
| 588 | yd = gc->proto_data; | |
| 589 | ||
| 590 | for (l = pkt->hash; l; l = l->next) { | |
| 591 | struct yahoo_pair *pair = l->data; | |
| 592 | ||
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
593 | if (pair->key == 104) { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
594 | g_free(room); |
| 8410 | 595 | room = yahoo_string_decode(gc, pair->value, TRUE); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
596 | } |
| 6729 | 597 | if (pair->key == 109) |
| 598 | who = pair->value; | |
| 599 | } | |
| 600 | ||
| 7186 | 601 | if (who && room) { |
| 15884 | 602 | PurpleConversation *c = purple_find_chat(gc, YAHOO_CHAT_ID); |
| 603 | if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room)) | |
| 604 | purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); | |
| 6729 | 605 | |
| 606 | } | |
| 7827 | 607 | if (room) |
| 608 | g_free(room); | |
| 6729 | 609 | } |
| 610 | ||
| 15884 | 611 | void yahoo_process_chat_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 612 | { |
| 7827 | 613 | char *room = NULL, *who = NULL, *msg = NULL, *msg2; |
| 8410 | 614 | int msgtype = 1, utf8 = 1; /* default to utf8 */ |
| 15884 | 615 | PurpleConversation *c = NULL; |
| 6729 | 616 | GSList *l; |
| 617 | ||
| 618 | for (l = pkt->hash; l; l = l->next) { | |
| 619 | struct yahoo_pair *pair = l->data; | |
| 620 | ||
| 621 | switch (pair->key) { | |
| 622 | ||
| 7827 | 623 | case 97: |
| 624 | utf8 = strtol(pair->value, NULL, 10); | |
| 625 | break; | |
| 6729 | 626 | case 104: |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
627 | g_free(room); |
| 8410 | 628 | room = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 629 | break; |
| 630 | case 109: | |
| 631 | who = pair->value; | |
| 632 | break; | |
| 633 | case 117: | |
| 634 | msg = pair->value; | |
| 635 | break; | |
| 636 | case 124: | |
| 637 | msgtype = strtol(pair->value, NULL, 10); | |
| 638 | break; | |
| 639 | } | |
| 640 | } | |
| 641 | ||
| 15884 | 642 | c = purple_find_chat(gc, YAHOO_CHAT_ID); |
| 7827 | 643 | if (!who || !c) { |
| 644 | if (room) | |
| 645 | g_free(room); | |
| 6729 | 646 | /* we still get messages after we part, funny that */ |
| 647 | return; | |
| 648 | } | |
| 649 | ||
| 650 | if (!msg) { | |
| 15884 | 651 | purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Got a message packet with no message.\nThis probably means something important, but we're ignoring it.\n"); |
| 6729 | 652 | return; |
| 653 | } | |
| 7827 | 654 | msg2 = yahoo_string_decode(gc, msg, utf8); |
| 655 | msg = yahoo_codes_to_html(msg2); | |
| 656 | g_free(msg2); | |
| 6729 | 657 | |
| 658 | if (msgtype == 2 || msgtype == 3) { | |
| 659 | char *tmp; | |
| 660 | tmp = g_strdup_printf("/me %s", msg); | |
| 661 | g_free(msg); | |
| 662 | msg = tmp; | |
| 663 | } | |
| 664 | ||
| 665 | serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, msg, time(NULL)); | |
| 666 | g_free(msg); | |
| 11593 | 667 | g_free(room); |
| 6729 | 668 | } |
| 669 | ||
| 15884 | 670 | void yahoo_process_chat_addinvite(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 671 | { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
672 | PurpleAccount *account; |
| 6729 | 673 | GSList *l; |
| 674 | char *room = NULL; | |
| 675 | char *msg = NULL; | |
| 676 | char *who = NULL; | |
| 677 | ||
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
678 | account = purple_connection_get_account(gc); |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
679 | |
| 6729 | 680 | for (l = pkt->hash; l; l = l->next) { |
| 681 | struct yahoo_pair *pair = l->data; | |
| 682 | ||
| 683 | switch (pair->key) { | |
| 684 | case 104: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
685 | g_free(room); |
| 8410 | 686 | room = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 687 | break; |
| 688 | case 129: /* room id? */ | |
| 689 | break; | |
| 690 | case 126: /* ??? */ | |
| 691 | break; | |
| 692 | case 117: | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
693 | g_free(msg); |
| 7827 | 694 | msg = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 695 | break; |
| 696 | case 119: | |
| 697 | who = pair->value; | |
| 698 | break; | |
| 699 | case 118: /* us */ | |
| 700 | break; | |
| 701 | } | |
| 702 | } | |
| 703 | ||
| 704 | if (room && who) { | |
| 705 | GHashTable *components; | |
| 706 | ||
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
707 | if (!purple_privacy_check(account, who) || |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
708 | (purple_account_get_bool(account, "ignore_invites", FALSE))) |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22220
diff
changeset
|
709 | { |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
710 | purple_debug_info("yahoo", "Invite to room %s from %s has been dropped.\n", room, who); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
711 | g_free(room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
712 | g_free(msg); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
713 | return; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
714 | } |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
715 | |
| 6729 | 716 | components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
| 717 | g_hash_table_replace(components, g_strdup("room"), g_strdup(room)); | |
| 718 | serv_got_chat_invite(gc, room, who, msg, components); | |
| 719 | } | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
720 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
721 | g_free(room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
722 | g_free(msg); |
| 6729 | 723 | } |
| 724 | ||
| 15884 | 725 | void yahoo_process_chat_goto(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6729 | 726 | { |
| 727 | if (pkt->status == -1) | |
| 15884 | 728 | purple_notify_error(gc, NULL, _("Failed to join buddy in chat"), |
| 6729 | 729 | _("Maybe they're not in a chat?")); |
| 730 | } | |
| 731 | ||
| 732 | /* | |
| 733 | * Functions dealing with conferences | |
| 7827 | 734 | * I think conference names are always ascii. |
| 6729 | 735 | */ |
| 736 | ||
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
737 | void yahoo_conf_leave(struct yahoo_data *yd, const char *room, const char *dn, GList *who) |
| 6729 | 738 | { |
| 739 | struct yahoo_packet *pkt; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
740 | GList *w; |
| 6729 | 741 | |
| 15884 | 742 | purple_debug_misc("yahoo", "leaving conference %s\n", room); |
|
19567
3d67b09ddd8d
Fix entering yahoo chats.
Daniel Atallah <datallah@pidgin.im>
parents:
18413
diff
changeset
|
743 | |
| 6729 | 744 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGOFF, YAHOO_STATUS_AVAILABLE, 0); |
| 745 | ||
| 10394 | 746 | yahoo_packet_hash_str(pkt, 1, dn); |
| 6729 | 747 | for (w = who; w; w = w->next) { |
| 15884 | 748 | const char *name = purple_conv_chat_cb_get_name(w->data); |
| 10394 | 749 | yahoo_packet_hash_str(pkt, 3, name); |
| 6729 | 750 | } |
| 751 | ||
| 10394 | 752 | yahoo_packet_hash_str(pkt, 57, room); |
| 10392 | 753 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 754 | } |
| 755 | ||
| 15884 | 756 | static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room, |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
757 | GList *members, const char *what) |
| 6729 | 758 | { |
| 7827 | 759 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 760 | struct yahoo_packet *pkt; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
761 | GList *who; |
| 7827 | 762 | char *msg, *msg2; |
| 763 | int utf8 = 1; | |
| 6804 | 764 | |
| 765 | msg = yahoo_html_to_codes(what); | |
| 7827 | 766 | msg2 = yahoo_string_encode(gc, msg, &utf8); |
| 767 | ||
| 6729 | 768 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFMSG, YAHOO_STATUS_AVAILABLE, 0); |
| 769 | ||
| 10394 | 770 | yahoo_packet_hash_str(pkt, 1, dn); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
771 | for (who = members; who; who = who->next) { |
| 15884 | 772 | const char *name = purple_conv_chat_cb_get_name(who->data); |
| 10394 | 773 | yahoo_packet_hash_str(pkt, 53, name); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
774 | } |
| 10394 | 775 | yahoo_packet_hash(pkt, "ss", 57, room, 14, msg2); |
| 7827 | 776 | if (utf8) |
| 10394 | 777 | yahoo_packet_hash_str(pkt, 97, "1"); /* utf-8 */ |
| 6729 | 778 | |
| 10392 | 779 | yahoo_packet_send_and_free(pkt, yd); |
| 6804 | 780 | g_free(msg); |
| 7827 | 781 | g_free(msg2); |
| 6729 | 782 | |
| 783 | return 0; | |
| 784 | } | |
| 785 | ||
| 15884 | 786 | static void yahoo_conf_join(struct yahoo_data *yd, PurpleConversation *c, const char *dn, const char *room, |
| 6729 | 787 | const char *topic, const char *members) |
| 788 | { | |
| 789 | struct yahoo_packet *pkt; | |
| 790 | char **memarr = NULL; | |
| 791 | int i; | |
| 792 | ||
| 793 | if (members) | |
| 794 | memarr = g_strsplit(members, "\n", 0); | |
| 795 | ||
| 796 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGON, YAHOO_STATUS_AVAILABLE, 0); | |
| 797 | ||
| 10394 | 798 | yahoo_packet_hash(pkt, "sss", 1, dn, 3, dn, 57, room); |
| 6729 | 799 | if (memarr) { |
| 800 | for(i = 0 ; memarr[i]; i++) { | |
| 801 | if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn)) | |
| 802 | continue; | |
| 10394 | 803 | yahoo_packet_hash_str(pkt, 3, memarr[i]); |
| 15884 | 804 | purple_conv_chat_add_user(PURPLE_CONV_CHAT(c), memarr[i], NULL, PURPLE_CBFLAGS_NONE, TRUE); |
| 6729 | 805 | } |
| 806 | } | |
| 10392 | 807 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 808 | |
| 809 | if (memarr) | |
| 810 | g_strfreev(memarr); | |
| 811 | } | |
| 812 | ||
| 15884 | 813 | static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, |
| 6729 | 814 | const char *dn, const char *buddy, const char *room, const char *msg) |
| 815 | { | |
| 7827 | 816 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 817 | struct yahoo_packet *pkt; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
818 | GList *members; |
| 7827 | 819 | char *msg2 = NULL; |
| 820 | ||
| 821 | if (msg) | |
| 822 | msg2 = yahoo_string_encode(gc, msg, NULL); | |
| 6729 | 823 | |
| 15884 | 824 | members = purple_conv_chat_get_users(PURPLE_CONV_CHAT(c)); |
| 6729 | 825 | |
| 826 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, 0); | |
| 827 | ||
| 10394 | 828 | yahoo_packet_hash(pkt, "sssss", 1, dn, 51, buddy, 57, room, 58, msg?msg2:"", 13, "0"); |
| 6729 | 829 | for(; members; members = members->next) { |
| 15884 | 830 | const char *name = purple_conv_chat_cb_get_name(members->data); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
831 | if (!strcmp(name, dn)) |
| 6729 | 832 | continue; |
| 10394 | 833 | yahoo_packet_hash(pkt, "ss", 52, name, 53, name); |
| 6729 | 834 | } |
|
19567
3d67b09ddd8d
Fix entering yahoo chats.
Daniel Atallah <datallah@pidgin.im>
parents:
18413
diff
changeset
|
835 | |
| 10392 | 836 | yahoo_packet_send_and_free(pkt, yd); |
| 837 | g_free(msg2); | |
| 6729 | 838 | } |
| 839 | ||
| 840 | /* | |
| 841 | * Functions dealing with chats | |
| 842 | */ | |
| 843 | ||
| 15884 | 844 | static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout) |
| 6729 | 845 | { |
| 7186 | 846 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 847 | struct yahoo_packet *pkt; |
| 15884 | 848 | PurpleConversation *c; |
|
12865
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
849 | |
| 7827 | 850 | char *eroom; |
| 8410 | 851 | gboolean utf8 = 1; |
| 7827 | 852 | |
| 9376 | 853 | if (yd->wm) { |
| 854 | g_return_if_fail(yd->ycht != NULL); | |
| 855 | ||
| 856 | ycht_chat_leave(yd->ycht, room, logout); | |
| 857 | return; | |
| 858 | } | |
| 859 | ||
| 8410 | 860 | eroom = yahoo_string_encode(gc, room, &utf8); |
| 6729 | 861 | |
| 862 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 863 | yahoo_packet_hash(pkt, "sss", 104, eroom, 109, dn, 108, "1"); |
| 864 | yahoo_packet_hash_str(pkt, 112, "0"); /* what does this one mean? */ | |
| 10392 | 865 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 866 | |
| 867 | yd->in_chat = 0; | |
| 868 | if (yd->chat_name) { | |
| 869 | g_free(yd->chat_name); | |
| 870 | yd->chat_name = NULL; | |
| 871 | } | |
| 872 | ||
| 15884 | 873 | if ((c = purple_find_chat(gc, YAHOO_CHAT_ID))) |
| 7186 | 874 | serv_got_chat_left(gc, YAHOO_CHAT_ID); |
| 875 | ||
| 876 | if (!logout) | |
| 877 | return; | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
878 | |
| 7186 | 879 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATLOGOUT, |
| 880 | YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 881 | yahoo_packet_hash_str(pkt, 1, dn); |
| 10392 | 882 | yahoo_packet_send_and_free(pkt, yd); |
| 7186 | 883 | |
| 884 | yd->chat_online = 0; | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
885 | g_free(yd->pending_chat_room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
886 | yd->pending_chat_room = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
887 | g_free(yd->pending_chat_id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
888 | yd->pending_chat_id = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
889 | g_free(yd->pending_chat_topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
890 | yd->pending_chat_topic = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
891 | g_free(yd->pending_chat_goto); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
892 | yd->pending_chat_goto = NULL; |
| 7827 | 893 | g_free(eroom); |
| 6729 | 894 | } |
| 895 | ||
| 15884 | 896 | static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags) |
| 6729 | 897 | { |
| 7827 | 898 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 899 | struct yahoo_packet *pkt; |
| 900 | int me = 0; | |
| 7827 | 901 | char *msg1, *msg2, *room2; |
| 902 | gboolean utf8 = TRUE; | |
| 6804 | 903 | |
| 9376 | 904 | if (yd->wm) { |
| 905 | g_return_val_if_fail(yd->ycht != NULL, 1); | |
| 906 | ||
| 907 | return ycht_chat_send(yd->ycht, room, what); | |
| 908 | } | |
| 909 | ||
| 6804 | 910 | msg1 = g_strdup(what); |
| 6729 | 911 | |
|
18413
ae04f38e5b31
Remove static meify from yahoochat.c and replace use of it with
Will Thompson <resiak@pidgin.im>
parents:
18273
diff
changeset
|
912 | if (purple_message_meify(msg1, -1)) |
| 6729 | 913 | me = 1; |
| 6804 | 914 | |
| 915 | msg2 = yahoo_html_to_codes(msg1); | |
| 916 | g_free(msg1); | |
| 7827 | 917 | msg1 = yahoo_string_encode(gc, msg2, &utf8); |
| 918 | g_free(msg2); | |
| 919 | room2 = yahoo_string_encode(gc, room, NULL); | |
| 6729 | 920 | |
| 921 | pkt = yahoo_packet_new(YAHOO_SERVICE_COMMENT, YAHOO_STATUS_AVAILABLE, 0); | |
| 922 | ||
| 10394 | 923 | yahoo_packet_hash(pkt, "sss", 1, dn, 104, room2, 117, msg1); |
| 6729 | 924 | if (me) |
| 10394 | 925 | yahoo_packet_hash_str(pkt, 124, "2"); |
| 6729 | 926 | else |
| 10394 | 927 | yahoo_packet_hash_str(pkt, 124, "1"); |
| 6729 | 928 | /* fixme: what about /think? (124=3) */ |
| 7827 | 929 | if (utf8) |
| 10394 | 930 | yahoo_packet_hash_str(pkt, 97, "1"); |
| 6729 | 931 | |
| 10392 | 932 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 933 | g_free(msg1); |
| 934 | g_free(room2); | |
| 6729 | 935 | |
| 936 | return 0; | |
| 937 | } | |
| 938 | ||
| 939 | ||
| 15884 | 940 | static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy, |
| 6729 | 941 | const char *room, const char *msg) |
| 942 | { | |
| 7827 | 943 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 944 | struct yahoo_packet *pkt; |
| 7827 | 945 | char *room2, *msg2 = NULL; |
| 8410 | 946 | gboolean utf8 = TRUE; |
| 6729 | 947 | |
| 9376 | 948 | if (yd->wm) { |
| 949 | g_return_if_fail(yd->ycht != NULL); | |
| 950 | ycht_chat_send_invite(yd->ycht, room, buddy, msg); | |
| 951 | return; | |
| 952 | } | |
| 953 | ||
| 8410 | 954 | room2 = yahoo_string_encode(gc, room, &utf8); |
| 7827 | 955 | if (msg) |
| 956 | msg2 = yahoo_string_encode(gc, msg, NULL); | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
957 | |
| 6729 | 958 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, 0); |
| 10394 | 959 | yahoo_packet_hash(pkt, "sssss", 1, dn, 118, buddy, 104, room2, 117, (msg2?msg2:""), 129, "0"); |
| 10392 | 960 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 961 | |
| 962 | g_free(room2); | |
| 10392 | 963 | g_free(msg2); |
| 6729 | 964 | } |
| 965 | ||
| 15884 | 966 | void yahoo_chat_goto(PurpleConnection *gc, const char *name) |
| 6729 | 967 | { |
| 968 | struct yahoo_data *yd; | |
| 969 | struct yahoo_packet *pkt; | |
| 970 | ||
| 971 | yd = gc->proto_data; | |
| 972 | ||
| 9376 | 973 | if (yd->wm) { |
| 974 | g_return_if_fail(yd->ycht != NULL); | |
| 975 | ycht_chat_goto_user(yd->ycht, name); | |
| 976 | return; | |
| 977 | } | |
| 978 | ||
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
979 | if (!yd->chat_online) { |
| 6729 | 980 | yahoo_chat_online(gc); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
981 | g_free(yd->pending_chat_room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
982 | yd->pending_chat_room = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
983 | g_free(yd->pending_chat_id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
984 | yd->pending_chat_id = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
985 | g_free(yd->pending_chat_topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
986 | yd->pending_chat_topic = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
987 | g_free(yd->pending_chat_goto); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
988 | yd->pending_chat_goto = g_strdup(name); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
989 | return; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
990 | } |
| 6729 | 991 | |
| 992 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, 0); | |
| 15884 | 993 | yahoo_packet_hash(pkt, "sss", 109, name, 1, purple_connection_get_display_name(gc), 62, "2"); |
| 10392 | 994 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 995 | } |
| 996 | /* | |
| 997 | * These are the functions registered with the core | |
| 998 | * which get called for both chats and conferences. | |
| 999 | */ | |
| 1000 | ||
| 15884 | 1001 | void yahoo_c_leave(PurpleConnection *gc, int id) |
| 6729 | 1002 | { |
| 1003 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; | |
| 15884 | 1004 | PurpleConversation *c; |
| 6729 | 1005 | |
| 1006 | if (!yd) | |
| 1007 | return; | |
| 1008 | ||
| 15884 | 1009 | c = purple_find_chat(gc, id); |
| 6729 | 1010 | if (!c) |
| 1011 | return; | |
| 1012 | ||
| 1013 | if (id != YAHOO_CHAT_ID) { | |
| 15884 | 1014 | yahoo_conf_leave(yd, purple_conversation_get_name(c), |
| 1015 | purple_connection_get_display_name(gc), purple_conv_chat_get_users(PURPLE_CONV_CHAT(c))); | |
| 6729 | 1016 | yd->confs = g_slist_remove(yd->confs, c); |
| 1017 | } else { | |
| 15884 | 1018 | yahoo_chat_leave(gc, purple_conversation_get_name(c), purple_connection_get_display_name(gc), TRUE); |
| 6729 | 1019 | } |
| 1020 | ||
| 1021 | serv_got_chat_left(gc, id); | |
| 1022 | } | |
| 1023 | ||
| 15884 | 1024 | int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) |
| 6729 | 1025 | { |
| 15884 | 1026 | PurpleConversation *c; |
| 6729 | 1027 | int ret; |
| 1028 | struct yahoo_data *yd; | |
| 1029 | ||
| 1030 | yd = (struct yahoo_data *) gc->proto_data; | |
| 1031 | if (!yd) | |
| 1032 | return -1; | |
| 1033 | ||
| 15884 | 1034 | c = purple_find_chat(gc, id); |
| 6729 | 1035 | if (!c) |
| 1036 | return -1; | |
| 1037 | ||
| 1038 | if (id != YAHOO_CHAT_ID) { | |
| 15884 | 1039 | ret = yahoo_conf_send(gc, purple_connection_get_display_name(gc), |
| 1040 | purple_conversation_get_name(c), purple_conv_chat_get_users(PURPLE_CONV_CHAT(c)), what); | |
| 6729 | 1041 | } else { |
| 15884 | 1042 | ret = yahoo_chat_send(gc, purple_connection_get_display_name(gc), |
| 1043 | purple_conversation_get_name(c), what, flags); | |
| 6729 | 1044 | if (!ret) |
| 15884 | 1045 | serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), |
|
23295
5d3a2fd59439
When calling serv_got_chat_in() after sending a group chat message (to let
Evan Schoenberg <evands@pidgin.im>
parents:
22709
diff
changeset
|
1046 | purple_connection_get_display_name(gc), flags, what, time(NULL)); |
| 6729 | 1047 | } |
| 1048 | return ret; | |
| 1049 | } | |
| 1050 | ||
| 15884 | 1051 | GList *yahoo_c_info(PurpleConnection *gc) |
| 6729 | 1052 | { |
| 1053 | GList *m = NULL; | |
| 1054 | struct proto_chat_entry *pce; | |
| 1055 | ||
| 1056 | pce = g_new0(struct proto_chat_entry, 1); | |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7827
diff
changeset
|
1057 | pce->label = _("_Room:"); |
| 6729 | 1058 | pce->identifier = "room"; |
|
10954
cd5771cb6cf8
[gaim-migrate @ 12754]
Richard Laager <rlaager@pidgin.im>
parents:
10937
diff
changeset
|
1059 | pce->required = TRUE; |
| 6729 | 1060 | m = g_list_append(m, pce); |
| 1061 | ||
| 1062 | return m; | |
| 1063 | } | |
| 1064 | ||
| 15884 | 1065 | GHashTable *yahoo_c_info_defaults(PurpleConnection *gc, const char *chat_name) |
| 9768 | 1066 | { |
| 1067 | GHashTable *defaults; | |
| 1068 | ||
| 1069 | defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); | |
| 1070 | ||
| 1071 | if (chat_name != NULL) | |
| 1072 | g_hash_table_insert(defaults, "room", g_strdup(chat_name)); | |
| 1073 | ||
| 1074 | return defaults; | |
| 1075 | } | |
| 1076 | ||
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1077 | char *yahoo_get_chat_name(GHashTable *data) |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1078 | { |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1079 | return g_strdup(g_hash_table_lookup(data, "room")); |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1080 | } |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1081 | |
| 15884 | 1082 | void yahoo_c_join(PurpleConnection *gc, GHashTable *data) |
| 6729 | 1083 | { |
| 1084 | struct yahoo_data *yd; | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1085 | char *room, *topic, *type; |
| 15884 | 1086 | PurpleConversation *c; |
| 6729 | 1087 | |
| 1088 | yd = (struct yahoo_data *) gc->proto_data; | |
| 1089 | if (!yd) | |
| 1090 | return; | |
| 1091 | ||
| 1092 | room = g_hash_table_lookup(data, "room"); | |
| 1093 | if (!room) | |
| 1094 | return; | |
| 1095 | ||
| 1096 | topic = g_hash_table_lookup(data, "topic"); | |
| 1097 | if (!topic) | |
| 1098 | topic = ""; | |
| 1099 | ||
| 1100 | if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) { | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1101 | int id; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1102 | const char *members = g_hash_table_lookup(data, "members"); |
| 6729 | 1103 | id = yd->conf_id++; |
| 1104 | c = serv_got_joined_chat(gc, id, room); | |
| 1105 | yd->confs = g_slist_prepend(yd->confs, c); | |
| 15884 | 1106 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), purple_connection_get_display_name(gc), topic); |
| 1107 | yahoo_conf_join(yd, c, purple_connection_get_display_name(gc), room, topic, members); | |
| 6729 | 1108 | return; |
| 1109 | } else { | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1110 | const char *id; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1111 | /*if (yd->in_chat) |
| 7186 | 1112 | yahoo_chat_leave(gc, room, |
| 15884 | 1113 | purple_connection_get_display_name(gc), |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1114 | FALSE);*/ |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1115 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1116 | id = g_hash_table_lookup(data, "id"); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1117 | |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1118 | if (!yd->chat_online) { |
| 6729 | 1119 | yahoo_chat_online(gc); |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1120 | g_free(yd->pending_chat_room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1121 | yd->pending_chat_room = g_strdup(room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1122 | g_free(yd->pending_chat_id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1123 | yd->pending_chat_id = g_strdup(id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1124 | g_free(yd->pending_chat_topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1125 | yd->pending_chat_topic = g_strdup(topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1126 | g_free(yd->pending_chat_goto); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1127 | yd->pending_chat_goto = NULL; |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1128 | } else { |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1129 | yahoo_chat_join(gc, purple_connection_get_display_name(gc), room, topic, id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1130 | } |
| 6729 | 1131 | return; |
| 1132 | } | |
| 1133 | } | |
| 1134 | ||
| 15884 | 1135 | void yahoo_c_invite(PurpleConnection *gc, int id, const char *msg, const char *name) |
| 6729 | 1136 | { |
| 15884 | 1137 | PurpleConversation *c; |
| 6729 | 1138 | |
| 15884 | 1139 | c = purple_find_chat(gc, id); |
| 6729 | 1140 | if (!c || !c->name) |
| 1141 | return; | |
| 1142 | ||
| 1143 | if (id != YAHOO_CHAT_ID) { | |
| 15884 | 1144 | yahoo_conf_invite(gc, c, purple_connection_get_display_name(gc), name, |
| 1145 | purple_conversation_get_name(c), msg); | |
| 6729 | 1146 | } else { |
| 15884 | 1147 | yahoo_chat_invite(gc, purple_connection_get_display_name(gc), name, |
| 1148 | purple_conversation_get_name(c), msg); | |
| 6729 | 1149 | } |
| 1150 | } | |
| 1151 | ||
| 8113 | 1152 | struct yahoo_roomlist { |
| 1153 | int fd; | |
| 1154 | int inpa; | |
|
13272
fd4f3356640f
[gaim-migrate @ 15637]
Daniel Atallah <datallah@pidgin.im>
parents:
13201
diff
changeset
|
1155 | gchar *txbuf; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1156 | gsize tx_written; |
| 8113 | 1157 | guchar *rxqueue; |
| 1158 | int rxlen; | |
| 1159 | gboolean started; | |
| 1160 | char *path; | |
| 1161 | char *host; | |
| 15884 | 1162 | PurpleRoomlist *list; |
| 1163 | PurpleRoomlistRoom *cat; | |
| 1164 | PurpleRoomlistRoom *ucat; | |
| 8113 | 1165 | GMarkupParseContext *parse; |
| 1166 | }; | |
| 1167 | ||
| 1168 | static void yahoo_roomlist_destroy(struct yahoo_roomlist *yrl) | |
| 1169 | { | |
| 1170 | if (yrl->inpa) | |
| 15884 | 1171 | purple_input_remove(yrl->inpa); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1172 | g_free(yrl->txbuf); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1173 | g_free(yrl->rxqueue); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1174 | g_free(yrl->path); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1175 | g_free(yrl->host); |
| 8113 | 1176 | if (yrl->parse) |
| 1177 | g_markup_parse_context_free(yrl->parse); | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10394
diff
changeset
|
1178 | g_free(yrl); |
| 8113 | 1179 | } |
| 1180 | ||
| 1181 | enum yahoo_room_type { | |
| 1182 | yrt_yahoo, | |
| 1183 | yrt_user, | |
| 1184 | }; | |
| 1185 | ||
| 1186 | struct yahoo_chatxml_state { | |
| 15884 | 1187 | PurpleRoomlist *list; |
| 8113 | 1188 | struct yahoo_roomlist *yrl; |
| 1189 | GQueue *q; | |
| 1190 | struct { | |
| 1191 | enum yahoo_room_type type; | |
| 1192 | char *name; | |
| 1193 | char *topic; | |
| 1194 | char *id; | |
| 1195 | int users, voices, webcams; | |
| 1196 | } room; | |
| 1197 | }; | |
| 1198 | ||
| 1199 | struct yahoo_lobby { | |
| 1200 | int count, users, voices, webcams; | |
| 1201 | }; | |
| 1202 | ||
| 15884 | 1203 | static struct yahoo_chatxml_state *yahoo_chatxml_state_new(PurpleRoomlist *list, struct yahoo_roomlist *yrl) |
| 8113 | 1204 | { |
| 1205 | struct yahoo_chatxml_state *s; | |
| 1206 | ||
| 1207 | s = g_new0(struct yahoo_chatxml_state, 1); | |
| 1208 | s->list = list; | |
| 1209 | s->yrl = yrl; | |
| 1210 | s->q = g_queue_new(); | |
| 1211 | ||
| 1212 | return s; | |
| 1213 | } | |
| 1214 | ||
| 1215 | static void yahoo_chatxml_state_destroy(struct yahoo_chatxml_state *s) | |
| 1216 | { | |
| 1217 | g_queue_free(s->q); | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1218 | g_free(s->room.name); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1219 | g_free(s->room.topic); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1220 | g_free(s->room.id); |
| 8113 | 1221 | g_free(s); |
| 1222 | } | |
| 1223 | ||
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1224 | static void yahoo_chatlist_start_element(GMarkupParseContext *context, |
|
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1225 | const gchar *ename, const gchar **anames, |
|
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1226 | const gchar **avalues, gpointer user_data, |
|
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1227 | GError **error) |
| 8113 | 1228 | { |
| 1229 | struct yahoo_chatxml_state *s = user_data; | |
| 15884 | 1230 | PurpleRoomlist *list = s->list; |
| 1231 | PurpleRoomlistRoom *r; | |
| 1232 | PurpleRoomlistRoom *parent; | |
| 8113 | 1233 | int i; |
| 1234 | ||
| 1235 | if (!strcmp(ename, "category")) { | |
| 1236 | const gchar *name = NULL, *id = NULL; | |
| 1237 | ||
| 1238 | for (i = 0; anames[i]; i++) { | |
| 1239 | if (!strcmp(anames[i], "id")) | |
| 1240 | id = avalues[i]; | |
| 1241 | if (!strcmp(anames[i], "name")) | |
| 1242 | name = avalues[i]; | |
| 1243 | } | |
| 1244 | if (!name || !id) | |
| 1245 | return; | |
| 1246 | ||
| 1247 | parent = g_queue_peek_head(s->q); | |
| 15884 | 1248 | r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, name, parent); |
| 1249 | purple_roomlist_room_add_field(list, r, (gpointer)name); | |
| 1250 | purple_roomlist_room_add_field(list, r, (gpointer)id); | |
| 1251 | purple_roomlist_room_add(list, r); | |
| 8113 | 1252 | g_queue_push_head(s->q, r); |
| 1253 | } else if (!strcmp(ename, "room")) { | |
| 1254 | s->room.users = s->room.voices = s->room.webcams = 0; | |
| 1255 | ||
| 1256 | for (i = 0; anames[i]; i++) { | |
| 1257 | if (!strcmp(anames[i], "id")) { | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1258 | g_free(s->room.id); |
| 8113 | 1259 | s->room.id = g_strdup(avalues[i]); |
| 1260 | } else if (!strcmp(anames[i], "name")) { | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1261 | g_free(s->room.name); |
| 8113 | 1262 | s->room.name = g_strdup(avalues[i]); |
| 1263 | } else if (!strcmp(anames[i], "topic")) { | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19567
diff
changeset
|
1264 | g_free(s->room.topic); |
| 8113 | 1265 | s->room.topic = g_strdup(avalues[i]); |
| 1266 | } else if (!strcmp(anames[i], "type")) { | |
| 1267 | if (!strcmp("yahoo", avalues[i])) | |
| 1268 | s->room.type = yrt_yahoo; | |
| 1269 | else | |
| 1270 | s->room.type = yrt_user; | |
| 1271 | } | |
| 1272 | } | |
| 1273 | ||
| 1274 | } else if (!strcmp(ename, "lobby")) { | |
| 1275 | struct yahoo_lobby *lob = g_new0(struct yahoo_lobby, 1); | |
| 1276 | ||
| 1277 | for (i = 0; anames[i]; i++) { | |
| 1278 | if (!strcmp(anames[i], "count")) { | |
| 1279 | lob->count = strtol(avalues[i], NULL, 10); | |
| 1280 | } else if (!strcmp(anames[i], "users")) { | |
| 1281 | s->room.users += lob->users = strtol(avalues[i], NULL, 10); | |
| 1282 | } else if (!strcmp(anames[i], "voices")) { | |
| 1283 | s->room.voices += lob->voices = strtol(avalues[i], NULL, 10); | |
| 1284 | } else if (!strcmp(anames[i], "webcams")) { | |
| 1285 | s->room.webcams += lob->webcams = strtol(avalues[i], NULL, 10); | |
| 1286 | } | |
| 1287 | } | |
| 1288 | g_queue_push_head(s->q, lob); | |
| 1289 | } | |
| 1290 | } | |
| 1291 | ||
| 1292 | static void yahoo_chatlist_end_element(GMarkupParseContext *context, const gchar *ename, | |
| 1293 | gpointer user_data, GError **error) | |
| 1294 | { | |
| 1295 | struct yahoo_chatxml_state *s = user_data; | |
| 1296 | ||
| 1297 | if (!strcmp(ename, "category")) { | |
| 1298 | g_queue_pop_head(s->q); | |
| 1299 | } else if (!strcmp(ename, "room")) { | |
| 1300 | struct yahoo_lobby *lob; | |
| 15884 | 1301 | PurpleRoomlistRoom *r, *l; |
| 8113 | 1302 | |
| 1303 | if (s->room.type == yrt_yahoo) | |
| 15884 | 1304 | r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY|PURPLE_ROOMLIST_ROOMTYPE_ROOM, |
| 8113 | 1305 | s->room.name, s->yrl->cat); |
| 1306 | else | |
| 15884 | 1307 | r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY|PURPLE_ROOMLIST_ROOMTYPE_ROOM, |
| 8113 | 1308 | s->room.name, s->yrl->ucat); |
| 1309 | ||
| 15884 | 1310 | purple_roomlist_room_add_field(s->list, r, s->room.name); |
| 1311 | purple_roomlist_room_add_field(s->list, r, s->room.id); | |
| 1312 | purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.users)); | |
| 1313 | purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.voices)); | |
| 1314 | purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.webcams)); | |
| 1315 | purple_roomlist_room_add_field(s->list, r, s->room.topic); | |
| 1316 | purple_roomlist_room_add(s->list, r); | |
| 8113 | 1317 | |
| 1318 | while ((lob = g_queue_pop_head(s->q))) { | |
| 1319 | char *name = g_strdup_printf("%s:%d", s->room.name, lob->count); | |
| 15884 | 1320 | l = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, r); |
| 8113 | 1321 | |
| 15884 | 1322 | purple_roomlist_room_add_field(s->list, l, name); |
| 1323 | purple_roomlist_room_add_field(s->list, l, s->room.id); | |
| 1324 | purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->users)); | |
| 1325 | purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->voices)); | |
| 1326 | purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->webcams)); | |
| 1327 | purple_roomlist_room_add_field(s->list, l, s->room.topic); | |
| 1328 | purple_roomlist_room_add(s->list, l); | |
| 8113 | 1329 | |
| 1330 | g_free(name); | |
| 1331 | g_free(lob); | |
| 1332 | } | |
| 1333 | } | |
| 1334 | } | |
| 1335 | ||
| 1336 | static GMarkupParser parser = { | |
| 1337 | yahoo_chatlist_start_element, | |
| 1338 | yahoo_chatlist_end_element, | |
| 1339 | NULL, | |
| 1340 | NULL, | |
| 1341 | NULL | |
| 1342 | }; | |
| 1343 | ||
| 15884 | 1344 | static void yahoo_roomlist_cleanup(PurpleRoomlist *list, struct yahoo_roomlist *yrl) |
| 8113 | 1345 | { |
| 15884 | 1346 | purple_roomlist_set_in_progress(list, FALSE); |
| 8113 | 1347 | |
| 1348 | if (yrl) { | |
| 1349 | list->proto_data = g_list_remove(list->proto_data, yrl); | |
| 1350 | yahoo_roomlist_destroy(yrl); | |
| 1351 | } | |
| 1352 | ||
| 15884 | 1353 | purple_roomlist_unref(list); |
| 8113 | 1354 | } |
| 1355 | ||
| 15884 | 1356 | static void yahoo_roomlist_pending(gpointer data, gint source, PurpleInputCondition cond) |
| 8113 | 1357 | { |
| 1358 | struct yahoo_roomlist *yrl = data; | |
| 15884 | 1359 | PurpleRoomlist *list = yrl->list; |
| 8113 | 1360 | char buf[1024]; |
| 1361 | int len; | |
| 1362 | guchar *start; | |
| 1363 | struct yahoo_chatxml_state *s; | |
| 1364 | ||
| 1365 | len = read(yrl->fd, buf, sizeof(buf)); | |
| 1366 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1367 | if (len < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1368 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1369 | |
| 8113 | 1370 | if (len <= 0) { |
| 1371 | if (yrl->parse) | |
| 1372 | g_markup_parse_context_end_parse(yrl->parse, NULL); | |
| 1373 | yahoo_roomlist_cleanup(list, yrl); | |
| 1374 | return; | |
| 1375 | } | |
| 1376 | ||
| 1377 | yrl->rxqueue = g_realloc(yrl->rxqueue, len + yrl->rxlen); | |
| 1378 | memcpy(yrl->rxqueue + yrl->rxlen, buf, len); | |
| 1379 | yrl->rxlen += len; | |
| 1380 | ||
| 1381 | if (!yrl->started) { | |
| 1382 | yrl->started = TRUE; | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11044
diff
changeset
|
1383 | start = (guchar *)g_strstr_len((char *)yrl->rxqueue, yrl->rxlen, "\r\n\r\n"); |
| 8113 | 1384 | if (!start || (start - yrl->rxqueue + 4) >= yrl->rxlen) |
| 1385 | return; | |
| 1386 | start += 4; | |
| 1387 | } else { | |
| 1388 | start = yrl->rxqueue; | |
| 1389 | } | |
| 1390 | ||
| 1391 | if (yrl->parse == NULL) { | |
| 1392 | s = yahoo_chatxml_state_new(list, yrl); | |
| 1393 | yrl->parse = g_markup_parse_context_new(&parser, 0, s, | |
| 1394 | (GDestroyNotify)yahoo_chatxml_state_destroy); | |
| 1395 | } | |
| 1396 | ||
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11044
diff
changeset
|
1397 | if (!g_markup_parse_context_parse(yrl->parse, (char *)start, (yrl->rxlen - (start - yrl->rxqueue)), NULL)) { |
| 8113 | 1398 | |
| 1399 | yahoo_roomlist_cleanup(list, yrl); | |
| 1400 | return; | |
| 1401 | } | |
| 1402 | ||
| 1403 | yrl->rxlen = 0; | |
| 1404 | } | |
| 1405 | ||
| 15884 | 1406 | static void yahoo_roomlist_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
| 8113 | 1407 | { |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1408 | struct yahoo_roomlist *yrl; |
| 15884 | 1409 | PurpleRoomlist *list; |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1410 | int written, remaining; |
| 8113 | 1411 | |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1412 | yrl = data; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1413 | list = yrl->list; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1414 | |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1415 | remaining = strlen(yrl->txbuf) - yrl->tx_written; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1416 | written = write(yrl->fd, yrl->txbuf + yrl->tx_written, remaining); |
| 8113 | 1417 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1418 | if (written < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1419 | written = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1420 | else if (written <= 0) { |
| 15884 | 1421 | purple_input_remove(yrl->inpa); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1422 | yrl->inpa = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1423 | g_free(yrl->txbuf); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1424 | yrl->txbuf = NULL; |
| 15884 | 1425 | purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1426 | yahoo_roomlist_cleanup(list, yrl); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1427 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1428 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1429 | |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1430 | if (written < remaining) { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1431 | yrl->tx_written += written; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1432 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1433 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1434 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1435 | g_free(yrl->txbuf); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13000
diff
changeset
|
1436 | yrl->txbuf = NULL; |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1437 | |
| 15884 | 1438 | purple_input_remove(yrl->inpa); |
| 1439 | yrl->inpa = purple_input_add(yrl->fd, PURPLE_INPUT_READ, | |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1440 | yahoo_roomlist_pending, yrl); |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1441 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1442 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1443 | |
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
1444 | static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar *error_message) |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1445 | { |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1446 | struct yahoo_roomlist *yrl = data; |
| 15884 | 1447 | PurpleRoomlist *list = yrl->list; |
| 1448 | struct yahoo_data *yd = purple_account_get_connection(list->account)->proto_data; | |
| 8113 | 1449 | |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1450 | if (source < 0) { |
| 15884 | 1451 | purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1452 | yahoo_roomlist_cleanup(list, yrl); |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1453 | return; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1454 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1455 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1456 | yrl->fd = source; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1457 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1458 | yrl->txbuf = g_strdup_printf( |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1459 | "GET http://%s/%s HTTP/1.0\r\n" |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1460 | "Host: %s\r\n" |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1461 | "Cookie: Y=%s; T=%s\r\n\r\n", |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1462 | yrl->host, yrl->path, yrl->host, yd->cookie_y, |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1463 | yd->cookie_t); |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1464 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1465 | |
| 15884 | 1466 | yrl->inpa = purple_input_add(yrl->fd, PURPLE_INPUT_WRITE, |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1467 | yahoo_roomlist_send_cb, yrl); |
| 15884 | 1468 | yahoo_roomlist_send_cb(yrl, yrl->fd, PURPLE_INPUT_WRITE); |
| 8113 | 1469 | } |
| 1470 | ||
| 15884 | 1471 | PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc) |
| 8113 | 1472 | { |
|
22220
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1473 | PurpleAccount *account; |
| 15884 | 1474 | PurpleRoomlist *rl; |
|
22220
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1475 | PurpleRoomlistField *f; |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1476 | GList *fields = NULL; |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1477 | struct yahoo_roomlist *yrl; |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1478 | const char *rll, *rlurl; |
| 8113 | 1479 | char *url; |
| 1480 | ||
|
22220
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1481 | account = purple_connection_get_account(gc); |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1482 | |
|
22220
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1483 | /* for Yahoo Japan, it appears there is only one valid URL and locale */ |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1484 | if(purple_account_get_bool(account, "yahoojp", FALSE)) { |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1485 | rll = YAHOOJP_ROOMLIST_LOCALE; |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1486 | rlurl = YAHOOJP_ROOMLIST_URL; |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1487 | } |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1488 | else { /* but for the rest of the world that isn't the case */ |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1489 | rll = purple_account_get_string(account, "room_list_locale", YAHOO_ROOMLIST_LOCALE); |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1490 | rlurl = purple_account_get_string(account, "room_list", YAHOO_ROOMLIST_URL); |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1491 | } |
| 8113 | 1492 | |
|
22220
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1493 | url = g_strdup_printf("%s?chatcat=0&intl=%s", rlurl, rll); |
|
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1494 | |
| 8113 | 1495 | yrl = g_new0(struct yahoo_roomlist, 1); |
|
22220
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1496 | rl = purple_roomlist_new(account); |
| 8113 | 1497 | yrl->list = rl; |
| 1498 | ||
| 15884 | 1499 | purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); |
| 8113 | 1500 | g_free(url); |
| 1501 | ||
| 15884 | 1502 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); |
| 8113 | 1503 | fields = g_list_append(fields, f); |
| 1504 | ||
| 15884 | 1505 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "id", TRUE); |
| 8113 | 1506 | fields = g_list_append(fields, f); |
| 1507 | ||
| 15884 | 1508 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); |
| 8113 | 1509 | fields = g_list_append(fields, f); |
| 1510 | ||
| 15884 | 1511 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Voices"), "voices", FALSE); |
| 8113 | 1512 | fields = g_list_append(fields, f); |
| 1513 | ||
| 15884 | 1514 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Webcams"), "webcams", FALSE); |
| 8113 | 1515 | fields = g_list_append(fields, f); |
| 1516 | ||
| 15884 | 1517 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); |
| 8113 | 1518 | fields = g_list_append(fields, f); |
| 1519 | ||
| 15884 | 1520 | purple_roomlist_set_fields(rl, fields); |
| 8113 | 1521 | |
|
22220
e1ef8feb6199
From what little I could see, it appears that for Yahoo Japan there is only
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1522 | if (purple_proxy_connect(NULL, account, yrl->host, 80, |
|
14170
f611621bc8a0
[gaim-migrate @ 16742]
Mark Doliner <markdoliner@pidgin.im>
parents:
14151
diff
changeset
|
1523 | yahoo_roomlist_got_connected, yrl) == NULL) |
| 8113 | 1524 | { |
| 15884 | 1525 | purple_notify_error(gc, NULL, _("Connection problem"), _("Unable to fetch room list.")); |
| 8113 | 1526 | yahoo_roomlist_cleanup(rl, yrl); |
| 1527 | return NULL; | |
| 1528 | } | |
| 1529 | ||
| 1530 | rl->proto_data = g_list_append(rl->proto_data, yrl); | |
| 1531 | ||
| 15884 | 1532 | purple_roomlist_set_in_progress(rl, TRUE); |
| 8113 | 1533 | return rl; |
| 1534 | } | |
| 1535 | ||
| 15884 | 1536 | void yahoo_roomlist_cancel(PurpleRoomlist *list) |
| 8113 | 1537 | { |
| 1538 | GList *l, *k; | |
| 1539 | ||
| 1540 | k = l = list->proto_data; | |
| 1541 | list->proto_data = NULL; | |
| 1542 | ||
| 15884 | 1543 | purple_roomlist_set_in_progress(list, FALSE); |
| 8113 | 1544 | |
| 1545 | for (; l; l = l->next) { | |
| 1546 | yahoo_roomlist_destroy(l->data); | |
| 15884 | 1547 | purple_roomlist_unref(list); |
| 8113 | 1548 | } |
| 1549 | g_list_free(k); | |
| 1550 | } | |
| 1551 | ||
| 15884 | 1552 | void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) |
| 8113 | 1553 | { |
| 1554 | struct yahoo_roomlist *yrl; | |
| 1555 | char *url; | |
| 1556 | char *id; | |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1557 | const char *rll; |
| 8113 | 1558 | |
| 15884 | 1559 | if (category->type != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) |
| 8113 | 1560 | return; |
| 1561 | ||
| 8584 | 1562 | if (!(id = g_list_nth_data(category->fields, 1))) { |
| 15884 | 1563 | purple_roomlist_set_in_progress(list, FALSE); |
| 8113 | 1564 | return; |
| 1565 | } | |
| 1566 | ||
| 15884 | 1567 | rll = purple_account_get_string(list->account, "room_list_locale", |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1568 | YAHOO_ROOMLIST_LOCALE); |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1569 | |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1570 | if (rll != NULL && *rll != '\0') { |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1571 | url = g_strdup_printf("%s?chatroom_%s=0&intl=%s", |
| 15884 | 1572 | purple_account_get_string(list->account,"room_list", |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1573 | YAHOO_ROOMLIST_URL), id, rll); |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1574 | } else { |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1575 | url = g_strdup_printf("%s?chatroom_%s=0", |
| 15884 | 1576 | purple_account_get_string(list->account,"room_list", |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1577 | YAHOO_ROOMLIST_URL), id); |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1578 | } |
| 8113 | 1579 | |
| 1580 | yrl = g_new0(struct yahoo_roomlist, 1); | |
| 1581 | yrl->list = list; | |
| 8584 | 1582 | yrl->cat = category; |
| 8113 | 1583 | list->proto_data = g_list_append(list->proto_data, yrl); |
| 1584 | ||
| 15884 | 1585 | purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); |
| 8113 | 1586 | g_free(url); |
| 1587 | ||
| 15884 | 1588 | yrl->ucat = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat); |
| 1589 | purple_roomlist_room_add(list, yrl->ucat); | |
| 8113 | 1590 | |
| 15884 | 1591 | if (purple_proxy_connect(NULL, list->account, yrl->host, 80, |
|
14170
f611621bc8a0
[gaim-migrate @ 16742]
Mark Doliner <markdoliner@pidgin.im>
parents:
14151
diff
changeset
|
1592 | yahoo_roomlist_got_connected, yrl) == NULL) |
| 8113 | 1593 | { |
| 15884 | 1594 | purple_notify_error(purple_account_get_connection(list->account), |
| 8113 | 1595 | NULL, _("Connection problem"), _("Unable to fetch room list.")); |
| 15884 | 1596 | purple_roomlist_ref(list); |
| 8113 | 1597 | yahoo_roomlist_cleanup(list, yrl); |
| 1598 | return; | |
| 1599 | } | |
| 1600 | ||
| 15884 | 1601 | purple_roomlist_set_in_progress(list, TRUE); |
| 1602 | purple_roomlist_ref(list); | |
| 8113 | 1603 | } |