Mon, 23 Jan 2006 01:27:40 +0000
[gaim-migrate @ 15351]
Bleeter updated yahoo chatroom joining to show better errors
| 6729 | 1 | /* |
| 2 | * gaim | |
| 3 | * | |
| 8046 | 4 | * Gaim is the legal property of its developers, whose names are too numerous |
| 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 | |
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 26 | * | |
| 27 | */ | |
| 28 | ||
| 29 | #ifdef HAVE_CONFIG_H | |
| 30 | #include "config.h" | |
| 31 | #endif | |
| 32 | ||
| 33 | #include "debug.h" | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
34 | #include "privacy.h" |
| 6729 | 35 | #include "prpl.h" |
| 36 | ||
| 37 | #include "conversation.h" | |
| 38 | #include "notify.h" | |
| 39 | #include "util.h" | |
| 40 | #include "internal.h" | |
| 41 | ||
| 42 | #include "yahoo.h" | |
| 10392 | 43 | #include "yahoo_packet.h" |
| 6729 | 44 | #include "yahoochat.h" |
| 9376 | 45 | #include "ycht.h" |
| 6729 | 46 | |
| 47 | #define YAHOO_CHAT_ID (1) | |
| 48 | ||
| 7186 | 49 | /* prototype(s) */ |
| 50 | static void yahoo_chat_leave(GaimConnection *gc, const char *room, const char *dn, gboolean logout); | |
| 51 | ||
| 6729 | 52 | /* special function to log us on to the yahoo chat service */ |
| 53 | static void yahoo_chat_online(GaimConnection *gc) | |
| 54 | { | |
| 55 | struct yahoo_data *yd = gc->proto_data; | |
| 56 | struct yahoo_packet *pkt; | |
| 57 | ||
| 9376 | 58 | if (yd->wm) { |
| 59 | ycht_connection_open(gc); | |
| 60 | return; | |
| 61 | } | |
| 6729 | 62 | |
| 63 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATONLINE, YAHOO_STATUS_AVAILABLE,0); | |
| 10394 | 64 | yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), |
| 65 | 109, gaim_connection_get_display_name(gc), 6, "abcde"); | |
| 10392 | 66 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 67 | } |
| 68 | ||
| 69 | /* this is slow, and different from the gaim_* version in that it (hopefully) won't add a user twice */ | |
| 9376 | 70 | void yahoo_chat_add_users(GaimConvChat *chat, GList *newusers) |
| 6729 | 71 | { |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
72 | GList *i; |
| 6729 | 73 | |
| 74 | for (i = newusers; i; i = i->next) { | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
75 | if (gaim_conv_chat_find_user(chat, i->data)) |
| 6729 | 76 | continue; |
|
9846
61f7349c153a
[gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9782
diff
changeset
|
77 | gaim_conv_chat_add_user(chat, i->data, NULL, GAIM_CBFLAGS_NONE, TRUE); |
| 6729 | 78 | } |
| 79 | } | |
| 80 | ||
| 9376 | 81 | void yahoo_chat_add_user(GaimConvChat *chat, const char *user, const char *reason) |
| 6729 | 82 | { |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
83 | if (gaim_conv_chat_find_user(chat, user)) |
| 6729 | 84 | return; |
| 85 | ||
|
9846
61f7349c153a
[gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9782
diff
changeset
|
86 | gaim_conv_chat_add_user(chat, user, reason, GAIM_CBFLAGS_NONE, TRUE); |
| 6729 | 87 | } |
| 88 | ||
| 89 | static GaimConversation *yahoo_find_conference(GaimConnection *gc, const char *name) | |
| 90 | { | |
| 91 | struct yahoo_data *yd; | |
| 92 | GSList *l; | |
| 93 | ||
| 94 | yd = gc->proto_data; | |
| 95 | ||
| 96 | for (l = yd->confs; l; l = l->next) { | |
| 97 | GaimConversation *c = l->data; | |
| 98 | if (!gaim_utf8_strcasecmp(gaim_conversation_get_name(c), name)) | |
| 99 | return c; | |
| 100 | } | |
| 101 | return NULL; | |
| 102 | } | |
| 103 | ||
| 104 | ||
| 105 | void yahoo_process_conference_invite(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 106 | { | |
| 107 | GSList *l; | |
| 108 | char *room = NULL; | |
| 109 | char *who = NULL; | |
| 110 | char *msg = NULL; | |
| 111 | GString *members = NULL; | |
| 112 | GHashTable *components; | |
| 113 | ||
| 114 | if (pkt->status == 2) | |
| 115 | return; /* XXX */ | |
| 116 | ||
| 117 | members = g_string_sized_new(512); | |
| 118 | ||
| 119 | for (l = pkt->hash; l; l = l->next) { | |
| 120 | struct yahoo_pair *pair = l->data; | |
| 121 | ||
| 122 | switch (pair->key) { | |
| 123 | case 1: /* us, but we already know who we are */ | |
| 124 | break; | |
| 125 | case 57: | |
| 7827 | 126 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 127 | break; |
| 128 | case 50: /* inviter */ | |
| 129 | who = pair->value; | |
| 130 | g_string_append_printf(members, "%s\n", who); | |
| 131 | break; | |
|
9780
99680462fa73
[gaim-migrate @ 10648]
Peter Lawler <pidgin@bleeter.id.au>
parents:
9768
diff
changeset
|
132 | case 52: /* invitee (me) */ |
|
99680462fa73
[gaim-migrate @ 10648]
Peter Lawler <pidgin@bleeter.id.au>
parents:
9768
diff
changeset
|
133 | case 53: /* members */ |
| 6729 | 134 | g_string_append_printf(members, "%s\n", pair->value); |
| 135 | break; | |
| 136 | case 58: | |
| 7827 | 137 | msg = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 138 | break; |
| 139 | case 13: /* ? */ | |
| 140 | break; | |
| 141 | } | |
| 142 | } | |
| 143 | ||
| 144 | if (!room) { | |
| 145 | g_string_free(members, TRUE); | |
| 146 | return; | |
| 147 | } | |
| 148 | ||
| 149 | components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 7827 | 150 | g_hash_table_replace(components, g_strdup("room"), room); |
| 6729 | 151 | if (msg) |
| 7827 | 152 | g_hash_table_replace(components, g_strdup("topic"), msg); |
| 6729 | 153 | g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); |
| 154 | if (members) { | |
| 155 | g_hash_table_replace(components, g_strdup("members"), g_strdup(members->str)); | |
| 156 | } | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
157 | if (!yahoo_privacy_check(gc, who)) { |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
158 | gaim_debug_info("yahoo", |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
159 | "Invite to conference %s from %s has been dropped.\n", room, who); |
|
11044
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
160 | g_string_free(members, TRUE); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
161 | return; |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
162 | } |
| 6729 | 163 | serv_got_chat_invite(gc, room, who, msg, components); |
| 164 | ||
| 165 | g_string_free(members, TRUE); | |
| 166 | } | |
| 167 | ||
| 168 | void yahoo_process_conference_decline(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 169 | { | |
| 170 | GSList *l; | |
| 171 | char *room = NULL; | |
| 172 | char *who = NULL; | |
| 173 | char *msg = NULL; | |
| 174 | ||
| 175 | for (l = pkt->hash; l; l = l->next) { | |
| 176 | struct yahoo_pair *pair = l->data; | |
| 177 | ||
| 178 | switch (pair->key) { | |
| 179 | case 57: | |
| 7827 | 180 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 181 | break; |
| 182 | case 54: | |
| 183 | who = pair->value; | |
| 184 | break; | |
| 185 | case 14: | |
| 7827 | 186 | msg = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 187 | break; |
| 188 | } | |
| 189 | } | |
|
11044
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
190 | if (!yahoo_privacy_check(gc, who)) { |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
191 | g_free(room); |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
192 | if (msg != NULL) |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
193 | g_free(msg); |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
194 | return; |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
195 | } |
| 6729 | 196 | |
| 197 | if (who && room) { | |
| 9575 | 198 | /* make sure we're in the room before we process a decline message for it */ |
| 9576 | 199 | if(yahoo_find_conference(gc, room)) { |
| 9575 | 200 | char *tmp; |
| 6729 | 201 | |
| 9575 | 202 | tmp = g_strdup_printf(_("%s declined your conference invitation to room \"%s\" because \"%s\"."), |
| 203 | who, room, msg?msg:""); | |
| 204 | gaim_notify_info(gc, NULL, _("Invitation Rejected"), tmp); | |
| 205 | g_free(tmp); | |
| 206 | } | |
| 207 | ||
| 7827 | 208 | g_free(room); |
| 209 | if (msg) | |
| 210 | g_free(msg); | |
| 6729 | 211 | } |
| 212 | } | |
| 213 | ||
| 214 | void yahoo_process_conference_logon(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 215 | { | |
| 216 | GSList *l; | |
| 217 | char *room = NULL; | |
| 218 | char *who = NULL; | |
| 219 | GaimConversation *c; | |
| 220 | ||
| 221 | for (l = pkt->hash; l; l = l->next) { | |
| 222 | struct yahoo_pair *pair = l->data; | |
| 223 | ||
| 224 | switch (pair->key) { | |
| 225 | case 57: | |
| 7827 | 226 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 227 | break; |
| 228 | case 53: | |
| 229 | who = pair->value; | |
| 230 | break; | |
| 231 | } | |
| 232 | } | |
| 233 | ||
| 234 | if (who && room) { | |
| 235 | c = yahoo_find_conference(gc, room); | |
| 236 | if (c) | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
237 | yahoo_chat_add_user(GAIM_CONV_CHAT(c), who, NULL); |
| 7827 | 238 | g_free(room); |
| 6729 | 239 | } |
| 240 | } | |
| 241 | ||
| 242 | void yahoo_process_conference_logoff(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 243 | { | |
| 244 | GSList *l; | |
| 245 | char *room = NULL; | |
| 246 | char *who = NULL; | |
| 247 | GaimConversation *c; | |
| 248 | ||
| 249 | for (l = pkt->hash; l; l = l->next) { | |
| 250 | struct yahoo_pair *pair = l->data; | |
| 251 | ||
| 252 | switch (pair->key) { | |
| 253 | case 57: | |
| 7827 | 254 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 255 | break; |
| 256 | case 56: | |
| 257 | who = pair->value; | |
| 258 | break; | |
| 259 | } | |
| 260 | } | |
| 261 | ||
| 262 | if (who && room) { | |
| 263 | c = yahoo_find_conference(gc, room); | |
| 264 | if (c) | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
265 | gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), who, NULL); |
| 7827 | 266 | g_free(room); |
| 6729 | 267 | } |
| 268 | } | |
| 269 | ||
| 270 | void yahoo_process_conference_message(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 271 | { | |
| 272 | GSList *l; | |
| 273 | char *room = NULL; | |
| 274 | char *who = NULL; | |
| 275 | char *msg = NULL; | |
| 7827 | 276 | char *msg2; |
| 277 | int utf8 = 0; | |
| 6729 | 278 | GaimConversation *c; |
| 279 | ||
| 280 | for (l = pkt->hash; l; l = l->next) { | |
| 281 | struct yahoo_pair *pair = l->data; | |
| 282 | ||
| 283 | switch (pair->key) { | |
| 284 | case 57: | |
| 7827 | 285 | room = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 286 | break; |
| 287 | case 3: | |
| 288 | who = pair->value; | |
| 289 | break; | |
| 290 | case 14: | |
| 291 | msg = pair->value; | |
| 292 | break; | |
| 7827 | 293 | case 97: |
| 294 | utf8 = strtol(pair->value, NULL, 10); | |
| 295 | break; | |
| 6729 | 296 | } |
| 297 | } | |
| 298 | ||
| 299 | if (room && who && msg) { | |
| 7827 | 300 | msg2 = yahoo_string_decode(gc, msg, utf8); |
| 6729 | 301 | c = yahoo_find_conference(gc, room); |
| 302 | if (!c) | |
| 303 | return; | |
| 7827 | 304 | msg = yahoo_codes_to_html(msg2); |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
305 | serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), who, 0, msg, time(NULL)); |
| 6729 | 306 | g_free(msg); |
| 7827 | 307 | g_free(msg2); |
| 6729 | 308 | } |
| 7827 | 309 | if (room) |
| 310 | g_free(room); | |
| 6729 | 311 | } |
| 312 | ||
| 313 | ||
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8584
diff
changeset
|
314 | /* this is a confirmation of yahoo_chat_online(); */ |
| 6729 | 315 | void yahoo_process_chat_online(GaimConnection *gc, struct yahoo_packet *pkt) |
| 316 | { | |
| 317 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; | |
| 318 | ||
| 319 | if (pkt->status == 1) | |
| 320 | yd->chat_online = 1; | |
| 321 | } | |
| 322 | ||
| 323 | /* this is basicly the opposite of chat_online */ | |
| 324 | void yahoo_process_chat_logout(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 325 | { | |
| 326 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; | |
| 7186 | 327 | GSList *l; |
| 7827 | 328 | |
| 7186 | 329 | for (l = pkt->hash; l; l = l->next) { |
| 330 | struct yahoo_pair *pair = l->data; | |
| 6729 | 331 | |
| 7186 | 332 | if (pair->key == 1) |
| 333 | if (g_ascii_strcasecmp(pair->value, | |
| 334 | gaim_connection_get_display_name(gc))) | |
| 335 | return; | |
| 336 | } | |
| 7827 | 337 | |
| 7186 | 338 | if (pkt->status == 1) { |
| 6729 | 339 | yd->chat_online = 0; |
| 7186 | 340 | if (yd->in_chat) |
| 341 | yahoo_c_leave(gc, YAHOO_CHAT_ID); | |
| 342 | } | |
| 6729 | 343 | } |
| 344 | ||
| 345 | void yahoo_process_chat_join(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 346 | { | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
347 | GaimAccount *account = gaim_connection_get_account(gc); |
| 6729 | 348 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; |
| 349 | GaimConversation *c = NULL; | |
| 350 | GSList *l; | |
| 351 | GList *members = NULL; | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
352 | GList *roomies = NULL; |
| 6729 | 353 | char *room = NULL; |
| 354 | char *topic = NULL; | |
| 355 | char *someid, *someotherid, *somebase64orhashosomething, *somenegativenumber; | |
| 356 | ||
| 357 | if (pkt->status == -1) { | |
|
12998
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
358 | /* We can't join */ |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
359 | struct yahoo_pair *pair = pkt->hash->data; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
360 | gchar const *failed_to_join = _("Failed to join chat"); |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
361 | switch (atoi(pair->value)) { |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
362 | case 0xFFFFFFFA: /* -6 */ |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
363 | gaim_notify_error(gc, NULL, failed_to_join, _("Unknown room")); |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
364 | break; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
365 | case 0xFFFFFFF1: /* -15 */ |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
366 | gaim_notify_error(gc, NULL, failed_to_join, _("Maybe the room is full")); |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
367 | break; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
368 | case 0xFFFFFFDD: /* -35 */ |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
369 | gaim_notify_error(gc, NULL, failed_to_join, _("Not available")); |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
370 | break; |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
371 | default: |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
372 | gaim_notify_error(gc, NULL, failed_to_join, |
|
3b9228370784
[gaim-migrate @ 15351]
Daniel Atallah <datallah@pidgin.im>
parents:
12865
diff
changeset
|
373 | _("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
|
374 | } |
| 6729 | 375 | return; |
| 376 | } | |
| 377 | ||
| 378 | for (l = pkt->hash; l; l = l->next) { | |
| 379 | struct yahoo_pair *pair = l->data; | |
| 380 | ||
| 381 | switch (pair->key) { | |
| 382 | ||
| 383 | case 104: | |
| 8410 | 384 | room = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 385 | break; |
| 386 | case 105: | |
| 8410 | 387 | topic = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 388 | break; |
| 389 | case 128: | |
| 390 | someid = pair->value; | |
| 391 | break; | |
| 392 | case 108: /* number of joiners */ | |
| 393 | break; | |
| 394 | case 129: | |
| 395 | someotherid = pair->value; | |
| 396 | break; | |
| 397 | case 130: | |
| 398 | somebase64orhashosomething = pair->value; | |
| 399 | break; | |
| 400 | case 126: | |
| 401 | somenegativenumber = pair->value; | |
| 402 | break; | |
| 403 | case 13: /* this is 1. maybe its the type of room? (normal, user created, private, etc?) */ | |
| 404 | break; | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8584
diff
changeset
|
405 | case 61: /*this looks similar to 130 */ |
| 6729 | 406 | break; |
| 407 | ||
| 408 | /* the previous section was just room info. this next section is | |
| 409 | info about individual room members, (including us) */ | |
| 410 | ||
| 411 | case 109: /* the yahoo id */ | |
| 412 | members = g_list_append(members, pair->value); | |
| 413 | break; | |
| 414 | case 110: /* age */ | |
| 415 | break; | |
| 416 | case 141: /* nickname */ | |
| 417 | break; | |
| 418 | case 142: /* location */ | |
| 419 | break; | |
| 420 | case 113: /* bitmask */ | |
| 421 | break; | |
| 422 | } | |
| 423 | } | |
| 424 | ||
| 9329 | 425 | if (room && yd->chat_name && gaim_utf8_strcasecmp(room, yd->chat_name)) |
| 7186 | 426 | yahoo_chat_leave(gc, room, |
| 427 | gaim_connection_get_display_name(gc), FALSE); | |
| 6729 | 428 | |
| 429 | c = gaim_find_chat(gc, YAHOO_CHAT_ID); | |
| 430 | ||
| 9329 | 431 | if (room && (!c || gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) && members && |
| 8357 | 432 | ((g_list_length(members) > 1) || |
| 433 | !g_ascii_strcasecmp(members->data, gaim_connection_get_display_name(gc)))) { | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
434 | int i; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
435 | GList *flags = NULL; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
436 | for (i = 0; i < g_list_length(members); i++) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
437 | flags = g_list_append(flags, GINT_TO_POINTER(GAIM_CBFLAGS_NONE)); |
| 8357 | 438 | if (c && gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) { |
| 439 | /* this might be a hack, but oh well, it should nicely */ | |
| 440 | char *tmpmsg; | |
| 441 | ||
| 442 | gaim_conversation_set_name(c, room); | |
| 443 | ||
| 444 | c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); | |
| 445 | if (topic) | |
| 446 | gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic); | |
| 447 | yd->in_chat = 1; | |
| 448 | yd->chat_name = g_strdup(room); | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11318
diff
changeset
|
449 | gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, NULL, flags, FALSE); |
| 8357 | 450 | |
| 451 | tmpmsg = g_strdup_printf(_("You are now chatting in %s."), room); | |
| 452 | gaim_conv_chat_write(GAIM_CONV_CHAT(c), "", tmpmsg, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
| 453 | g_free(tmpmsg); | |
| 454 | } else { | |
| 455 | c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); | |
| 456 | if (topic) | |
| 457 | gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic); | |
| 458 | yd->in_chat = 1; | |
| 459 | yd->chat_name = g_strdup(room); | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11318
diff
changeset
|
460 | gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, NULL, flags, FALSE); |
| 8357 | 461 | } |
| 7186 | 462 | } else if (c) { |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
463 | yahoo_chat_add_users(GAIM_CONV_CHAT(c), members); |
| 6729 | 464 | } |
| 465 | ||
|
11527
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
466 | if (account->deny && c) { |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
467 | GaimConversationUiOps *ops = gaim_conversation_get_ui_ops(c); |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
468 | for (l = account->deny; l != NULL; l = l->next) { |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
469 | for (roomies = members; roomies; roomies = roomies->next) { |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
470 | if (!gaim_utf8_strcasecmp((char *)l->data, roomies->data)) { |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
471 | gaim_debug_info("yahoo", "Ignoring room member %s in room %s\n" , roomies->data, room ? room : ""); |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
472 | gaim_conv_chat_ignore(GAIM_CONV_CHAT(c),roomies->data); |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
473 | ops->chat_update_user(c, roomies->data); |
|
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
474 | } |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
475 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
476 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
477 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
478 | g_list_free(roomies); |
| 6729 | 479 | g_list_free(members); |
| 7827 | 480 | g_free(room); |
|
11527
fc90bdeff1ca
[gaim-migrate @ 13776]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11454
diff
changeset
|
481 | g_free(topic); |
| 6729 | 482 | } |
| 483 | ||
| 484 | void yahoo_process_chat_exit(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 485 | { | |
| 486 | char *who = NULL; | |
| 7186 | 487 | char *room = NULL; |
| 6729 | 488 | GSList *l; |
| 489 | struct yahoo_data *yd; | |
| 490 | ||
| 491 | yd = gc->proto_data; | |
| 492 | ||
| 493 | for (l = pkt->hash; l; l = l->next) { | |
| 494 | struct yahoo_pair *pair = l->data; | |
| 495 | ||
| 7186 | 496 | if (pair->key == 104) |
| 8410 | 497 | room = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 498 | if (pair->key == 109) |
| 499 | who = pair->value; | |
| 500 | } | |
| 501 | ||
| 7186 | 502 | if (who && room) { |
| 6729 | 503 | GaimConversation *c = gaim_find_chat(gc, YAHOO_CHAT_ID); |
| 7186 | 504 | if (c && !gaim_utf8_strcasecmp(gaim_conversation_get_name(c), room)) |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
505 | gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), who, NULL); |
| 6729 | 506 | |
| 507 | } | |
| 7827 | 508 | if (room) |
| 509 | g_free(room); | |
| 6729 | 510 | } |
| 511 | ||
| 512 | void yahoo_process_chat_message(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 513 | { | |
| 7827 | 514 | char *room = NULL, *who = NULL, *msg = NULL, *msg2; |
| 8410 | 515 | int msgtype = 1, utf8 = 1; /* default to utf8 */ |
| 6729 | 516 | GaimConversation *c = NULL; |
| 517 | GSList *l; | |
| 518 | ||
| 519 | for (l = pkt->hash; l; l = l->next) { | |
| 520 | struct yahoo_pair *pair = l->data; | |
| 521 | ||
| 522 | switch (pair->key) { | |
| 523 | ||
| 7827 | 524 | case 97: |
| 525 | utf8 = strtol(pair->value, NULL, 10); | |
| 526 | break; | |
| 6729 | 527 | case 104: |
| 8410 | 528 | room = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 529 | break; |
| 530 | case 109: | |
| 531 | who = pair->value; | |
| 532 | break; | |
| 533 | case 117: | |
| 534 | msg = pair->value; | |
| 535 | break; | |
| 536 | case 124: | |
| 537 | msgtype = strtol(pair->value, NULL, 10); | |
| 538 | break; | |
| 539 | } | |
| 540 | } | |
| 541 | ||
| 542 | c = gaim_find_chat(gc, YAHOO_CHAT_ID); | |
| 7827 | 543 | if (!who || !c) { |
| 544 | if (room) | |
| 545 | g_free(room); | |
| 6729 | 546 | /* we still get messages after we part, funny that */ |
| 547 | return; | |
| 548 | } | |
| 549 | ||
| 550 | if (!msg) { | |
| 551 | gaim_debug(GAIM_DEBUG_MISC, "yahoo", "Got a message packet with no message.\nThis probably means something important, but we're ignoring it.\n"); | |
| 552 | return; | |
| 553 | } | |
| 7827 | 554 | msg2 = yahoo_string_decode(gc, msg, utf8); |
| 555 | msg = yahoo_codes_to_html(msg2); | |
| 556 | g_free(msg2); | |
| 6729 | 557 | |
| 558 | if (msgtype == 2 || msgtype == 3) { | |
| 559 | char *tmp; | |
| 560 | tmp = g_strdup_printf("/me %s", msg); | |
| 561 | g_free(msg); | |
| 562 | msg = tmp; | |
| 563 | } | |
| 564 | ||
| 565 | serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, msg, time(NULL)); | |
| 566 | g_free(msg); | |
| 11593 | 567 | g_free(room); |
| 6729 | 568 | } |
| 569 | ||
| 570 | void yahoo_process_chat_addinvite(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 571 | { | |
| 572 | GSList *l; | |
| 573 | char *room = NULL; | |
| 574 | char *msg = NULL; | |
| 575 | char *who = NULL; | |
| 576 | ||
| 577 | for (l = pkt->hash; l; l = l->next) { | |
| 578 | struct yahoo_pair *pair = l->data; | |
| 579 | ||
| 580 | switch (pair->key) { | |
| 581 | case 104: | |
| 8410 | 582 | room = yahoo_string_decode(gc, pair->value, TRUE); |
| 6729 | 583 | break; |
| 584 | case 129: /* room id? */ | |
| 585 | break; | |
| 586 | case 126: /* ??? */ | |
| 587 | break; | |
| 588 | case 117: | |
| 7827 | 589 | msg = yahoo_string_decode(gc, pair->value, FALSE); |
| 6729 | 590 | break; |
| 591 | case 119: | |
| 592 | who = pair->value; | |
| 593 | break; | |
| 594 | case 118: /* us */ | |
| 595 | break; | |
| 596 | } | |
| 597 | } | |
| 598 | ||
| 599 | if (room && who) { | |
| 600 | GHashTable *components; | |
| 601 | ||
| 602 | components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 603 | g_hash_table_replace(components, g_strdup("room"), g_strdup(room)); | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
604 | if (!yahoo_privacy_check(gc, who)) { |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
605 | gaim_debug_info("yahoo", |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
606 | "Invite to room %s from %s has been dropped.\n", room, who); |
|
11044
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
607 | if (room != NULL) |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
608 | g_free(room); |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
609 | if (msg != NULL) |
|
d6f32a4f0947
[gaim-migrate @ 12958]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11043
diff
changeset
|
610 | g_free(msg); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
611 | return; |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10647
diff
changeset
|
612 | } |
| 6729 | 613 | serv_got_chat_invite(gc, room, who, msg, components); |
| 614 | } | |
| 7827 | 615 | if (room) |
| 616 | g_free(room); | |
| 617 | if (msg) | |
| 618 | g_free(msg); | |
| 6729 | 619 | } |
| 620 | ||
| 621 | void yahoo_process_chat_goto(GaimConnection *gc, struct yahoo_packet *pkt) | |
| 622 | { | |
| 623 | if (pkt->status == -1) | |
| 624 | gaim_notify_error(gc, NULL, _("Failed to join buddy in chat"), | |
| 625 | _("Maybe they're not in a chat?")); | |
| 626 | } | |
| 627 | ||
| 628 | /* | |
| 629 | * Functions dealing with conferences | |
| 7827 | 630 | * I think conference names are always ascii. |
| 6729 | 631 | */ |
| 632 | ||
| 9782 | 633 | void yahoo_conf_leave(struct yahoo_data *yd, const char *room, const char *dn, GList *who) |
| 6729 | 634 | { |
| 635 | struct yahoo_packet *pkt; | |
| 636 | GList *w; | |
| 637 | ||
| 9782 | 638 | gaim_debug_misc("yahoo", "leaving conference %s\n", room); |
| 639 | ||
| 6729 | 640 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGOFF, YAHOO_STATUS_AVAILABLE, 0); |
| 641 | ||
| 10394 | 642 | yahoo_packet_hash_str(pkt, 1, dn); |
| 6729 | 643 | for (w = who; w; w = w->next) { |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
644 | const char *name = gaim_conv_chat_cb_get_name(w->data); |
| 10394 | 645 | yahoo_packet_hash_str(pkt, 3, name); |
| 6729 | 646 | } |
| 647 | ||
| 10394 | 648 | yahoo_packet_hash_str(pkt, 57, room); |
| 10392 | 649 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 650 | } |
| 651 | ||
| 7827 | 652 | static int yahoo_conf_send(GaimConnection *gc, const char *dn, const char *room, |
| 6729 | 653 | GList *members, const char *what) |
| 654 | { | |
| 7827 | 655 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 656 | struct yahoo_packet *pkt; |
| 657 | GList *who; | |
| 7827 | 658 | char *msg, *msg2; |
| 659 | int utf8 = 1; | |
| 6804 | 660 | |
| 661 | msg = yahoo_html_to_codes(what); | |
| 7827 | 662 | msg2 = yahoo_string_encode(gc, msg, &utf8); |
| 663 | ||
| 6729 | 664 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFMSG, YAHOO_STATUS_AVAILABLE, 0); |
| 665 | ||
| 10394 | 666 | yahoo_packet_hash_str(pkt, 1, dn); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
667 | for (who = members; who; who = who->next) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
668 | const char *name = gaim_conv_chat_cb_get_name(who->data); |
| 10394 | 669 | yahoo_packet_hash_str(pkt, 53, name); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
670 | } |
| 10394 | 671 | yahoo_packet_hash(pkt, "ss", 57, room, 14, msg2); |
| 7827 | 672 | if (utf8) |
| 10394 | 673 | yahoo_packet_hash_str(pkt, 97, "1"); /* utf-8 */ |
| 6729 | 674 | |
| 10392 | 675 | yahoo_packet_send_and_free(pkt, yd); |
| 6804 | 676 | g_free(msg); |
| 7827 | 677 | g_free(msg2); |
| 6729 | 678 | |
| 679 | return 0; | |
| 680 | } | |
| 681 | ||
| 682 | static void yahoo_conf_join(struct yahoo_data *yd, GaimConversation *c, const char *dn, const char *room, | |
| 683 | const char *topic, const char *members) | |
| 684 | { | |
| 685 | struct yahoo_packet *pkt; | |
| 686 | char **memarr = NULL; | |
| 687 | int i; | |
| 688 | ||
| 689 | if (members) | |
| 690 | memarr = g_strsplit(members, "\n", 0); | |
| 691 | ||
| 692 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGON, YAHOO_STATUS_AVAILABLE, 0); | |
| 693 | ||
| 10394 | 694 | yahoo_packet_hash(pkt, "sss", 1, dn, 3, dn, 57, room); |
| 6729 | 695 | if (memarr) { |
| 696 | for(i = 0 ; memarr[i]; i++) { | |
| 697 | if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn)) | |
| 698 | continue; | |
| 10394 | 699 | yahoo_packet_hash_str(pkt, 3, memarr[i]); |
|
9846
61f7349c153a
[gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9782
diff
changeset
|
700 | gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), memarr[i], NULL, GAIM_CBFLAGS_NONE, TRUE); |
| 6729 | 701 | } |
| 702 | } | |
| 10392 | 703 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 704 | |
| 705 | if (memarr) | |
| 706 | g_strfreev(memarr); | |
| 707 | } | |
| 708 | ||
| 7827 | 709 | static void yahoo_conf_invite(GaimConnection *gc, GaimConversation *c, |
| 6729 | 710 | const char *dn, const char *buddy, const char *room, const char *msg) |
| 711 | { | |
| 7827 | 712 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 713 | struct yahoo_packet *pkt; |
| 714 | GList *members; | |
| 7827 | 715 | char *msg2 = NULL; |
| 716 | ||
| 717 | if (msg) | |
| 718 | msg2 = yahoo_string_encode(gc, msg, NULL); | |
| 6729 | 719 | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
720 | members = gaim_conv_chat_get_users(GAIM_CONV_CHAT(c)); |
| 6729 | 721 | |
| 722 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, 0); | |
| 723 | ||
| 10394 | 724 | yahoo_packet_hash(pkt, "sssss", 1, dn, 51, buddy, 57, room, 58, msg?msg2:"", 13, "0"); |
| 6729 | 725 | for(; members; members = members->next) { |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
726 | const char *name = gaim_conv_chat_cb_get_name(members->data); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9376
diff
changeset
|
727 | if (!strcmp(name, dn)) |
| 6729 | 728 | continue; |
| 10394 | 729 | yahoo_packet_hash(pkt, "ss", 52, name, 53, name); |
| 6729 | 730 | } |
| 10392 | 731 | |
| 732 | yahoo_packet_send_and_free(pkt, yd); | |
| 733 | g_free(msg2); | |
| 6729 | 734 | } |
| 735 | ||
| 736 | /* | |
| 737 | * Functions dealing with chats | |
| 738 | */ | |
| 739 | ||
| 7186 | 740 | static void yahoo_chat_leave(GaimConnection *gc, const char *room, const char *dn, gboolean logout) |
| 6729 | 741 | { |
| 7186 | 742 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 743 | struct yahoo_packet *pkt; |
| 7186 | 744 | GaimConversation *c; |
|
12865
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
745 | |
|
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
746 | #if 0 |
|
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
747 | /* Bleeter, 12th Jan 2006: |
|
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
748 | * After comparing to native YIM6, it would appear all we need to do is send the |
|
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
749 | * YAHOO_SERVICE_CHATLOGOUT, because the YAHOO_SERVICE_CHATEXIT is the response |
|
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
750 | * from the server. Leaving this in causes double room-left messages to be generated. |
|
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
751 | */ |
| 7827 | 752 | char *eroom; |
| 8410 | 753 | gboolean utf8 = 1; |
|
12865
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
754 | #endif |
| 7827 | 755 | |
| 9376 | 756 | if (yd->wm) { |
| 757 | g_return_if_fail(yd->ycht != NULL); | |
| 758 | ||
| 759 | ycht_chat_leave(yd->ycht, room, logout); | |
| 760 | return; | |
| 761 | } | |
| 762 | ||
|
12865
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
763 | #if 0 |
| 8410 | 764 | eroom = yahoo_string_encode(gc, room, &utf8); |
| 6729 | 765 | |
| 766 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 767 | yahoo_packet_hash(pkt, "sss", 104, eroom, 109, dn, 108, "1"); |
| 768 | yahoo_packet_hash_str(pkt, 112, "0"); /* what does this one mean? */ | |
| 10392 | 769 | yahoo_packet_send_and_free(pkt, yd); |
|
12865
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
770 | #endif |
| 6729 | 771 | |
| 772 | yd->in_chat = 0; | |
| 773 | if (yd->chat_name) { | |
| 774 | g_free(yd->chat_name); | |
| 775 | yd->chat_name = NULL; | |
| 776 | } | |
| 777 | ||
| 7186 | 778 | if ((c = gaim_find_chat(gc, YAHOO_CHAT_ID))) |
| 779 | serv_got_chat_left(gc, YAHOO_CHAT_ID); | |
| 780 | ||
| 781 | if (!logout) | |
| 782 | return; | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
783 | |
| 7186 | 784 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATLOGOUT, |
| 785 | YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 786 | yahoo_packet_hash_str(pkt, 1, dn); |
| 10392 | 787 | yahoo_packet_send_and_free(pkt, yd); |
| 7186 | 788 | |
| 789 | yd->chat_online = 0; | |
|
12865
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
790 | #if 0 |
| 7827 | 791 | g_free(eroom); |
|
12865
b93a45c96ff9
[gaim-migrate @ 15216]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12216
diff
changeset
|
792 | #endif |
| 6729 | 793 | } |
| 794 | ||
| 6804 | 795 | /* borrowed from gtkconv.c */ |
| 796 | static gboolean | |
| 797 | meify(char *message, size_t len) | |
| 798 | { | |
| 799 | /* | |
| 800 | * Read /me-ify: If the message (post-HTML) starts with /me, | |
| 801 | * remove the "/me " part of it (including that space) and return TRUE. | |
| 802 | */ | |
| 803 | char *c; | |
| 804 | gboolean inside_html = 0; | |
| 805 | ||
| 806 | /* Umm.. this would be very bad if this happens. */ | |
| 807 | g_return_val_if_fail(message != NULL, FALSE); | |
| 808 | ||
| 809 | if (len == -1) | |
| 810 | len = strlen(message); | |
| 811 | ||
| 812 | for (c = message; *c != '\0'; c++, len--) { | |
| 813 | if (inside_html) { | |
| 814 | if (*c == '>') | |
| 815 | inside_html = FALSE; | |
| 816 | } | |
| 817 | else { | |
| 818 | if (*c == '<') | |
| 819 | inside_html = TRUE; | |
| 820 | else | |
| 821 | break; | |
| 822 | } | |
| 823 | } | |
| 824 | ||
| 825 | if (*c != '\0' && !g_ascii_strncasecmp(c, "/me ", 4)) { | |
| 826 | memmove(c, c + 4, len - 3); | |
| 827 | return TRUE; | |
| 828 | } | |
| 829 | ||
| 830 | return FALSE; | |
| 831 | } | |
| 832 | ||
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12212
diff
changeset
|
833 | static int yahoo_chat_send(GaimConnection *gc, const char *dn, const char *room, const char *what, GaimMessageFlags flags) |
| 6729 | 834 | { |
| 7827 | 835 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 836 | struct yahoo_packet *pkt; |
| 837 | int me = 0; | |
| 7827 | 838 | char *msg1, *msg2, *room2; |
| 839 | gboolean utf8 = TRUE; | |
| 6804 | 840 | |
| 9376 | 841 | if (yd->wm) { |
| 842 | g_return_val_if_fail(yd->ycht != NULL, 1); | |
| 843 | ||
| 844 | return ycht_chat_send(yd->ycht, room, what); | |
| 845 | } | |
| 846 | ||
| 6804 | 847 | msg1 = g_strdup(what); |
| 6729 | 848 | |
| 6804 | 849 | if (meify(msg1, -1)) |
| 6729 | 850 | me = 1; |
| 6804 | 851 | |
| 852 | msg2 = yahoo_html_to_codes(msg1); | |
| 853 | g_free(msg1); | |
| 7827 | 854 | msg1 = yahoo_string_encode(gc, msg2, &utf8); |
| 855 | g_free(msg2); | |
| 856 | room2 = yahoo_string_encode(gc, room, NULL); | |
| 6729 | 857 | |
| 858 | pkt = yahoo_packet_new(YAHOO_SERVICE_COMMENT, YAHOO_STATUS_AVAILABLE, 0); | |
| 859 | ||
| 10394 | 860 | yahoo_packet_hash(pkt, "sss", 1, dn, 104, room2, 117, msg1); |
| 6729 | 861 | if (me) |
| 10394 | 862 | yahoo_packet_hash_str(pkt, 124, "2"); |
| 6729 | 863 | else |
| 10394 | 864 | yahoo_packet_hash_str(pkt, 124, "1"); |
| 6729 | 865 | /* fixme: what about /think? (124=3) */ |
| 7827 | 866 | if (utf8) |
| 10394 | 867 | yahoo_packet_hash_str(pkt, 97, "1"); |
| 6729 | 868 | |
| 10392 | 869 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 870 | g_free(msg1); |
| 871 | g_free(room2); | |
| 6729 | 872 | |
| 873 | return 0; | |
| 874 | } | |
| 875 | ||
| 7827 | 876 | static void yahoo_chat_join(GaimConnection *gc, const char *dn, const char *room, const char *topic) |
| 6729 | 877 | { |
| 7827 | 878 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 879 | struct yahoo_packet *pkt; |
| 7827 | 880 | char *room2; |
| 8410 | 881 | gboolean utf8 = TRUE; |
| 7827 | 882 | |
| 9376 | 883 | if (yd->wm) { |
| 884 | g_return_if_fail(yd->ycht != NULL); | |
| 885 | ycht_chat_join(yd->ycht, room); | |
| 886 | return; | |
| 887 | } | |
| 888 | ||
| 8410 | 889 | /* apparently room names are always utf8, or else always not utf8, |
| 890 | * so we don't have to actually pass the flag in the packet. Or something. */ | |
| 891 | room2 = yahoo_string_encode(gc, room, &utf8); | |
| 6729 | 892 | |
| 893 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 894 | yahoo_packet_hash(pkt, "ssss", 1, gaim_connection_get_display_name(gc), |
| 895 | 62, "2", 104, room2, 129, "0"); | |
| 10392 | 896 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 897 | g_free(room2); |
| 6729 | 898 | } |
| 899 | ||
| 7827 | 900 | static void yahoo_chat_invite(GaimConnection *gc, const char *dn, const char *buddy, |
| 6729 | 901 | const char *room, const char *msg) |
| 902 | { | |
| 7827 | 903 | struct yahoo_data *yd = gc->proto_data; |
| 6729 | 904 | struct yahoo_packet *pkt; |
| 7827 | 905 | char *room2, *msg2 = NULL; |
| 8410 | 906 | gboolean utf8 = TRUE; |
| 6729 | 907 | |
| 9376 | 908 | if (yd->wm) { |
| 909 | g_return_if_fail(yd->ycht != NULL); | |
| 910 | ycht_chat_send_invite(yd->ycht, room, buddy, msg); | |
| 911 | return; | |
| 912 | } | |
| 913 | ||
| 8410 | 914 | room2 = yahoo_string_encode(gc, room, &utf8); |
| 7827 | 915 | if (msg) |
| 916 | msg2 = yahoo_string_encode(gc, msg, NULL); | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
917 | |
| 6729 | 918 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, 0); |
| 10394 | 919 | yahoo_packet_hash(pkt, "sssss", 1, dn, 118, buddy, 104, room2, 117, (msg2?msg2:""), 129, "0"); |
| 10392 | 920 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 921 | |
| 922 | g_free(room2); | |
| 10392 | 923 | g_free(msg2); |
| 6729 | 924 | } |
| 925 | ||
| 926 | void yahoo_chat_goto(GaimConnection *gc, const char *name) | |
| 927 | { | |
| 928 | struct yahoo_data *yd; | |
| 929 | struct yahoo_packet *pkt; | |
| 930 | ||
| 931 | yd = gc->proto_data; | |
| 932 | ||
| 9376 | 933 | if (yd->wm) { |
| 934 | g_return_if_fail(yd->ycht != NULL); | |
| 935 | ycht_chat_goto_user(yd->ycht, name); | |
| 936 | return; | |
| 937 | } | |
| 938 | ||
| 6729 | 939 | if (!yd->chat_online) |
| 940 | yahoo_chat_online(gc); | |
| 941 | ||
| 942 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 943 | yahoo_packet_hash(pkt, "sss", 109, name, 1, gaim_connection_get_display_name(gc), 62, "2"); |
| 10392 | 944 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 945 | } |
| 946 | /* | |
| 947 | * These are the functions registered with the core | |
| 948 | * which get called for both chats and conferences. | |
| 949 | */ | |
| 950 | ||
| 951 | void yahoo_c_leave(GaimConnection *gc, int id) | |
| 952 | { | |
| 953 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; | |
| 954 | GaimConversation *c; | |
| 955 | ||
| 956 | if (!yd) | |
| 957 | return; | |
| 958 | ||
| 959 | c = gaim_find_chat(gc, id); | |
| 960 | if (!c) | |
| 961 | return; | |
| 962 | ||
| 963 | if (id != YAHOO_CHAT_ID) { | |
| 964 | yahoo_conf_leave(yd, gaim_conversation_get_name(c), | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
965 | gaim_connection_get_display_name(gc), gaim_conv_chat_get_users(GAIM_CONV_CHAT(c))); |
| 6729 | 966 | yd->confs = g_slist_remove(yd->confs, c); |
| 967 | } else { | |
| 7186 | 968 | yahoo_chat_leave(gc, gaim_conversation_get_name(c), gaim_connection_get_display_name(gc), TRUE); |
| 6729 | 969 | } |
| 970 | ||
| 971 | serv_got_chat_left(gc, id); | |
| 972 | } | |
| 973 | ||
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12212
diff
changeset
|
974 | int yahoo_c_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags) |
| 6729 | 975 | { |
| 976 | GaimConversation *c; | |
| 977 | int ret; | |
| 978 | struct yahoo_data *yd; | |
| 979 | ||
| 980 | yd = (struct yahoo_data *) gc->proto_data; | |
| 981 | if (!yd) | |
| 982 | return -1; | |
| 983 | ||
| 984 | c = gaim_find_chat(gc, id); | |
| 985 | if (!c) | |
| 986 | return -1; | |
| 987 | ||
| 988 | if (id != YAHOO_CHAT_ID) { | |
| 7827 | 989 | ret = yahoo_conf_send(gc, gaim_connection_get_display_name(gc), |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
990 | gaim_conversation_get_name(c), gaim_conv_chat_get_users(GAIM_CONV_CHAT(c)), what); |
| 6729 | 991 | } else { |
| 7827 | 992 | ret = yahoo_chat_send(gc, gaim_connection_get_display_name(gc), |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12212
diff
changeset
|
993 | gaim_conversation_get_name(c), what, flags); |
| 6729 | 994 | if (!ret) |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
995 | serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), |
| 6729 | 996 | gaim_connection_get_display_name(gc), 0, what, time(NULL)); |
| 997 | } | |
| 998 | return ret; | |
| 999 | } | |
| 1000 | ||
| 1001 | GList *yahoo_c_info(GaimConnection *gc) | |
| 1002 | { | |
| 1003 | GList *m = NULL; | |
| 1004 | struct proto_chat_entry *pce; | |
| 1005 | ||
| 1006 | pce = g_new0(struct proto_chat_entry, 1); | |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7827
diff
changeset
|
1007 | pce->label = _("_Room:"); |
| 6729 | 1008 | pce->identifier = "room"; |
|
10954
cd5771cb6cf8
[gaim-migrate @ 12754]
Richard Laager <rlaager@pidgin.im>
parents:
10937
diff
changeset
|
1009 | pce->required = TRUE; |
| 6729 | 1010 | m = g_list_append(m, pce); |
| 1011 | ||
| 1012 | return m; | |
| 1013 | } | |
| 1014 | ||
| 9768 | 1015 | GHashTable *yahoo_c_info_defaults(GaimConnection *gc, const char *chat_name) |
| 1016 | { | |
| 1017 | GHashTable *defaults; | |
| 1018 | ||
| 1019 | defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); | |
| 1020 | ||
| 1021 | if (chat_name != NULL) | |
| 1022 | g_hash_table_insert(defaults, "room", g_strdup(chat_name)); | |
| 1023 | ||
| 1024 | return defaults; | |
| 1025 | } | |
| 1026 | ||
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1027 | char *yahoo_get_chat_name(GHashTable *data) |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1028 | { |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1029 | return g_strdup(g_hash_table_lookup(data, "room")); |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1030 | } |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9846
diff
changeset
|
1031 | |
| 6729 | 1032 | void yahoo_c_join(GaimConnection *gc, GHashTable *data) |
| 1033 | { | |
| 1034 | struct yahoo_data *yd; | |
| 1035 | char *room, *topic, *members, *type; | |
| 1036 | int id; | |
| 1037 | GaimConversation *c; | |
| 1038 | ||
| 1039 | yd = (struct yahoo_data *) gc->proto_data; | |
| 1040 | if (!yd) | |
| 1041 | return; | |
| 1042 | ||
| 1043 | room = g_hash_table_lookup(data, "room"); | |
| 1044 | if (!room) | |
| 1045 | return; | |
| 1046 | ||
| 1047 | topic = g_hash_table_lookup(data, "topic"); | |
| 1048 | if (!topic) | |
| 1049 | topic = ""; | |
| 1050 | ||
| 1051 | members = g_hash_table_lookup(data, "members"); | |
| 1052 | ||
| 1053 | if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) { | |
| 1054 | id = yd->conf_id++; | |
| 1055 | c = serv_got_joined_chat(gc, id, room); | |
| 1056 | yd->confs = g_slist_prepend(yd->confs, c); | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6804
diff
changeset
|
1057 | gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), gaim_connection_get_display_name(gc), topic); |
| 6729 | 1058 | yahoo_conf_join(yd, c, gaim_connection_get_display_name(gc), room, topic, members); |
| 1059 | return; | |
| 1060 | } else { | |
| 1061 | if (yd->in_chat) | |
| 7186 | 1062 | yahoo_chat_leave(gc, room, |
| 1063 | gaim_connection_get_display_name(gc), | |
| 1064 | FALSE); | |
| 6729 | 1065 | if (!yd->chat_online) |
| 1066 | yahoo_chat_online(gc); | |
| 7827 | 1067 | yahoo_chat_join(gc, gaim_connection_get_display_name(gc), room, topic); |
| 6729 | 1068 | return; |
| 1069 | } | |
| 1070 | } | |
| 1071 | ||
| 1072 | void yahoo_c_invite(GaimConnection *gc, int id, const char *msg, const char *name) | |
| 1073 | { | |
| 1074 | GaimConversation *c; | |
| 1075 | ||
| 1076 | c = gaim_find_chat(gc, id); | |
| 1077 | if (!c || !c->name) | |
| 1078 | return; | |
| 1079 | ||
| 1080 | if (id != YAHOO_CHAT_ID) { | |
| 7827 | 1081 | yahoo_conf_invite(gc, c, gaim_connection_get_display_name(gc), name, |
| 6729 | 1082 | gaim_conversation_get_name(c), msg); |
| 1083 | } else { | |
| 7827 | 1084 | yahoo_chat_invite(gc, gaim_connection_get_display_name(gc), name, |
| 6729 | 1085 | gaim_conversation_get_name(c), msg); |
| 1086 | } | |
| 1087 | } | |
| 1088 | ||
| 8113 | 1089 | struct yahoo_roomlist { |
| 1090 | int fd; | |
| 1091 | int inpa; | |
| 1092 | guchar *rxqueue; | |
| 1093 | int rxlen; | |
| 1094 | gboolean started; | |
| 1095 | char *path; | |
| 1096 | char *host; | |
| 1097 | GaimRoomlist *list; | |
| 1098 | GaimRoomlistRoom *cat; | |
| 1099 | GaimRoomlistRoom *ucat; | |
| 1100 | GMarkupParseContext *parse; | |
| 1101 | }; | |
| 1102 | ||
| 1103 | static void yahoo_roomlist_destroy(struct yahoo_roomlist *yrl) | |
| 1104 | { | |
| 1105 | if (yrl->inpa) | |
| 1106 | gaim_input_remove(yrl->inpa); | |
| 1107 | if (yrl->rxqueue) | |
| 1108 | g_free(yrl->rxqueue); | |
| 1109 | if (yrl->path) | |
| 1110 | g_free(yrl->path); | |
| 1111 | if (yrl->host) | |
| 1112 | g_free(yrl->host); | |
| 1113 | if (yrl->parse) | |
| 1114 | g_markup_parse_context_free(yrl->parse); | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10394
diff
changeset
|
1115 | g_free(yrl); |
| 8113 | 1116 | } |
| 1117 | ||
| 1118 | enum yahoo_room_type { | |
| 1119 | yrt_yahoo, | |
| 1120 | yrt_user, | |
| 1121 | }; | |
| 1122 | ||
| 1123 | struct yahoo_chatxml_state { | |
| 1124 | GaimRoomlist *list; | |
| 1125 | struct yahoo_roomlist *yrl; | |
| 1126 | GQueue *q; | |
| 1127 | struct { | |
| 1128 | enum yahoo_room_type type; | |
| 1129 | char *name; | |
| 1130 | char *topic; | |
| 1131 | char *id; | |
| 1132 | int users, voices, webcams; | |
| 1133 | } room; | |
| 1134 | }; | |
| 1135 | ||
| 1136 | struct yahoo_lobby { | |
| 1137 | int count, users, voices, webcams; | |
| 1138 | }; | |
| 1139 | ||
| 1140 | static struct yahoo_chatxml_state *yahoo_chatxml_state_new(GaimRoomlist *list, struct yahoo_roomlist *yrl) | |
| 1141 | { | |
| 1142 | struct yahoo_chatxml_state *s; | |
| 1143 | ||
| 1144 | s = g_new0(struct yahoo_chatxml_state, 1); | |
| 1145 | s->list = list; | |
| 1146 | s->yrl = yrl; | |
| 1147 | s->q = g_queue_new(); | |
| 1148 | ||
| 1149 | return s; | |
| 1150 | } | |
| 1151 | ||
| 1152 | static void yahoo_chatxml_state_destroy(struct yahoo_chatxml_state *s) | |
| 1153 | { | |
| 1154 | g_queue_free(s->q); | |
| 1155 | if (s->room.name) | |
| 1156 | g_free(s->room.name); | |
| 1157 | if (s->room.topic) | |
| 1158 | g_free(s->room.topic); | |
| 1159 | if (s->room.id) | |
| 1160 | g_free(s->room.id); | |
| 1161 | g_free(s); | |
| 1162 | } | |
| 1163 | ||
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1164 | static void yahoo_chatlist_start_element(GMarkupParseContext *context, |
|
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1165 | const gchar *ename, const gchar **anames, |
|
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1166 | const gchar **avalues, gpointer user_data, |
|
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11593
diff
changeset
|
1167 | GError **error) |
| 8113 | 1168 | { |
| 1169 | struct yahoo_chatxml_state *s = user_data; | |
| 1170 | GaimRoomlist *list = s->list; | |
| 1171 | GaimRoomlistRoom *r; | |
| 1172 | GaimRoomlistRoom *parent; | |
| 1173 | int i; | |
| 1174 | ||
| 1175 | if (!strcmp(ename, "category")) { | |
| 1176 | const gchar *name = NULL, *id = NULL; | |
| 1177 | ||
| 1178 | for (i = 0; anames[i]; i++) { | |
| 1179 | if (!strcmp(anames[i], "id")) | |
| 1180 | id = avalues[i]; | |
| 1181 | if (!strcmp(anames[i], "name")) | |
| 1182 | name = avalues[i]; | |
| 1183 | } | |
| 1184 | if (!name || !id) | |
| 1185 | return; | |
| 1186 | ||
| 1187 | parent = g_queue_peek_head(s->q); | |
| 8584 | 1188 | r = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_CATEGORY, name, parent); |
| 8113 | 1189 | gaim_roomlist_room_add_field(list, r, (gpointer)name); |
| 1190 | gaim_roomlist_room_add_field(list, r, (gpointer)id); | |
| 1191 | gaim_roomlist_room_add(list, r); | |
| 1192 | g_queue_push_head(s->q, r); | |
| 1193 | } else if (!strcmp(ename, "room")) { | |
| 1194 | s->room.users = s->room.voices = s->room.webcams = 0; | |
| 1195 | ||
| 1196 | for (i = 0; anames[i]; i++) { | |
| 1197 | if (!strcmp(anames[i], "id")) { | |
| 1198 | if (s->room.id) | |
| 1199 | g_free(s->room.id); | |
| 1200 | s->room.id = g_strdup(avalues[i]); | |
| 1201 | } else if (!strcmp(anames[i], "name")) { | |
| 1202 | if (s->room.name) | |
| 1203 | g_free(s->room.name); | |
| 1204 | s->room.name = g_strdup(avalues[i]); | |
| 1205 | } else if (!strcmp(anames[i], "topic")) { | |
| 1206 | if (s->room.topic) | |
| 1207 | g_free(s->room.topic); | |
| 1208 | s->room.topic = g_strdup(avalues[i]); | |
| 1209 | } else if (!strcmp(anames[i], "type")) { | |
| 1210 | if (!strcmp("yahoo", avalues[i])) | |
| 1211 | s->room.type = yrt_yahoo; | |
| 1212 | else | |
| 1213 | s->room.type = yrt_user; | |
| 1214 | } | |
| 1215 | } | |
| 1216 | ||
| 1217 | } else if (!strcmp(ename, "lobby")) { | |
| 1218 | struct yahoo_lobby *lob = g_new0(struct yahoo_lobby, 1); | |
| 1219 | ||
| 1220 | for (i = 0; anames[i]; i++) { | |
| 1221 | if (!strcmp(anames[i], "count")) { | |
| 1222 | lob->count = strtol(avalues[i], NULL, 10); | |
| 1223 | } else if (!strcmp(anames[i], "users")) { | |
| 1224 | s->room.users += lob->users = strtol(avalues[i], NULL, 10); | |
| 1225 | } else if (!strcmp(anames[i], "voices")) { | |
| 1226 | s->room.voices += lob->voices = strtol(avalues[i], NULL, 10); | |
| 1227 | } else if (!strcmp(anames[i], "webcams")) { | |
| 1228 | s->room.webcams += lob->webcams = strtol(avalues[i], NULL, 10); | |
| 1229 | } | |
| 1230 | } | |
| 1231 | g_queue_push_head(s->q, lob); | |
| 1232 | } | |
| 1233 | } | |
| 1234 | ||
| 1235 | static void yahoo_chatlist_end_element(GMarkupParseContext *context, const gchar *ename, | |
| 1236 | gpointer user_data, GError **error) | |
| 1237 | { | |
| 1238 | struct yahoo_chatxml_state *s = user_data; | |
| 1239 | ||
| 1240 | if (!strcmp(ename, "category")) { | |
| 1241 | g_queue_pop_head(s->q); | |
| 1242 | } else if (!strcmp(ename, "room")) { | |
| 1243 | struct yahoo_lobby *lob; | |
| 1244 | GaimRoomlistRoom *r, *l; | |
| 1245 | ||
| 1246 | if (s->room.type == yrt_yahoo) | |
| 8584 | 1247 | r = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_CATEGORY|GAIM_ROOMLIST_ROOMTYPE_ROOM, |
| 8113 | 1248 | s->room.name, s->yrl->cat); |
| 1249 | else | |
| 8584 | 1250 | r = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_CATEGORY|GAIM_ROOMLIST_ROOMTYPE_ROOM, |
| 8113 | 1251 | s->room.name, s->yrl->ucat); |
| 1252 | ||
| 1253 | gaim_roomlist_room_add_field(s->list, r, s->room.name); | |
| 1254 | gaim_roomlist_room_add_field(s->list, r, s->room.id); | |
| 1255 | gaim_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.users)); | |
| 1256 | gaim_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.voices)); | |
| 1257 | gaim_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.webcams)); | |
| 1258 | gaim_roomlist_room_add_field(s->list, r, s->room.topic); | |
| 1259 | gaim_roomlist_room_add(s->list, r); | |
| 1260 | ||
| 1261 | while ((lob = g_queue_pop_head(s->q))) { | |
| 1262 | char *name = g_strdup_printf("%s:%d", s->room.name, lob->count); | |
| 1263 | l = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_ROOM, name, r); | |
| 1264 | ||
| 1265 | gaim_roomlist_room_add_field(s->list, l, name); | |
| 1266 | gaim_roomlist_room_add_field(s->list, l, s->room.id); | |
| 1267 | gaim_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->users)); | |
| 1268 | gaim_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->voices)); | |
| 1269 | gaim_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->webcams)); | |
| 1270 | gaim_roomlist_room_add_field(s->list, l, s->room.topic); | |
| 1271 | gaim_roomlist_room_add(s->list, l); | |
| 1272 | ||
| 1273 | g_free(name); | |
| 1274 | g_free(lob); | |
| 1275 | } | |
| 1276 | } | |
| 1277 | } | |
| 1278 | ||
| 1279 | static GMarkupParser parser = { | |
| 1280 | yahoo_chatlist_start_element, | |
| 1281 | yahoo_chatlist_end_element, | |
| 1282 | NULL, | |
| 1283 | NULL, | |
| 1284 | NULL | |
| 1285 | }; | |
| 1286 | ||
| 1287 | static void yahoo_roomlist_cleanup(GaimRoomlist *list, struct yahoo_roomlist *yrl) | |
| 1288 | { | |
| 1289 | gaim_roomlist_set_in_progress(list, FALSE); | |
| 1290 | ||
| 1291 | if (yrl) { | |
| 1292 | list->proto_data = g_list_remove(list->proto_data, yrl); | |
| 1293 | yahoo_roomlist_destroy(yrl); | |
| 1294 | } | |
| 1295 | ||
| 1296 | gaim_roomlist_unref(list); | |
| 1297 | } | |
| 1298 | ||
| 1299 | static void yahoo_roomlist_pending(gpointer data, gint source, GaimInputCondition cond) | |
| 1300 | { | |
| 1301 | struct yahoo_roomlist *yrl = data; | |
| 1302 | GaimRoomlist *list = yrl->list; | |
| 1303 | char buf[1024]; | |
| 1304 | int len; | |
| 1305 | guchar *start; | |
| 1306 | struct yahoo_chatxml_state *s; | |
| 1307 | ||
| 1308 | len = read(yrl->fd, buf, sizeof(buf)); | |
| 1309 | ||
| 1310 | if (len <= 0) { | |
| 1311 | if (yrl->parse) | |
| 1312 | g_markup_parse_context_end_parse(yrl->parse, NULL); | |
| 1313 | yahoo_roomlist_cleanup(list, yrl); | |
| 1314 | return; | |
| 1315 | } | |
| 1316 | ||
| 1317 | yrl->rxqueue = g_realloc(yrl->rxqueue, len + yrl->rxlen); | |
| 1318 | memcpy(yrl->rxqueue + yrl->rxlen, buf, len); | |
| 1319 | yrl->rxlen += len; | |
| 1320 | ||
| 1321 | if (!yrl->started) { | |
| 1322 | yrl->started = TRUE; | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11044
diff
changeset
|
1323 | start = (guchar *)g_strstr_len((char *)yrl->rxqueue, yrl->rxlen, "\r\n\r\n"); |
| 8113 | 1324 | if (!start || (start - yrl->rxqueue + 4) >= yrl->rxlen) |
| 1325 | return; | |
| 1326 | start += 4; | |
| 1327 | } else { | |
| 1328 | start = yrl->rxqueue; | |
| 1329 | } | |
| 1330 | ||
| 1331 | if (yrl->parse == NULL) { | |
| 1332 | s = yahoo_chatxml_state_new(list, yrl); | |
| 1333 | yrl->parse = g_markup_parse_context_new(&parser, 0, s, | |
| 1334 | (GDestroyNotify)yahoo_chatxml_state_destroy); | |
| 1335 | } | |
| 1336 | ||
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11044
diff
changeset
|
1337 | if (!g_markup_parse_context_parse(yrl->parse, (char *)start, (yrl->rxlen - (start - yrl->rxqueue)), NULL)) { |
| 8113 | 1338 | |
| 1339 | yahoo_roomlist_cleanup(list, yrl); | |
| 1340 | return; | |
| 1341 | } | |
| 1342 | ||
| 1343 | yrl->rxlen = 0; | |
| 1344 | } | |
| 1345 | ||
| 1346 | static void yahoo_roomlist_got_connected(gpointer data, gint source, GaimInputCondition cond) | |
| 1347 | { | |
| 1348 | struct yahoo_roomlist *yrl = data; | |
| 1349 | GaimRoomlist *list = yrl->list; | |
| 1350 | char *buf, *cookie; | |
| 1351 | struct yahoo_data *yd = gaim_account_get_connection(list->account)->proto_data; | |
| 1352 | ||
| 1353 | if (source < 0) { | |
| 1354 | gaim_notify_error(gaim_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); | |
| 1355 | yahoo_roomlist_cleanup(list, yrl); | |
| 1356 | return; | |
| 1357 | } | |
| 1358 | ||
| 1359 | yrl->fd = source; | |
| 1360 | ||
| 1361 | cookie = g_strdup_printf("Y=%s; T=%s", yd->cookie_y, yd->cookie_t); | |
|
10575
f360d2dc8a1c
[gaim-migrate @ 11968]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10504
diff
changeset
|
1362 | buf = g_strdup_printf("GET http://%s/%s HTTP/1.0\r\nHost: %s\r\nCookie: %s\r\n\r\n", |
|
f360d2dc8a1c
[gaim-migrate @ 11968]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10504
diff
changeset
|
1363 | yrl->host, yrl->path, yrl->host, cookie); |
| 8113 | 1364 | write(yrl->fd, buf, strlen(buf)); |
| 1365 | g_free(cookie); | |
| 1366 | g_free(buf); | |
| 1367 | yrl->inpa = gaim_input_add(yrl->fd, GAIM_INPUT_READ, yahoo_roomlist_pending, yrl); | |
| 1368 | ||
| 1369 | } | |
| 1370 | ||
| 1371 | GaimRoomlist *yahoo_roomlist_get_list(GaimConnection *gc) | |
| 1372 | { | |
| 1373 | struct yahoo_roomlist *yrl; | |
| 1374 | GaimRoomlist *rl; | |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1375 | const char *rll; |
| 8113 | 1376 | char *url; |
| 1377 | GList *fields = NULL; | |
| 1378 | GaimRoomlistField *f; | |
| 1379 | ||
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1380 | rll = gaim_account_get_string(gaim_connection_get_account(gc), |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1381 | "room_list_locale", YAHOO_ROOMLIST_LOCALE); |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1382 | |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1383 | if (rll != NULL && *rll != '\0') { |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1384 | url = g_strdup_printf("%s?chatcat=0&intl=%s", |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1385 | gaim_account_get_string(gaim_connection_get_account(gc), |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1386 | "room_list", YAHOO_ROOMLIST_URL), rll); |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1387 | } else { |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1388 | url = g_strdup_printf("%s?chatcat=0", |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1389 | gaim_account_get_string(gaim_connection_get_account(gc), |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1390 | "room_list", YAHOO_ROOMLIST_URL)); |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1391 | } |
| 8113 | 1392 | |
| 1393 | yrl = g_new0(struct yahoo_roomlist, 1); | |
| 1394 | rl = gaim_roomlist_new(gaim_connection_get_account(gc)); | |
| 1395 | yrl->list = rl; | |
| 1396 | ||
| 9227 | 1397 | gaim_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); |
| 8113 | 1398 | g_free(url); |
| 1399 | ||
| 1400 | f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "room", TRUE); | |
| 1401 | fields = g_list_append(fields, f); | |
| 1402 | ||
| 1403 | f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "id", TRUE); | |
| 1404 | fields = g_list_append(fields, f); | |
| 1405 | ||
| 1406 | f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); | |
| 1407 | fields = g_list_append(fields, f); | |
| 1408 | ||
| 1409 | f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, _("Voices"), "voices", FALSE); | |
| 1410 | fields = g_list_append(fields, f); | |
| 1411 | ||
| 1412 | f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, _("Webcams"), "webcams", FALSE); | |
| 1413 | fields = g_list_append(fields, f); | |
| 1414 | ||
| 1415 | f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); | |
| 1416 | fields = g_list_append(fields, f); | |
| 1417 | ||
| 1418 | gaim_roomlist_set_fields(rl, fields); | |
| 1419 | ||
| 1420 | if (gaim_proxy_connect(gaim_connection_get_account(gc), | |
| 1421 | yrl->host, 80, yahoo_roomlist_got_connected, yrl) != 0) | |
| 1422 | { | |
| 1423 | gaim_notify_error(gc, NULL, _("Connection problem"), _("Unable to fetch room list.")); | |
| 1424 | yahoo_roomlist_cleanup(rl, yrl); | |
| 1425 | return NULL; | |
| 1426 | } | |
| 1427 | ||
| 1428 | rl->proto_data = g_list_append(rl->proto_data, yrl); | |
| 1429 | ||
| 1430 | gaim_roomlist_set_in_progress(rl, TRUE); | |
| 1431 | return rl; | |
| 1432 | } | |
| 1433 | ||
| 1434 | void yahoo_roomlist_cancel(GaimRoomlist *list) | |
| 1435 | { | |
| 1436 | GList *l, *k; | |
| 1437 | ||
| 1438 | k = l = list->proto_data; | |
| 1439 | list->proto_data = NULL; | |
| 1440 | ||
| 1441 | gaim_roomlist_set_in_progress(list, FALSE); | |
| 1442 | ||
| 1443 | for (; l; l = l->next) { | |
| 1444 | yahoo_roomlist_destroy(l->data); | |
|
10647
e9ad21c11fcc
[gaim-migrate @ 12163]
Daniel Atallah <datallah@pidgin.im>
parents:
10575
diff
changeset
|
1445 | gaim_roomlist_unref(list); |
| 8113 | 1446 | } |
| 1447 | g_list_free(k); | |
| 1448 | } | |
| 1449 | ||
| 8584 | 1450 | void yahoo_roomlist_expand_category(GaimRoomlist *list, GaimRoomlistRoom *category) |
| 8113 | 1451 | { |
| 1452 | struct yahoo_roomlist *yrl; | |
| 1453 | char *url; | |
| 1454 | char *id; | |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1455 | const char *rll; |
| 8113 | 1456 | |
| 8584 | 1457 | if (category->type != GAIM_ROOMLIST_ROOMTYPE_CATEGORY) |
| 8113 | 1458 | return; |
| 1459 | ||
| 8584 | 1460 | if (!(id = g_list_nth_data(category->fields, 1))) { |
| 8113 | 1461 | gaim_roomlist_set_in_progress(list, FALSE); |
| 1462 | return; | |
| 1463 | } | |
| 1464 | ||
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1465 | rll = gaim_account_get_string(list->account, "room_list_locale", |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1466 | YAHOO_ROOMLIST_LOCALE); |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1467 | |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1468 | if (rll != NULL && *rll != '\0') { |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1469 | url = g_strdup_printf("%s?chatroom_%s=0&intl=%s", |
|
12212
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1470 | gaim_account_get_string(list->account,"room_list", |
|
d9129dc59ecd
[gaim-migrate @ 14514]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11644
diff
changeset
|
1471 | YAHOO_ROOMLIST_URL), id, rll); |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1472 | } else { |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1473 | url = g_strdup_printf("%s?chatroom_%s=0", |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1474 | gaim_account_get_string(list->account,"room_list", |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1475 | YAHOO_ROOMLIST_URL), id); |
|
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10954
diff
changeset
|
1476 | } |
| 8113 | 1477 | |
| 1478 | yrl = g_new0(struct yahoo_roomlist, 1); | |
| 1479 | yrl->list = list; | |
| 8584 | 1480 | yrl->cat = category; |
| 8113 | 1481 | list->proto_data = g_list_append(list->proto_data, yrl); |
| 1482 | ||
| 9227 | 1483 | gaim_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); |
| 8113 | 1484 | g_free(url); |
| 1485 | ||
| 8584 | 1486 | yrl->ucat = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat); |
| 8113 | 1487 | gaim_roomlist_room_add(list, yrl->ucat); |
| 1488 | ||
| 1489 | if (gaim_proxy_connect(list->account, | |
| 1490 | yrl->host, 80, yahoo_roomlist_got_connected, yrl) != 0) | |
| 1491 | { | |
| 1492 | gaim_notify_error(gaim_account_get_connection(list->account), | |
| 1493 | NULL, _("Connection problem"), _("Unable to fetch room list.")); | |
|
10647
e9ad21c11fcc
[gaim-migrate @ 12163]
Daniel Atallah <datallah@pidgin.im>
parents:
10575
diff
changeset
|
1494 | gaim_roomlist_ref(list); |
| 8113 | 1495 | yahoo_roomlist_cleanup(list, yrl); |
| 1496 | return; | |
| 1497 | } | |
| 1498 | ||
| 1499 | gaim_roomlist_set_in_progress(list, TRUE); | |
| 1500 | gaim_roomlist_ref(list); | |
| 1501 | } |