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