annotate src/protocols/yahoo/yahoochat.c @ 10414:26eac2362c32

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