annotate src/protocols/yahoo/ycht.c @ 10126:3c3795562256

[gaim-migrate @ 11163] this fixes yahoo's emblems some, but the priorities are still fscked or something, bleeter appears offline because a higher priority version of himself is offline... committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 19 Oct 2004 05:17:14 +0000
parents c28d5b45624e
children a8f9e5ce4f92
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"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
40 #include "ycht.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
41 #include "yahoochat.h"
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
42
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 * dword: YCHT
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
45 * dword: 0x000000AE
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
46 * dword: service
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
47 * word: status
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
48 * word: size
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
49 */
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
50 #define YAHOO_CHAT_ID (1)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
51 /************************************************************************************
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
52 * Functions to process various kinds of packets.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
53 ************************************************************************************/
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
54 static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
55 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
56 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
57 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
58
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
59 if (ycht->logged_in)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
60 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
61
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
62 yd->chat_online = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
63 ycht->logged_in = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
64
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
65 if (ycht->room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
66 ycht_chat_join(ycht, ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
67 }
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 static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
70 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
71 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
72 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
73
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
74 yd->chat_online = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
75 ycht->logged_in = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
76 }
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 static void ycht_process_chatjoin(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
79 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
80 char *room, *topic;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
81 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
82 GaimConversation *c = NULL;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
83 gboolean new_room = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
84 char **members;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
85 int i;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
86
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
87 room = g_list_nth_data(pkt->data, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
88 topic = g_list_nth_data(pkt->data, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
89 if (!g_list_nth_data(pkt->data, 4))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
90 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
91 if (!room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
92 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
93
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
94 members = g_strsplit(g_list_nth_data(pkt->data, 4), "\001", 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
95 for (i = 0; members[i]; i++) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
96 char *tmp = strchr(members[i], '\002');
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
97 if (tmp)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
98 *tmp = '\0';
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
99 }
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 if (g_list_length(pkt->data) > 5)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
103 new_room = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
104
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
105 if (new_room && ycht->changing_rooms) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
106 serv_got_chat_left(gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
107 ycht->changing_rooms = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
108 c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
109 } else {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
110 c = gaim_find_chat(gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
111 }
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 if (topic)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
115 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
116
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
117 for (i = 0; members[i]; i++) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
118 if (new_room) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
119 /*if (!strcmp(members[i], gaim_connection_get_display_name(ycht->gc)))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
120 continue;*/
9846
c28d5b45624e [gaim-migrate @ 10724]
Mark Doliner <mark@kingant.net>
parents: 9554
diff changeset
121 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
122 } else {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
123 yahoo_chat_add_user(GAIM_CONV_CHAT(c), members[i], NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
124 }
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 g_strfreev(members);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
128 }
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 static void ycht_process_chatpart(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
131 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
132 char *room, *who;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
133
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
134 room = g_list_nth_data(pkt->data, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
135 who = g_list_nth_data(pkt->data, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
136
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
137 if (who && room) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
138 GaimConversation *c = gaim_find_chat(ycht->gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
139 if (c && !gaim_utf8_strcasecmp(gaim_conversation_get_name(c), room))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
140 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), who, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
141
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 static void ycht_progress_chatmsg(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
146 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
147 char *who, *what, *msg;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
148 GaimConversation *c;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
149 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
150
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
151 who = g_list_nth_data(pkt->data, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
152 what = g_list_nth_data(pkt->data, 2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
153
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
154 if (!who || !what)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
155 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
156
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
157 c = gaim_find_chat(gc, YAHOO_CHAT_ID);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
158 if (!c)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
159 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
160
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
161 msg = yahoo_string_decode(gc, what, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
162 what = yahoo_codes_to_html(msg);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
163 g_free(msg);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
164
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
165 if (pkt->service == YCHT_SERVICE_CHATMSG_EMOTE) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
166 char *tmp = g_strdup_printf("/me %s", what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
167 g_free(what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
168 what = tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
169 }
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 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
172 g_free(what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
173 }
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 static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
176 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
177 #if 0
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
178 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
179 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
180
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
181 if (ycht->logged_in)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
182 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
183
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
184 yd->chat_online = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
185 ycht->logged_in = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
186
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
187 if (ycht->room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
188 ycht_chat_join(ycht, ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
189 #endif
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
190 }
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 * Functions dealing with YCHT packets and their contents directly.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
194 *****************************************************************************/
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
195 static void ycht_packet_dump(const char *data, int len)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
196 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
197 #ifdef YAHOO_YCHT_DEBUG
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
198 int i;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
199
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
200 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
201
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
202 for (i = 0; i + 1 < len; i += 2) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
203 if ((i % 16 == 0) && i) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
204 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
205 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
206 }
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 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
209 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
210 if (i < len)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
211 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx", data[i]);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
212
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
213 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
214 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
215
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
216 for (i = 0; i < len; i++) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
217 if ((i % 16 == 0) && i) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
218 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
219 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
220 }
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 if (g_ascii_isprint(data[i]))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
223 gaim_debug(GAIM_DEBUG_MISC, NULL, "%c ", data[i]);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
224 else
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
225 gaim_debug(GAIM_DEBUG_MISC, NULL, ". ");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
226 }
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 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
229 #endif
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
230 }
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 static YchtPkt *ycht_packet_new(guint version, guint service, int status)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
233 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
234 YchtPkt *ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
235
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
236 ret = g_new0(YchtPkt, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
237
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
238 ret->version = version;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
239 ret->service = service;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
240 ret->status = status;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
241
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
242 return ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
243 }
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 static void ycht_packet_append(YchtPkt *pkt, const char *str)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
246 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
247 g_return_if_fail(pkt != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
248 g_return_if_fail(str != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
249
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
250 pkt->data = g_list_append(pkt->data, g_strdup(str));
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
251 }
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 static int ycht_packet_length(YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
254 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
255 int ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
256 GList *l;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
257
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
258 ret = YCHT_HEADER_LEN;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
259
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
260 for (l = pkt->data; l; l = l->next) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
261 ret += strlen(l->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
262 if (l->next)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
263 ret += strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
264 }
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 return ret;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
267 }
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 static void ycht_packet_send(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
270 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
271 int len, pos;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
272 char *buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
273 GList *l;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
274
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
275 g_return_if_fail(ycht != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
276 g_return_if_fail(pkt != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
277 g_return_if_fail(ycht->fd != -1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
278
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
279 pos = 0;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
280 len = ycht_packet_length(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
281 buf = g_malloc(len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
282
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
283 memcpy(buf + pos, "YCHT", 4); pos += 4;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
284 pos += yahoo_put32(buf + pos, pkt->version);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
285 pos += yahoo_put32(buf + pos, pkt->service);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
286 pos += yahoo_put16(buf + pos, pkt->status);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
287 pos += yahoo_put16(buf + pos, len - YCHT_HEADER_LEN);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
288
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
289 for (l = pkt->data; l; l = l->next) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
290 int slen = strlen(l->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
291 memcpy(buf + pos, l->data, slen); pos += slen;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
292
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
293 if (l->next) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
294 memcpy(buf + pos, YCHT_SEP, strlen(YCHT_SEP));
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
295 pos += strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
296 }
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 write(ycht->fd, buf, len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
300 g_free(buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
301 }
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 static void ycht_packet_read(YchtPkt *pkt, const char *buf, int len)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
304 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
305 const char *pos = buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
306 const char *needle;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
307 char *tmp, *tmp2;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
308 int i = 0;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
309
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
310 while (len > 0 && (needle = g_strstr_len(pos, len, YCHT_SEP))) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
311 tmp = g_strndup(pos, needle - pos);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
312 pkt->data = g_list_append(pkt->data, tmp);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
313 len -= needle - pos + strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
314 pos = needle + strlen(YCHT_SEP);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
315 tmp2 = g_strescape(tmp, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
316 gaim_debug_misc("yahoo", "Data[%d]:\t%s\n", i++, tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
317 g_free(tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
318 }
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 if (len) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
321 tmp = g_strndup(pos, len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
322 pkt->data = g_list_append(pkt->data, tmp);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
323 tmp2 = g_strescape(tmp, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
324 gaim_debug_misc("yahoo", "Data[%d]:\t%s\n", i, tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
325 g_free(tmp2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
326 };
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 gaim_debug_misc("yahoo", "--==End of incoming YCHT packet==--\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
329 }
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 static void ycht_packet_process(YchtConn *ycht, YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
332 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
333 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
334 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
335
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
336 switch (pkt->service) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
337 case YCHT_SERVICE_LOGIN:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
338 ycht_process_login(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
339 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
340 case YCHT_SERVICE_LOGOUT:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
341 ycht_process_logout(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
342 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
343 case YCHT_SERVICE_CHATJOIN:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
344 ycht_process_chatjoin(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
345 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
346 case YCHT_SERVICE_CHATPART:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
347 ycht_process_chatpart(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
348 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
349 case YCHT_SERVICE_CHATMSG:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
350 case YCHT_SERVICE_CHATMSG_EMOTE:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
351 ycht_progress_chatmsg(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
352 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
353 case YCHT_SERVICE_ONLINE_FRIENDS:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
354 ycht_progress_online_friends(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
355 break;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
356 default:
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
357 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
358 }
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 static void ycht_packet_free(YchtPkt *pkt)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
362 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
363 GList *l;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
364
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
365 g_return_if_fail(pkt != NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
366
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
367 for (l = pkt->data; l; l = l->next)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
368 g_free(l->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
369 g_list_free(pkt->data);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
370 g_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
371 }
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 * Functions dealing with connecting and disconnecting and reading data into YchtPkt
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
375 * structs, and all that stuff.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
376 ************************************************************************************/
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 void ycht_connection_close(YchtConn *ycht)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
379 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
380 struct yahoo_data *yd = ycht->gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
381
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
382 if (yd) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
383 yd->ycht = NULL;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
384 yd->chat_online = FALSE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
385 }
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 if (ycht->fd > 0)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
388 close(ycht->fd);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
389 if (ycht->inpa)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
390 gaim_input_remove(ycht->inpa);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
391
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
392 if (ycht->rxqueue)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
393 g_free(ycht->rxqueue);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
394
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
395 g_free(ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
396 }
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 static void ycht_connection_error(YchtConn *ycht, const gchar *error)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
399 {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
400
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
401 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
402 ycht_connection_close(ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
403 }
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 static void ycht_pending(gpointer data, gint source, GaimInputCondition cond)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
406 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
407 YchtConn *ycht = data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
408 char buf[1024];
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
409 int len;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
410
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
411 len = read(ycht->fd, buf, sizeof(buf));
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
412
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
413 if (len <= 0) {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
414 ycht_connection_error(ycht, _("Unable to read"));
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
415 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
416 }
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 ycht->rxqueue = g_realloc(ycht->rxqueue, len + ycht->rxlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
419 memcpy(ycht->rxqueue + ycht->rxlen, buf, len);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
420 ycht->rxlen += len;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
421
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
422 while (1) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
423 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
424 int pos = 0;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
425 int pktlen;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
426 guint service;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
427 guint version;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
428 gint status;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
429
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
430 if (ycht->rxlen < YCHT_HEADER_LEN)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
431 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
432
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
433 if (strncmp("YCHT", ycht->rxqueue, 4) != 0)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
434 gaim_debug_error("yahoo", "YCHT: protocol error.\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
435
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
436 pos += 4; /* YCHT */
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
437
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
438 version = yahoo_get32(ycht->rxqueue + pos); pos += 4;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
439 service = yahoo_get32(ycht->rxqueue + pos); pos += 4;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
440 status = yahoo_get16(ycht->rxqueue + pos); pos += 2;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
441 pktlen = yahoo_get16(ycht->rxqueue + pos); pos += 2;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
442 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
443 "ycht: %d bytes to read, rxlen is %d\n", pktlen, ycht->rxlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
444
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
445 if (ycht->rxlen < (YCHT_HEADER_LEN + pktlen))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
446 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
447
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
448 gaim_debug_misc("yahoo", "--==Incoming YCHT packet==--\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
449 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
450 "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n",
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
451 service, version, status);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
452 ycht_packet_dump(ycht->rxqueue, YCHT_HEADER_LEN + pktlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
453
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
454 pkt = ycht_packet_new(version, service, status);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
455 ycht_packet_read(pkt, ycht->rxqueue + pos, pktlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
456
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
457 ycht->rxlen -= YCHT_HEADER_LEN + pktlen;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
458 if (ycht->rxlen) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
459 char *tmp = g_memdup(ycht->rxqueue + YCHT_HEADER_LEN + pktlen, ycht->rxlen);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
460 g_free(ycht->rxqueue);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
461 ycht->rxqueue = tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
462 } else {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
463 g_free(ycht->rxqueue);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
464 ycht->rxqueue = NULL;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
465 }
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 ycht_packet_process(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
468
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
469 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
470 }
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 static void ycht_got_connected(gpointer data, gint source, GaimInputCondition cond)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
474 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
475 YchtConn *ycht = data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
476 GaimConnection *gc = ycht->gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
477 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
478 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
479 char *buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
480
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
481 if (source < 0) {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
482 ycht_connection_error(ycht, _("Unable to connect."));
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
483 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
484 }
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 ycht->fd = source;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
487
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
488 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_LOGIN, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
489
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
490 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
491 ycht_packet_append(pkt, buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
492 g_free(buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
493
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
494 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
495
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
496 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
497
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
498 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
499 }
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 void ycht_connection_open(GaimConnection *gc)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
502 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
503 YchtConn *ycht;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
504 struct yahoo_data *yd = gc->proto_data;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
505 GaimAccount *account = gaim_connection_get_account(gc);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
506
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
507 ycht = g_new0(YchtConn, 1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
508 ycht->gc = gc;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
509 ycht->fd = -1;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
510
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
511 yd->ycht = ycht;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
512
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
513 if (gaim_proxy_connect(account,
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
514 gaim_account_get_string(account, "ycht-server", YAHOO_YCHT_HOST),
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
515 gaim_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT),
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
516 ycht_got_connected, ycht) != 0)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
517 {
9397
3b0c6255033e [gaim-migrate @ 10209]
Tim Ringenbach <marv@pidgin.im>
parents: 9376
diff changeset
518 ycht_connection_error(ycht, _("Connection problem"));
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
519 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
520 }
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 * These are functions called because the user did something.
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
525 *******************************************************************************************/
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 void ycht_chat_join(YchtConn *ycht, const char *room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
528 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
529 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
530 char *tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
531
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
532 tmp = g_strdup(room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
533 if (ycht->room)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
534 g_free(ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
535 ycht->room = tmp;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
536
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
537 if (!ycht->logged_in)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
538 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
539
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
540 ycht->changing_rooms = TRUE;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
541 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATJOIN, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
542 ycht_packet_append(pkt, ycht->room);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
543 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
544 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
545 }
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 int ycht_chat_send(YchtConn *ycht, const char *room, const char *what)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
548 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
549 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
550 char *msg1, *msg2, *buf;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
551
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
552 if (strcmp(room, ycht->room))
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
553 gaim_debug_warning("yahoo", "uhoh, sending to the wrong room!\n");
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
554
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
555 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATMSG, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
556
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
557 msg1 = yahoo_html_to_codes(what);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
558 msg2 = yahoo_string_encode(ycht->gc, msg1, NULL);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
559 g_free(msg1);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
560
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
561 buf = g_strdup_printf("%s\001%s", ycht->room, msg2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
562 ycht_packet_append(pkt, buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
563 g_free(msg2);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
564 g_free(buf);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
565
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
566 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
567 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
568 return 1;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
569 }
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 void ycht_chat_leave(YchtConn *ycht, const char *room, gboolean logout)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
572 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
573 if (logout)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
574 ycht_connection_close(ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
575 }
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 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
578 {
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 void ycht_chat_goto_user(YchtConn *ycht, const char *name)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
582 {
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 void ycht_chat_send_keepalive(YchtConn *ycht)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
586 {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
587 YchtPkt *pkt;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
588
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
589 pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_PING, 0);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
590 ycht_packet_send(ycht, pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
591 ycht_packet_free(pkt);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
592 }