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