annotate src/protocols/yahoo/ycht.c @ 10687:b256ce6b85b8

[gaim-migrate @ 12235] grim says this is really fixed this time. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Sat, 12 Mar 2005 01:10:37 +0000
parents a8f9e5ce4f92
children 519dc2186438
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
1 /**
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
2 * @file ycht.c The Yahoo! protocol plugin, YCHT protocol stuff.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
3 *
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
4 * gaim
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
5 *
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
6 * Copyright (C) 2004 Timothy Ringenbach <omarvo@hotmail.com>
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
7 * Liberal amounts of code borrowed from the rest of the Yahoo! prpl.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
8 *
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
9 * Gaim is the legal property of its developers, whose names are too numerous
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
10 * to list here. Please refer to the COPYRIGHT file distributed with this
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
11 * source distribution.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
12 *
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
13 * This program is free software; you can redistribute it and/or modify
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
14 * it under the terms of the GNU General Public License as published by
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
15 * the Free Software Foundation; either version 2 of the License, or
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
16 * (at your option) any later version.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
17 *
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
18 * This program is distributed in the hope that it will be useful,
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
21 * GNU General Public License for more details.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
22 *
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
23 * You should have received a copy of the GNU General Public License
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
24 * along with this program; if not, write to the Free Software
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
26 */
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
27
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
28 #include <string.h>
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
29
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
30 #include "internal.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
31 #include "prpl.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
32 #include "notify.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
33 #include "account.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
34 #include "proxy.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
35 #include "debug.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
36 #include "conversation.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
37 #include "util.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
38
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
39 #include "yahoo.h"
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 9846
diff changeset
40 #include "yahoo_packet.h"
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
41 #include "ycht.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
42 #include "yahoochat.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
43
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
44 /*
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
45 * dword: YCHT
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
46 * dword: 0x000000AE
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
47 * dword: service
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
48 * word: status
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
49 * word: size
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
50 */
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
51 #define YAHOO_CHAT_ID (1)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
52 /************************************************************************************
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
53 * Functions to process various kinds of packets.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
54 ************************************************************************************/
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
55 static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
56 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
57 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
58 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
59
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
60 if (ycht->logged_in)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
61 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
62
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
63 yd->chat_online = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
64 ycht->logged_in = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
65
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
66 if (ycht->room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
67 ycht_chat_join(ycht, ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
68 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
69
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
70 static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
71 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
72 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
73 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
74
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
75 yd->chat_online = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
76 ycht->logged_in = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
77 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
78
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
79 static void ycht_process_chatjoin(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
80 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
81 char *room, *topic;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
82 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
83 GaimConversation *c = NULL;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
84 gboolean new_room = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
85 char **members;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
86 int i;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
87
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
88 room = g_list_nth_data(pkt->data, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
89 topic = g_list_nth_data(pkt->data, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
90 if (!g_list_nth_data(pkt->data, 4))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
91 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
92 if (!room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
93 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
94
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
95 members = g_strsplit(g_list_nth_data(pkt->data, 4), "\001", 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
96 for (i = 0; members[i]; i++) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
97 char *tmp = strchr(members[i], '\002');
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
98 if (tmp)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
99 *tmp = '\0';
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
100 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
101
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
102
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
103 if (g_list_length(pkt->data) > 5)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
104 new_room = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
105
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
106 if (new_room && ycht->changing_rooms) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
107 serv_got_chat_left(gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
108 ycht->changing_rooms = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
109 c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
110 } else {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
111 c = gaim_find_chat(gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
112 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
113
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
114
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
115 if (topic)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
116 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
117
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
118 for (i = 0; members[i]; i++) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
119 if (new_room) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
120 /*if (!strcmp(members[i], gaim_connection_get_display_name(ycht->gc)))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
121 continue;*/
9846
c28d5b45624e [gaim-migrate @ 10724]
Mark Doliner <mark@kingant.net>
parents: 9554
diff changeset
122 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), members[i], NULL, GAIM_CBFLAGS_NONE, TRUE);
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
123 } else {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
124 yahoo_chat_add_user(GAIM_CONV_CHAT(c), members[i], NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
125 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
126 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
127
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
128 g_strfreev(members);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
129 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
130
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
131 static void ycht_process_chatpart(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
132 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
133 char *room, *who;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
134
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
135 room = g_list_nth_data(pkt->data, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
136 who = g_list_nth_data(pkt->data, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
137
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
138 if (who && room) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
139 GaimConversation *c = gaim_find_chat(ycht->gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
140 if (c && !gaim_utf8_strcasecmp(gaim_conversation_get_name(c), room))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
141 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), who, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
142
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
143 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
144 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
145
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
146 static void ycht_progress_chatmsg(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
147 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
148 char *who, *what, *msg;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
149 GaimConversation *c;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
150 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
151
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
152 who = g_list_nth_data(pkt->data, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
153 what = g_list_nth_data(pkt->data, 2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
154
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
155 if (!who || !what)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
156 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
157
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
158 c = gaim_find_chat(gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
159 if (!c)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
160 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
161
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
162 msg = yahoo_string_decode(gc, what, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
163 what = yahoo_codes_to_html(msg);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
164 g_free(msg);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
165
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
166 if (pkt->service == YCHT_SERVICE_CHATMSG_EMOTE) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
167 char *tmp = g_strdup_printf("/me %s", what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
168 g_free(what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
169 what = tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
170 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
171
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
172 serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, what, time(NULL));
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
173 g_free(what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
174 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
175
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
176 static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
177 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
178 #if 0
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
179 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
180 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
181
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
182 if (ycht->logged_in)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
183 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
184
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
185 yd->chat_online = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
186 ycht->logged_in = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
187
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
188 if (ycht->room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
189 ycht_chat_join(ycht, ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
190 #endif
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
191 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
192
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
193 /*****************************************************************************
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
194 * Functions dealing with YCHT packets and their contents directly.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
195 *****************************************************************************/
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
196 static void ycht_packet_dump(const char *data, int len)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
197 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
198 #ifdef YAHOO_YCHT_DEBUG
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
199 int i;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
200
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
201 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
202
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
203 for (i = 0; i + 1 < len; i += 2) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
204 if ((i % 16 == 0) && i) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
205 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
206 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
207 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
208
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
209 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx%02hhx ", data[i], data[i + 1]);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
210 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
211 if (i < len)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
212 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx", data[i]);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
213
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
214 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
215 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
216
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
217 for (i = 0; i < len; i++) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
218 if ((i % 16 == 0) && i) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
219 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
220 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
221 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
222
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
223 if (g_ascii_isprint(data[i]))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
224 gaim_debug(GAIM_DEBUG_MISC, NULL, "%c ", data[i]);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
225 else
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
226 gaim_debug(GAIM_DEBUG_MISC, NULL, ". ");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
227 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
228
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
229 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
230 #endif
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
231 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
232
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
233 static YchtPkt *ycht_packet_new(guint version, guint service, int status)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
234 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
235 YchtPkt *ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
236
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
237 ret = g_new0(YchtPkt, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
238
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
239 ret->version = version;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
240 ret->service = service;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
241 ret->status = status;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
242
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
243 return ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
244 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
245
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
246 static void ycht_packet_append(YchtPkt *pkt, const char *str)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
247 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
248 g_return_if_fail(pkt != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
249 g_return_if_fail(str != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
250
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
251 pkt->data = g_list_append(pkt->data, g_strdup(str));
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
252 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
253
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
254 static int ycht_packet_length(YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
255 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
256 int ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
257 GList *l;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
258
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
259 ret = YCHT_HEADER_LEN;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
260
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
261 for (l = pkt->data; l; l = l->next) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
262 ret += strlen(l->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
263 if (l->next)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
264 ret += strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
265 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
266
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
267 return ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
268 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
269
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
270 static void ycht_packet_send(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
271 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
272 int len, pos;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
273 char *buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
274 GList *l;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
275
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
276 g_return_if_fail(ycht != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
277 g_return_if_fail(pkt != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
278 g_return_if_fail(ycht->fd != -1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
279
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
280 pos = 0;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
281 len = ycht_packet_length(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
282 buf = g_malloc(len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
283
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
284 memcpy(buf + pos, "YCHT", 4); pos += 4;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
285 pos += yahoo_put32(buf + pos, pkt->version);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
286 pos += yahoo_put32(buf + pos, pkt->service);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
287 pos += yahoo_put16(buf + pos, pkt->status);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
288 pos += yahoo_put16(buf + pos, len - YCHT_HEADER_LEN);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
289
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
290 for (l = pkt->data; l; l = l->next) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
291 int slen = strlen(l->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
292 memcpy(buf + pos, l->data, slen); pos += slen;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
293
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
294 if (l->next) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
295 memcpy(buf + pos, YCHT_SEP, strlen(YCHT_SEP));
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
296 pos += strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
297 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
298 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
299
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
300 write(ycht->fd, buf, len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
301 g_free(buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
302 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
303
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
304 static void ycht_packet_read(YchtPkt *pkt, const char *buf, int len)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
305 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
306 const char *pos = buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
307 const char *needle;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
308 char *tmp, *tmp2;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
309 int i = 0;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
310
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
311 while (len > 0 && (needle = g_strstr_len(pos, len, YCHT_SEP))) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
312 tmp = g_strndup(pos, needle - pos);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
313 pkt->data = g_list_append(pkt->data, tmp);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
314 len -= needle - pos + strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
315 pos = needle + strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
316 tmp2 = g_strescape(tmp, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
317 gaim_debug_misc("yahoo", "Data[%d]:\t%s\n", i++, tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
318 g_free(tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
319 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
320
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
321 if (len) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
322 tmp = g_strndup(pos, len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
323 pkt->data = g_list_append(pkt->data, tmp);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
324 tmp2 = g_strescape(tmp, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
325 gaim_debug_misc("yahoo", "Data[%d]:\t%s\n", i, tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
326 g_free(tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
327 };
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
328
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
329 gaim_debug_misc("yahoo", "--==End of incoming YCHT packet==--\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
330 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
331
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
332 static void ycht_packet_process(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
333 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
334 if (pkt->data && !strncmp(pkt->data->data, "*** Danger Will Robinson!!!", strlen("*** Danger Will Robinson!!!")))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
335 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
336
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
337 switch (pkt->service) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
338 case YCHT_SERVICE_LOGIN:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
339 ycht_process_login(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
340 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
341 case YCHT_SERVICE_LOGOUT:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
342 ycht_process_logout(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
343 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
344 case YCHT_SERVICE_CHATJOIN:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
345 ycht_process_chatjoin(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
346 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
347 case YCHT_SERVICE_CHATPART:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
348 ycht_process_chatpart(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
349 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
350 case YCHT_SERVICE_CHATMSG:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
351 case YCHT_SERVICE_CHATMSG_EMOTE:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
352 ycht_progress_chatmsg(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
353 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
354 case YCHT_SERVICE_ONLINE_FRIENDS:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
355 ycht_progress_online_friends(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
356 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
357 default:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
358 gaim_debug_warning("yahoo", "YCHT: warning, unhandled service 0x%02x\n", pkt->service);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
359 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
360 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
361
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
362 static void ycht_packet_free(YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
363 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
364 GList *l;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
365
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
366 g_return_if_fail(pkt != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
367
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
368 for (l = pkt->data; l; l = l->next)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
369 g_free(l->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
370 g_list_free(pkt->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
371 g_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
372 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
373
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
374 /************************************************************************************
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
375 * Functions dealing with connecting and disconnecting and reading data into YchtPkt
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
376 * structs, and all that stuff.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
377 ************************************************************************************/
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
378
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
379 void ycht_connection_close(YchtConn *ycht)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
380 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
381 struct yahoo_data *yd = ycht->gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
382
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
383 if (yd) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
384 yd->ycht = NULL;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
385 yd->chat_online = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
386 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
387
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
388 if (ycht->fd > 0)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
389 close(ycht->fd);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
390 if (ycht->inpa)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
391 gaim_input_remove(ycht->inpa);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
392
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
393 if (ycht->rxqueue)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
394 g_free(ycht->rxqueue);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
395
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
396 g_free(ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
397 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
398
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
399 static void ycht_connection_error(YchtConn *ycht, const gchar *error)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
400 {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
401
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
402 gaim_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server."), error);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
403 ycht_connection_close(ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
404 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
405
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
406 static void ycht_pending(gpointer data, gint source, GaimInputCondition cond)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
407 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
408 YchtConn *ycht = data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
409 char buf[1024];
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
410 int len;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
411
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
412 len = read(ycht->fd, buf, sizeof(buf));
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
413
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
414 if (len <= 0) {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
415 ycht_connection_error(ycht, _("Unable to read"));
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
416 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
417 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
418
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
419 ycht->rxqueue = g_realloc(ycht->rxqueue, len + ycht->rxlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
420 memcpy(ycht->rxqueue + ycht->rxlen, buf, len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
421 ycht->rxlen += len;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
422
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
423 while (1) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
424 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
425 int pos = 0;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
426 int pktlen;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
427 guint service;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
428 guint version;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
429 gint status;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
430
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
431 if (ycht->rxlen < YCHT_HEADER_LEN)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
432 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
433
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
434 if (strncmp("YCHT", ycht->rxqueue, 4) != 0)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
435 gaim_debug_error("yahoo", "YCHT: protocol error.\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
436
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
437 pos += 4; /* YCHT */
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
438
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
439 version = yahoo_get32(ycht->rxqueue + pos); pos += 4;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
440 service = yahoo_get32(ycht->rxqueue + pos); pos += 4;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
441 status = yahoo_get16(ycht->rxqueue + pos); pos += 2;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
442 pktlen = yahoo_get16(ycht->rxqueue + pos); pos += 2;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
443 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
444 "ycht: %d bytes to read, rxlen is %d\n", pktlen, ycht->rxlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
445
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
446 if (ycht->rxlen < (YCHT_HEADER_LEN + pktlen))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
447 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
448
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
449 gaim_debug_misc("yahoo", "--==Incoming YCHT packet==--\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
450 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
451 "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n",
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
452 service, version, status);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
453 ycht_packet_dump(ycht->rxqueue, YCHT_HEADER_LEN + pktlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
454
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
455 pkt = ycht_packet_new(version, service, status);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
456 ycht_packet_read(pkt, ycht->rxqueue + pos, pktlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
457
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
458 ycht->rxlen -= YCHT_HEADER_LEN + pktlen;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
459 if (ycht->rxlen) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
460 char *tmp = g_memdup(ycht->rxqueue + YCHT_HEADER_LEN + pktlen, ycht->rxlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
461 g_free(ycht->rxqueue);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
462 ycht->rxqueue = tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
463 } else {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
464 g_free(ycht->rxqueue);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
465 ycht->rxqueue = NULL;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
466 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
467
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
468 ycht_packet_process(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
469
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
470 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
471 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
472 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
473
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
474 static void ycht_got_connected(gpointer data, gint source, GaimInputCondition cond)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
475 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
476 YchtConn *ycht = data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
477 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
478 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
479 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
480 char *buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
481
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
482 if (source < 0) {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
483 ycht_connection_error(ycht, _("Unable to connect."));
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
484 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
485 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
486
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
487 ycht->fd = source;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
488
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
489 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_LOGIN, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
490
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
491 buf = g_strdup_printf("%s\001Y=%s; T=%s", gaim_connection_get_display_name(gc), yd->cookie_y, yd->cookie_t);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
492 ycht_packet_append(pkt, buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
493 g_free(buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
494
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
495 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
496
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
497 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
498
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
499 ycht->inpa = gaim_input_add(ycht->fd, GAIM_INPUT_READ, ycht_pending, ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
500 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
501
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
502 void ycht_connection_open(GaimConnection *gc)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
503 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
504 YchtConn *ycht;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
505 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
506 GaimAccount *account = gaim_connection_get_account(gc);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
507
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
508 ycht = g_new0(YchtConn, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
509 ycht->gc = gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
510 ycht->fd = -1;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
511
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
512 yd->ycht = ycht;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
513
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
514 if (gaim_proxy_connect(account,
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
515 gaim_account_get_string(account, "ycht-server", YAHOO_YCHT_HOST),
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
516 gaim_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT),
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
517 ycht_got_connected, ycht) != 0)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
518 {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
519 ycht_connection_error(ycht, _("Connection problem"));
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
520 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
521 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
522 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
523
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
524 /*******************************************************************************************
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
525 * These are functions called because the user did something.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
526 *******************************************************************************************/
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
527
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
528 void ycht_chat_join(YchtConn *ycht, const char *room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
529 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
530 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
531 char *tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
532
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
533 tmp = g_strdup(room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
534 if (ycht->room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
535 g_free(ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
536 ycht->room = tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
537
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
538 if (!ycht->logged_in)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
539 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
540
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
541 ycht->changing_rooms = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
542 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATJOIN, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
543 ycht_packet_append(pkt, ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
544 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
545 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
546 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
547
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
548 int ycht_chat_send(YchtConn *ycht, const char *room, const char *what)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
549 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
550 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
551 char *msg1, *msg2, *buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
552
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
553 if (strcmp(room, ycht->room))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
554 gaim_debug_warning("yahoo", "uhoh, sending to the wrong room!\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
555
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
556 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATMSG, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
557
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
558 msg1 = yahoo_html_to_codes(what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
559 msg2 = yahoo_string_encode(ycht->gc, msg1, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
560 g_free(msg1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
561
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
562 buf = g_strdup_printf("%s\001%s", ycht->room, msg2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
563 ycht_packet_append(pkt, buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
564 g_free(msg2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
565 g_free(buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
566
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
567 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
568 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
569 return 1;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
570 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
571
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
572 void ycht_chat_leave(YchtConn *ycht, const char *room, gboolean logout)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
573 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
574 if (logout)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
575 ycht_connection_close(ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
576 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
577
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
578 void ycht_chat_send_invite(YchtConn *ycht, const char *room, const char *buddy, const char *msg)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
579 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
580 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
581
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
582 void ycht_chat_goto_user(YchtConn *ycht, const char *name)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
583 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
584 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
585
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
586 void ycht_chat_send_keepalive(YchtConn *ycht)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
587 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
588 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
589
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
590 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_PING, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
591 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
592 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
593 }