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