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