Mercurial > pidgin.yaz
annotate plugins/irc.c @ 2074:a4367a6478eb
[gaim-migrate @ 2084]
Adam's patch to do the deny setting properly
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 17 Jul 2001 18:05:21 +0000 |
parents | 21f1f1e0d4c5 |
children |
rev | line source |
---|---|
987 | 1 /* |
2 * gaim - IRC Protocol Plugin | |
3 * | |
1672 | 4 * Copyright (C) 2000-2001, Rob Flynn <rob@tgflinux.com> |
987 | 5 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
22 | |
23 #include "../config.h" | |
24 | |
25 | |
26 #include <netdb.h> | |
27 #include <gtk/gtk.h> | |
28 #include <unistd.h> | |
29 #include <errno.h> | |
30 #include <netinet/in.h> | |
31 #include <arpa/inet.h> | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
32 #include <fcntl.h> |
987 | 33 #include <string.h> |
34 #include <stdlib.h> | |
35 #include <stdio.h> | |
36 #include <time.h> | |
37 #include <sys/socket.h> | |
38 #include <sys/stat.h> | |
1864
5cb89cf24f45
[gaim-migrate @ 1874]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1848
diff
changeset
|
39 #include <ctype.h> |
987 | 40 #include "multi.h" |
41 #include "prpl.h" | |
42 #include "gaim.h" | |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
43 #include "proxy.h" |
987 | 44 |
1178 | 45 #include "pixmaps/free_icon.xpm" |
46 | |
1011 | 47 #define IRC_BUF_LEN 4096 |
48 | |
1022 | 49 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
50 #define USEROPT_SERV 0 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
51 #define USEROPT_PORT 1 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
52 |
1011 | 53 static int chat_id = 0; |
54 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
55 struct irc_channel { |
1011 | 56 int id; |
57 gchar *name; | |
58 }; | |
59 | |
60 struct irc_data { | |
61 int fd; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
62 int inpa; /* used for non-block logins */ |
1011 | 63 |
1022 | 64 int timer; |
65 | |
66 int totalblocks; | |
67 int recblocks; | |
68 | |
69 GSList *templist; | |
1011 | 70 GList *channels; |
71 }; | |
72 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
73 static char *irc_name() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
74 { |
1008 | 75 return "IRC"; |
76 } | |
77 | |
1675 | 78 static void irc_get_info(struct gaim_connection *gc, char *who); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
79 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
80 char *name() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
81 { |
1008 | 82 return "IRC"; |
83 } | |
84 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
85 char *description() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
86 { |
1008 | 87 return "Allows gaim to use the IRC protocol"; |
88 } | |
89 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
90 static void irc_join_chat(struct gaim_connection *gc, int id, char *name) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
91 { |
1011 | 92 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
93 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 94 |
95 g_snprintf(buf, IRC_BUF_LEN, "JOIN %s\n", name); | |
96 write(idata->fd, buf, strlen(buf)); | |
1742 | 97 write(idata->fd, buf, strlen(buf)); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
98 |
1011 | 99 g_free(buf); |
100 } | |
101 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
102 static void irc_update_user(struct gaim_connection *gc, char *name, int status) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
103 { |
1022 | 104 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
105 struct irc_channel *u; | |
106 GSList *temp = idata->templist; | |
107 | |
108 /* Loop through our list */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
109 |
1022 | 110 while (temp) { |
111 u = (struct irc_channel *)temp->data; | |
112 if (g_strcasecmp(u->name, name) == 0) { | |
113 u->id = status; | |
114 return; | |
115 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
116 |
1022 | 117 temp = g_slist_next(temp); |
118 } | |
119 return; | |
120 } | |
121 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
122 static void irc_request_buddy_update(struct gaim_connection *gc) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
123 { |
1022 | 124 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1046
4593605da0e2
[gaim-migrate @ 1056]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1022
diff
changeset
|
125 GSList *grp = gc->groups; |
4593605da0e2
[gaim-migrate @ 1056]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1022
diff
changeset
|
126 GSList *person; |
1022 | 127 struct group *g; |
128 struct buddy *b; | |
129 struct irc_channel *u; | |
130 | |
131 if (idata->templist != NULL) | |
132 return; | |
133 | |
134 idata->recblocks = 0; | |
135 idata->totalblocks = 1; | |
136 | |
1105 | 137 /* First, let's check to see if we have anyone on our buddylist */ |
138 if (!grp) { | |
139 return; | |
140 } | |
141 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
142 /* Send the first part of our request */ |
1022 | 143 write(idata->fd, "ISON", 4); |
144 | |
145 /* Step through our list of groups */ | |
146 while (grp) { | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
147 |
1022 | 148 g = (struct group *)grp->data; |
149 person = g->members; | |
150 | |
151 while (person) { | |
152 b = (struct buddy *)person->data; | |
153 | |
154 /* We will store our buddy info here. I know, this is cheap | |
155 * but hey, its the exact same data structure. Why should we | |
156 * bother with making another one */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
157 |
1022 | 158 u = g_new0(struct irc_channel, 1); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
159 u->id = 0; /* Assume by default that they're offline */ |
1022 | 160 u->name = strdup(b->name); |
161 | |
162 write(idata->fd, " ", 1); | |
163 write(idata->fd, u->name, strlen(u->name)); | |
164 idata->templist = g_slist_append(idata->templist, u); | |
165 | |
166 person = person->next; | |
167 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
168 |
1022 | 169 grp = g_slist_next(grp); |
170 } | |
171 write(idata->fd, "\n", 1); | |
172 } | |
173 | |
174 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
175 static void irc_send_im(struct gaim_connection *gc, char *who, char *message, int away) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
176 { |
1011 | 177 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
178 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
179 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 180 |
1847 | 181 if (who[0] == '@' || who[0] == '+') { |
182 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
183 /* If the user trys to msg an op or a voice from the channel, the convo will try |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
184 * to send it to @nick or +nick... needless to say, this is undesirable. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
185 */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
186 who++; |
1847 | 187 } |
188 | |
1011 | 189 /* Before we actually send this, we should check to see if they're trying |
1674 | 190 * To issue a command and handle it properly. */ |
1011 | 191 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
192 if (message[0] == '/') { |
1674 | 193 /* I'll change the implementation of this a little later :-) */ |
194 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) { | |
195 /* We have /me!! We have /me!! :-) */ | |
1011 | 196 |
1674 | 197 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
198 strcpy(temp, message + 4); | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
199 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%cACTION %s%c\n", who, '\001', temp, |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
200 '\001'); |
1674 | 201 g_free(temp); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
202 } else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) { |
1675 | 203 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
204 strcpy(temp, message + 7); | |
205 irc_get_info(gc, temp); | |
206 g_free(temp); | |
207 | |
208 return; | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
209 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
210 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
211 } else { |
1011 | 212 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%s\n", who, message); |
213 } | |
214 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
215 write(idata->fd, buf, strlen(buf)); |
1011 | 216 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
217 g_free(buf); |
1011 | 218 } |
219 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
220 static int find_id_by_name(struct gaim_connection *gc, char *name) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
221 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
222 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 223 GList *templist; |
224 struct irc_channel *channel; | |
225 | |
226 templist = ((struct irc_data *)gc->proto_data)->channels; | |
227 | |
228 while (templist) { | |
229 channel = (struct irc_channel *)templist->data; | |
230 | |
231 g_snprintf(temp, IRC_BUF_LEN, "#%s", channel->name); | |
232 | |
233 if (g_strcasecmp(temp, name) == 0) { | |
234 g_free(temp); | |
235 return channel->id; | |
236 } | |
237 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
238 templist = templist->next; |
1011 | 239 } |
240 | |
241 g_free(temp); | |
242 | |
243 /* Return -1 if we have no ID */ | |
244 return -1; | |
245 } | |
246 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
247 static struct irc_channel *find_channel_by_name(struct gaim_connection *gc, char *name) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
248 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
249 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 250 GList *templist; |
251 struct irc_channel *channel; | |
252 | |
253 templist = ((struct irc_data *)gc->proto_data)->channels; | |
254 | |
255 while (templist) { | |
256 channel = (struct irc_channel *)templist->data; | |
257 | |
258 g_snprintf(temp, IRC_BUF_LEN, "%s", channel->name); | |
259 | |
260 if (g_strcasecmp(temp, name) == 0) { | |
261 g_free(temp); | |
262 return channel; | |
263 } | |
264 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
265 templist = templist->next; |
1011 | 266 } |
267 | |
268 g_free(temp); | |
269 | |
270 /* If we found nothing, return nothing :-) */ | |
271 return NULL; | |
272 } | |
273 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
274 static struct irc_channel *find_channel_by_id(struct gaim_connection *gc, int id) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
275 { |
1011 | 276 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
277 struct irc_channel *channel; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
278 |
1011 | 279 GList *temp; |
280 | |
281 temp = idata->channels; | |
282 | |
283 while (temp) { | |
284 channel = (struct irc_channel *)temp->data; | |
285 | |
286 if (channel->id == id) { | |
287 /* We've found our man */ | |
288 return channel; | |
289 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
290 |
1011 | 291 temp = temp->next; |
292 } | |
293 | |
294 | |
295 /* If we didnt find one, return NULL */ | |
296 return NULL; | |
297 } | |
298 | |
1958 | 299 static struct conversation *find_chat(struct gaim_connection *gc, char *name) |
300 { | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
301 GSList *bcs = gc->buddy_chats; |
1958 | 302 struct conversation *b = NULL; |
303 char *chat = g_strdup(normalize(name)); | |
304 | |
305 while (bcs) { | |
306 b = bcs->data; | |
307 if (!strcasecmp(normalize(b->name), chat)) | |
308 break; | |
309 b = NULL; | |
310 bcs = bcs->next; | |
311 } | |
312 | |
313 g_free(chat); | |
314 return b; | |
315 } | |
316 | |
1847 | 317 static void irc_chat_leave(struct gaim_connection *gc, int id); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
318 static void irc_chat_send(struct gaim_connection *gc, int id, char *message) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
319 { |
1011 | 320 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
321 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1021 | 322 struct irc_channel *channel = NULL; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
323 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
324 char **kick; |
1742 | 325 gboolean is_command = FALSE; |
1011 | 326 /* First lets get our current channel */ |
327 channel = find_channel_by_id(gc, id); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
328 |
1011 | 329 |
330 if (!channel) { | |
331 /* If for some reason we've lost our channel, let's bolt */ | |
1021 | 332 g_free(buf); |
1011 | 333 return; |
334 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
335 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
336 |
1011 | 337 /* Before we actually send this, we should check to see if they're trying |
1675 | 338 * To issue a command and handle it properly. */ |
1011 | 339 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
340 if (message[0] == '/') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
341 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
342 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
343 /* We have /me!! We have /me!! :-) */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
344 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
345 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
346 strcpy(temp, message + 4); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
347 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
348 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%cACTION %s%c\n", channel->name, |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
349 '\001', temp, '\001'); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
350 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
351 } else if ((g_strncasecmp(message, "/op ", 4) == 0) && (strlen(message) > 4)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
352 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
353 strcpy(temp, message + 4); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
354 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
355 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s +o %s\n", channel->name, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
356 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
357 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
358 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
359 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
360 } else if ((g_strncasecmp(message, "/deop ", 6) == 0) && (strlen(message) > 6)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
361 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
362 strcpy(temp, message + 6); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
363 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s -o %s\n", channel->name, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
364 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
365 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
366 is_command = TRUE; |
1675 | 367 } |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
368 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
369 else if ((g_strncasecmp(message, "/voice ", 7) == 0) && (strlen(message) > 7)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
370 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
371 strcpy(temp, message + 7); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
372 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
373 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s +v %s\n", channel->name, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
374 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
375 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
376 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
377 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
378 } else if ((g_strncasecmp(message, "/devoice ", 9) == 0) && (strlen(message) > 9)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
379 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
380 strcpy(temp, message + 6); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
381 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s -v %s\n", channel->name, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
382 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
383 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
384 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
385 } else if ((g_strncasecmp(message, "/mode ", 6) == 0) && (strlen(message) > 6)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
386 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
387 strcpy(temp, message + 6); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
388 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s %s\n", channel->name, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
389 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
390 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
391 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
392 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
393 else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
394 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
395 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
396 strcpy(temp, message + 7); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
397 irc_get_info(gc, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
398 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
399 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
400 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
401 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
402 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
403 else if (!g_strncasecmp(message, "/topic ", 7) && (strlen(message) > 7)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
404 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1958 | 405 strcpy(temp, message + 7); |
406 | |
407 /* Send the chat topic change request */ | |
408 serv_chat_set_topic(gc, id, temp); | |
409 | |
410 g_free(temp); | |
411 is_command = TRUE; | |
412 } | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
413 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
414 else if (!g_strncasecmp(message, "/part", 5) && (strlen(message) == 5)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
415 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
416 /* If I'm not mistaken, the chat_leave command was coded under the |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
417 * pretense that it would only occur when someone closed the window. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
418 * For this reason, the /part command will not close the window. Nor |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
419 * will the window close when the user is /kicked. I'll let you decide |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
420 * the best way to fix it--I'd imagine it'd just be a little line like |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
421 * if (convo) close (convo), but I'll let you decide where to put it. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
422 */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
423 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
424 irc_chat_leave(gc, id); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
425 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
426 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
427 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
428 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
429 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
430 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
431 else if (!g_strncasecmp(message, "/join ", 6) && (strlen(message) > 6)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
432 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
433 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
434 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
435 strcpy(temp, message + 6); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
436 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
437 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
438 irc_join_chat(gc, 0, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
439 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
440 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
441 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
442 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
443 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
444 else if (!g_strncasecmp(message, "/raw ", 5) && (strlen(message) > 5)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
445 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
446 strcpy(temp, message + 5); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
447 g_snprintf(buf, IRC_BUF_LEN, "%s\r\n", temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
448 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
449 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
450 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
451 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
452 else if (!g_strncasecmp(message, "/quote ", 7) && (strlen(message) > 7)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
453 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
454 strcpy(temp, message + 7); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
455 g_snprintf(buf, IRC_BUF_LEN, "%s\r\n", temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
456 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
457 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
458 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
459 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
460 else if (!g_strncasecmp(message, "/kick ", 6) && (strlen(message) > 6)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
461 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
462 strcpy(temp, message + 6); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
463 kick = g_strsplit(temp, " ", 2); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
464 g_snprintf(buf, IRC_BUF_LEN, "KICK #%s %s :%s\r\n", channel->name, kick[0], |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
465 kick[1]); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
466 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
467 is_command = TRUE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
468 } |
1742 | 469 |
470 /* FIXME: I'll go back in and grab this later. -- Rob */ | |
471 /* | |
472 I THOUGHT THIS WOULD WORK, BUT I WAS WRONG. WOULD SOMEONE KINDLY FIX IT? | |
1675 | 473 |
1742 | 474 |
475 else if (!g_strncasecmp(message, "/help", 5)) { | |
476 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
477 strcpy(temp, message + 5); | |
478 if (temp == "") { | |
479 | |
480 serv_got_chat_in(gc, id, "gAIM", 0, "Available Commands:"); | |
481 serv_got_chat_in(gc, id, "gAIM", 0, " "); | |
482 serv_got_chat_in(gc, id, "gAIM", 0, "<b>op voice kick </b>"); | |
483 serv_got_chat_in(gc, id, "gAIM", 0, "<b>deop devoice whois</b>"); | |
484 serv_got_chat_in(gc, id, "gAIM", 0, "<b>me raw quote</b>"); | |
485 serv_got_chat_in(gc, id, "gAIM", 0, "<b>mode</b>"); | |
486 } | |
487 else { | |
488 serv_got_chat_in(gc, id, "gAIM", 0, "Usage: "); | |
489 if (temp == "op") | |
490 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/op <nick></b> - Gives operator status to user."); | |
491 else if (temp == "deop") | |
492 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/deop <nick></b> - Removes operator status from user."); | |
493 else if (temp == "me") | |
494 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/me <action></b> - Sends an action to the channel."); | |
495 else if (temp == "mode") | |
496 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/mode {[+|-}|o|p|s|i|t|n|b|v} [<limit][<nick>][<ban mask]</b> - Changes channel and user modes."); | |
497 else if (temp == "voice") | |
498 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/voice <nick></b> - Gives voice status to user."); | |
499 else if (temp == "devoice") | |
500 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/devoice <nick></b> - Removes voice status from user."); | |
501 else if (temp == "raw") | |
502 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/raw <text></b> - Sends raw text to the server."); | |
503 else if (temp == "kick") | |
504 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/kick [<comment>]</b> - Kicks a user out of the channel."); | |
505 else if (temp == "whois") | |
506 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/whois <nick></b> - Gets information about user."); | |
507 else if (temp == "quote") | |
508 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/raw <text></b> - Sends raw text to the server."); | |
509 else | |
510 serv_got_chat_in(gc, id, "gAIM", 0, "No such command."); | |
511 } | |
512 | |
513 g_free(temp); | |
514 is_command = TRUE; | |
515 } | |
516 */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
517 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
518 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
519 |
1675 | 520 else { |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
521 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%s\n", channel->name, message); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
522 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
523 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
524 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
525 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
526 write(idata->fd, buf, strlen(buf)); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
527 |
1011 | 528 /* Since AIM expects us to receive the message we send, we gotta fake it */ |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
529 if (is_command == FALSE) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
530 serv_got_chat_in(gc, id, gc->username, 0, message, time((time_t) NULL)); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
531 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
532 g_free(buf); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
533 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
534 |
1008 | 535 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
536 static struct conversation *find_conversation_by_id(struct gaim_connection *gc, int id) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
537 { |
1014 | 538 GSList *bc = gc->buddy_chats; |
539 struct conversation *b = NULL; | |
540 | |
541 while (bc) { | |
542 b = (struct conversation *)bc->data; | |
543 if (id == b->id) { | |
544 break; | |
545 } | |
546 bc = bc->next; | |
547 b = NULL; | |
548 } | |
549 | |
550 if (!b) { | |
551 return NULL; | |
552 } | |
553 | |
554 return b; | |
555 } | |
556 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
557 static struct conversation *find_conversation_by_name(struct gaim_connection *gc, char *name) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
558 { |
1014 | 559 GSList *bc = gc->buddy_chats; |
560 struct conversation *b = NULL; | |
561 | |
562 while (bc) { | |
563 b = (struct conversation *)bc->data; | |
564 | |
565 if (g_strcasecmp(name, b->name) == 0) { | |
566 break; | |
567 } | |
568 bc = bc->next; | |
569 b = NULL; | |
570 } | |
571 | |
572 if (!b) { | |
573 return NULL; | |
574 } | |
575 | |
576 return b; | |
577 } | |
578 | |
579 | |
580 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
581 static void irc_callback(gpointer data, gint source, GdkInputCondition condition) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
582 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
583 struct gaim_connection *gc = data; |
1011 | 584 int i = 0; |
585 gchar buf[4096]; | |
586 gchar **buf2; | |
587 struct irc_data *idata; | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
588 |
1742 | 589 idata = (struct irc_data *)gc->proto_data; |
1011 | 590 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
591 |
1011 | 592 do { |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
593 if (read(idata->fd, buf + i, 1) < 0) { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
594 hide_login_progress(gc, "Read error"); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
595 signoff(gc); |
1105 | 596 return; |
1011 | 597 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
598 } while (buf[i++] != '\n'); |
1011 | 599 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
600 buf[--i] = '\0'; |
1301 | 601 g_strchomp(buf); |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
602 g_print("%s\n", buf); |
1105 | 603 |
604 /* Check for errors */ | |
605 | |
606 if (((strstr(buf, "ERROR :") && (!strstr(buf, "PRIVMSG ")) && | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
607 (!strstr(buf, "NOTICE ")) && (strlen(buf) > 7)))) { |
1105 | 608 |
609 gchar *u_errormsg; | |
610 | |
611 /* Let's get our error message */ | |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
612 u_errormsg = g_strdup(buf + 7); |
1105 | 613 |
614 /* We got our error message. Now, let's reaise an | |
615 * error dialog */ | |
616 | |
617 do_error_dialog(u_errormsg, "Gaim: IRC Error"); | |
618 | |
619 /* And our necessary garbage collection */ | |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
620 g_free(u_errormsg); |
1847 | 621 return; |
1105 | 622 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
623 |
1673 | 624 /* This should be a whois response. I only care about the first (311) one. I might do |
625 * the other's later. They're boring. */ | |
626 | |
627 if (((strstr(buf, " 311 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { | |
628 char **res; | |
629 | |
630 res = g_strsplit(buf, " ", 7); | |
631 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
632 if (!strcmp(res[1], "311")) { |
1673 | 633 char buf[8192]; |
634 | |
635 g_snprintf(buf, 4096, "<b>Nick:</b> %s<br>" | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
636 "<b>Host:</b> %s@%s<br>" |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
637 "<b>Name:</b> %s<br>", res[3], res[4], res[5], res[7] + 1); |
1673 | 638 |
639 g_show_info_text(buf); | |
640 } | |
641 | |
642 g_strfreev(res); | |
1847 | 643 return; |
1673 | 644 } |
645 | |
1676 | 646 /* Autoresponse to an away message */ |
647 if (((strstr(buf, " 301 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { | |
648 char **res; | |
649 | |
650 res = g_strsplit(buf, " ", 5); | |
651 | |
652 if (!strcmp(res[1], "301")) | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
653 serv_got_im(gc, res[3], res[4] + 1, 1, time((time_t) NULL)); |
1676 | 654 |
655 g_strfreev(res); | |
1847 | 656 return; |
1676 | 657 } |
658 | |
1014 | 659 /* Parse the list of names that we receive when we first sign on to |
660 * a channel */ | |
661 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
662 if (((strstr(buf, " 353 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { |
1014 | 663 gchar u_host[255]; |
664 gchar u_command[32]; | |
665 gchar u_channel[128]; | |
666 gchar u_names[IRC_BUF_LEN + 1]; | |
667 struct conversation *convo = NULL; | |
668 int j; | |
669 | |
670 for (j = 0, i = 0; buf[i] != ' '; j++, i++) { | |
671 u_host[j] = buf[i]; | |
672 } | |
673 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
674 u_host[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
675 i++; |
1014 | 676 |
677 for (j = 0; buf[i] != ' '; j++, i++) { | |
678 u_command[j] = buf[i]; | |
679 } | |
680 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
681 u_command[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
682 i++; |
1014 | 683 |
684 for (j = 0; buf[i] != '#'; j++, i++) { | |
685 } | |
686 i++; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
687 |
1014 | 688 for (j = 0; buf[i] != ':'; j++, i++) { |
689 u_channel[j] = buf[i]; | |
690 } | |
691 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
692 u_channel[j - 1] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
693 i++; |
1014 | 694 |
695 while ((buf[i] == ' ') || (buf[i] == ':')) { | |
696 i++; | |
697 } | |
698 | |
699 strcpy(u_names, buf + i); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
700 |
1014 | 701 buf2 = g_strsplit(u_names, " ", 0); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
702 |
1014 | 703 /* Let's get our conversation window */ |
704 convo = find_conversation_by_name(gc, u_channel); | |
705 | |
706 if (!convo) { | |
707 return; | |
708 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
709 |
1014 | 710 /* Now that we've parsed the hell out of this big |
711 * mess, let's try to split up the names properly */ | |
712 | |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
713 for (i = 0; buf2[i] != NULL; i++) |
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
714 add_chat_buddy(convo, buf2[i]); |
1021 | 715 |
716 /* And free our pointers */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
717 g_strfreev(buf2); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
718 |
1014 | 719 return; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
720 |
1014 | 721 } |
722 | |
1022 | 723 /* Receive a list of users that are currently online */ |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
724 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
725 if (((strstr(buf, " 303 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { |
1022 | 726 gchar u_host[255]; |
727 gchar u_command[32]; | |
728 gchar u_names[IRC_BUF_LEN + 1]; | |
729 int j; | |
730 | |
731 for (j = 0, i = 0; buf[i] != ' '; j++, i++) { | |
732 u_host[j] = buf[i]; | |
733 } | |
734 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
735 u_host[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
736 i++; |
1022 | 737 |
738 for (j = 0; buf[i] != ' '; j++, i++) { | |
739 u_command[j] = buf[i]; | |
740 } | |
741 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
742 u_command[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
743 i++; |
1022 | 744 |
745 for (j = 0; buf[i] != ':'; j++, i++) { | |
746 /* My Nick */ | |
747 } | |
748 i++; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
749 |
1022 | 750 strcpy(u_names, buf + i); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
751 |
1022 | 752 buf2 = g_strsplit(u_names, " ", 0); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
753 |
1022 | 754 /* Now that we've parsed the hell out of this big |
755 * mess, let's try to split up the names properly */ | |
756 | |
757 for (i = 0; buf2[i] != NULL; i++) { | |
758 /* If we have a name here then our buddy is online. We should | |
759 * update our temporary gslist accordingly. When we achieve our maximum | |
760 * list of names then we should force an update */ | |
761 | |
762 irc_update_user(gc, buf2[i], 1); | |
763 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
764 |
1022 | 765 /* Increase our received blocks counter */ |
766 idata->recblocks++; | |
767 | |
768 /* If we have our total number of blocks */ | |
769 if (idata->recblocks == idata->totalblocks) { | |
770 GSList *temp; | |
771 struct irc_channel *u; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
772 |
1022 | 773 /* Let's grab our list of people and bring them all on or off line */ |
774 temp = idata->templist; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
775 |
1022 | 776 /* Loop */ |
777 while (temp) { | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
778 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
779 u = temp->data; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
780 |
1022 | 781 /* Tell Gaim to bring the person on or off line */ |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
782 serv_got_update(gc, u->name, u->id, 0, 0, 0, 0, 0); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
783 |
1022 | 784 /* Grab the next entry */ |
785 temp = g_slist_next(temp); | |
786 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
787 |
1022 | 788 /* And now, let's delete all of our entries */ |
789 temp = idata->templist; | |
790 while (temp) { | |
791 u = temp->data; | |
792 g_free(u->name); | |
793 temp = g_slist_remove(temp, u); | |
794 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
795 |
1022 | 796 /* Reset our list */ |
797 idata->totalblocks = 0; | |
798 idata->recblocks = 0; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
799 |
1022 | 800 idata->templist = NULL; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
801 |
1022 | 802 return; |
803 } | |
804 | |
805 /* And free our pointers */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
806 g_strfreev(buf2); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
807 |
1022 | 808 return; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
809 |
1022 | 810 } |
811 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
812 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
813 if ((strstr(buf, " MODE ")) && (strstr(buf, "!")) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
814 && (strstr(buf, "+v") || strstr(buf, "-v") || strstr(buf, "-o") || strstr(buf, "+o")) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
815 && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
816 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
817 gchar u_channel[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
818 gchar u_nick[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
819 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
820 gchar u_mode[5]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
821 char **people; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
822 gchar *temp, *temp_new; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
823 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
824 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
825 struct irc_channel *channel; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
826 int j; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
827 temp = NULL; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
828 temp_new = NULL; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
829 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
830 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
831 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
832 u_nick[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
833 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
834 u_nick[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
835 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
836 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
837 for (j = 0; buf[i] != '#'; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
838 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
839 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
840 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
841 for (j = 0; buf[i] != ' '; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
842 u_channel[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
843 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
844 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
845 u_channel[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
846 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
847 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
848 for (j = 0; buf[i] != ' '; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
849 u_mode[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
850 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
851 u_mode[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
852 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
853 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
854 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
855 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
856 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
857 people = g_strsplit(buf + i, " ", 3); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
858 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
859 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
860 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
861 channel = find_channel_by_name(gc, u_channel); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
862 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
863 if (!channel) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
864 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
865 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
866 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
867 for (j = 0; j < strlen(u_mode) - 1; j++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
868 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
869 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
870 struct conversation *convo = NULL; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
871 convo = find_conversation_by_id(gc, channel->id); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
872 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
873 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
874 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
875 temp = (gchar *) g_malloc(strlen(people[j]) + 3); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
876 temp_new = (gchar *) g_malloc(strlen(people[j]) + 3); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
877 g_snprintf(temp, strlen(people[j]) + 2, "@%s", people[j]); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
878 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
879 if (u_mode[1] == 'v' && u_mode[0] == '+') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
880 g_snprintf(temp_new, strlen(people[j]) + 2, "+%s", people[j]); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
881 } else if (u_mode[1] == 'o' && u_mode[0] == '+') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
882 g_snprintf(temp_new, strlen(people[j]) + 2, "@%s", people[j]); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
883 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
884 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
885 else if (u_mode[0] == '-') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
886 g_snprintf(temp_new, strlen(people[j]) + 1, "%s", people[j]); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
887 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
888 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
889 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
890 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
891 rename_chat_buddy(convo, temp, temp_new); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
892 g_snprintf(temp, strlen(people[j]) + 2, "+%s", people[j]); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
893 rename_chat_buddy(convo, temp, temp_new); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
894 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
895 rename_chat_buddy(convo, people[j], temp_new); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
896 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
897 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
898 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
899 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
900 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
901 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
902 if (temp) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
903 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
904 if (temp_new) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
905 g_free(temp_new); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
906 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
907 return; |
1847 | 908 } |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
909 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
910 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
911 if ((strstr(buf, " KICK ")) && (strstr(buf, "!")) && (buf[0] == ':') |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
912 && (!strstr(buf, " NOTICE "))) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
913 gchar u_channel[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
914 gchar u_nick[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
915 gchar u_comment[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
916 gchar u_who[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
917 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
918 int id; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
919 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
920 gchar *temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
921 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
922 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
923 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
924 struct irc_channel *channel; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
925 int j; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
926 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
927 temp = NULL; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
928 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
929 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
930 u_nick[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
931 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
932 u_nick[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
933 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
934 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
935 for (j = 0; buf[i] != '#'; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
936 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
937 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
938 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
939 for (j = 0; buf[i] != ' '; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
940 u_channel[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
941 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
942 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
943 u_channel[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
944 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
945 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
946 for (j = 0; buf[i] != ' '; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
947 u_who[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
948 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
949 u_who[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
950 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
951 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
952 strcpy(u_comment, buf + i); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
953 g_strchomp(u_comment); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
954 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
955 channel = find_channel_by_name(gc, u_channel); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
956 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
957 if (!channel) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
958 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
959 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
960 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
961 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
962 id = find_id_by_name(gc, u_channel); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
963 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
964 |
1847 | 965 if (g_strcasecmp(u_nick, gc->username) == 0) { |
966 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
967 /* It looks like you've been naughty! */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
968 |
1847 | 969 serv_got_chat_left(gc, channel->id); |
970 | |
971 idata->channels = g_list_remove(idata->channels, channel); | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
972 } else { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
973 struct conversation *convo = NULL; |
1847 | 974 |
975 /* Find their conversation window */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
976 convo = find_conversation_by_id(gc, channel->id); |
1847 | 977 |
978 if (!convo) { | |
979 /* Some how the window doesn't exist. | |
980 * Let's get out of here */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
981 return; |
1847 | 982 } |
983 | |
984 /* And remove their name */ | |
985 /* If the person is an op or voice, this won't work. | |
986 * so we'll just do a nice hack and remove nick and | |
987 * @nick and +nick. Truly wasteful. | |
988 */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
989 |
1848 | 990 temp = (gchar *) g_malloc(strlen(u_who) + 3); |
1847 | 991 g_snprintf(temp, strlen(u_who) + 2, "@%s", u_who); |
992 remove_chat_buddy(convo, temp); | |
1848 | 993 g_free(temp); |
994 temp = (gchar *) g_malloc(strlen(u_who) + 3); | |
1847 | 995 g_snprintf(temp, strlen(u_who) + 2, "+%s", u_who); |
996 remove_chat_buddy(convo, temp); | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
997 remove_chat_buddy(convo, u_who); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
998 |
1848 | 999 g_free(temp); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1000 |
1847 | 1001 } |
1002 | |
1003 /* Go Home! */ | |
1004 return; | |
1005 } | |
1006 | |
1958 | 1007 if ((strstr(buf, " TOPIC ")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) { |
1008 | |
1009 gchar u_channel[128]; | |
1010 gchar u_nick[128]; | |
1011 gchar u_topic[128]; | |
1012 int j; | |
1013 struct conversation *chatroom = NULL; | |
1014 | |
1015 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { | |
1016 u_nick[j] = buf[i]; | |
1017 } | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1018 u_nick[j] = 0; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1019 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1020 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1021 for (j = 0; buf[i] != '#'; j++, i++) { |
1958 | 1022 } |
1023 i++; | |
1024 | |
1025 for (j = 0; buf[i] != ' '; j++, i++) { | |
1026 if (buf[i] == '\0') | |
1027 break; | |
1028 | |
1029 u_channel[j] = buf[i]; | |
1030 } | |
1031 | |
1032 for (j = 0; buf[i] != ':'; j++, i++) { | |
1033 } | |
1034 i++; | |
1035 | |
1036 strcpy(u_topic, buf + i); | |
1037 g_strchomp(u_topic); | |
1038 | |
1039 chatroom = find_chat(gc, u_channel); | |
1040 | |
1041 if (!chatroom) | |
1042 return; | |
1043 | |
1044 chat_set_topic(chatroom, u_nick, u_topic); | |
1045 | |
1046 return; | |
1047 } | |
1048 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1049 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1050 if ((strstr(buf, " JOIN ")) && (strstr(buf, "!")) && (buf[0] == ':') |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1051 && (!strstr(buf, " NOTICE "))) { |
1011 | 1052 |
1053 gchar u_channel[128]; | |
1012 | 1054 gchar u_nick[128]; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1055 |
1011 | 1056 struct irc_channel *channel; |
1057 int j; | |
1058 | |
1012 | 1059 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
1060 u_nick[j] = buf[i]; | |
1061 } | |
1062 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1063 u_nick[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1064 i++; |
1012 | 1065 |
1066 for (j = 0; buf[i] != '#'; j++, i++) { | |
1011 | 1067 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1068 |
1011 | 1069 i++; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1070 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1071 strcpy(u_channel, buf + i); |
1011 | 1072 |
1301 | 1073 g_strchomp(u_channel); |
1074 | |
1014 | 1075 /* Looks like we're going to join the channel for real |
1076 * now. Let's create a valid channel structure and add | |
1077 * it to our list. Let's make sure that | |
1011 | 1078 * we are not already in a channel first */ |
1079 | |
1080 channel = find_channel_by_name(gc, u_channel); | |
1081 | |
1082 if (!channel) { | |
1301 | 1083 |
1011 | 1084 chat_id++; |
1085 | |
1086 channel = g_new0(struct irc_channel, 1); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1087 |
1011 | 1088 channel->id = chat_id; |
1089 channel->name = strdup(u_channel); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1090 |
1011 | 1091 idata->channels = g_list_append(idata->channels, channel); |
1092 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1093 serv_got_joined_chat(gc, chat_id, u_channel); |
1011 | 1094 } else { |
1014 | 1095 struct conversation *convo = NULL; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1096 |
1014 | 1097 /* Someone else joined. Find their conversation |
1098 * window */ | |
1099 convo = find_conversation_by_id(gc, channel->id); | |
1100 | |
1101 /* And add their name to it */ | |
1102 add_chat_buddy(convo, u_nick); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1103 |
1011 | 1104 } |
1105 | |
1106 return; | |
1107 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1108 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1109 if ((strstr(buf, " NICK ")) && (strstr(buf, "!")) && (buf[0] == ':') |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1110 && (!strstr(buf, " NOTICE "))) { |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1111 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1112 gchar old[128]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1113 gchar new[128]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1114 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1115 GList *templist; |
1847 | 1116 gchar *temp, *temp_new; |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1117 struct irc_channel *channel; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1118 int j; |
1847 | 1119 temp = temp_new = NULL; |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1120 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1121 old[j] = buf[i]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1122 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1123 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1124 old[j] = '\0'; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1125 i++; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1126 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1127 for (j = 0; buf[i] != ':'; j++, i++) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1128 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1129 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1130 i++; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1131 strcpy(new, buf + i); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1132 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1133 g_strchomp(new); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1134 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1135 templist = ((struct irc_data *)gc->proto_data)->channels; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1136 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1137 while (templist) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1138 struct conversation *convo = NULL; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1139 channel = templist->data; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1140 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1141 convo = find_conversation_by_id(gc, channel->id); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1142 |
1847 | 1143 /* If the person is an op or voice, this won't work. |
1144 * so we'll just do a nice hack and rename nick and | |
1145 * @nick and +nick. Truly wasteful. | |
1146 */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1147 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1148 temp = (gchar *) g_malloc(strlen(old) + 5); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1149 temp_new = (gchar *) g_malloc(strlen(new) + 5); |
1847 | 1150 g_snprintf(temp_new, strlen(new) + 2, "@%s", new); |
1151 g_snprintf(temp, strlen(old) + 2, "@%s", old); | |
1152 rename_chat_buddy(convo, temp, temp_new); | |
1153 g_snprintf(temp, strlen(old) + 2, "+%s", old); | |
1154 g_snprintf(temp_new, strlen(new) + 2, "+%s", new); | |
1155 rename_chat_buddy(convo, temp, temp_new); | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1156 rename_chat_buddy(convo, old, new); |
1847 | 1157 if (temp) |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1158 g_free(temp); |
1847 | 1159 if (temp_new) |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1160 g_free(temp_new); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1161 |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1162 templist = templist->next; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1163 } |
1847 | 1164 return; |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1165 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1166 |
1847 | 1167 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1168 if ((strstr(buf, "QUIT ")) && (buf[0] == ':') && (strstr(buf, "!")) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1169 && (!strstr(buf, " NOTICE "))) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1170 |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1171 gchar u_nick[128]; |
1847 | 1172 gchar *temp; |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1173 GList *templist; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1174 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1175 struct irc_channel *channel; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1176 int j; |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1177 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1178 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1179 temp = NULL; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1180 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1181 u_nick[j] = buf[i]; |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1182 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1183 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1184 u_nick[j] = '\0'; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1185 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1186 templist = ((struct irc_data *)gc->proto_data)->channels; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1187 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1188 while (templist) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1189 struct conversation *convo = NULL; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1190 channel = templist->data; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1191 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1192 convo = find_conversation_by_id(gc, channel->id); |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1193 |
1847 | 1194 /* If the person is an op or voice, this won't work. |
1195 * so we'll just do a nice hack and remove nick and | |
1196 * @nick and +nick. Truly wasteful. | |
1197 */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1198 |
1847 | 1199 temp = (gchar *) g_malloc(strlen(u_nick) + 2); |
1200 g_snprintf(temp, strlen(u_nick) + 2, "@%s", u_nick); | |
1201 remove_chat_buddy(convo, temp); | |
1848 | 1202 g_free(temp); |
1203 temp = (gchar *) g_malloc(strlen(u_nick) + 2); | |
1847 | 1204 g_snprintf(temp, strlen(u_nick) + 2, "+%s", u_nick); |
1205 remove_chat_buddy(convo, temp); | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1206 remove_chat_buddy(convo, u_nick); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1207 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1208 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1209 |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1210 templist = templist->next; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1211 } |
1847 | 1212 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1213 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1214 |
1847 | 1215 return; |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
1216 } |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1217 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1218 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1219 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1220 if ((strstr(buf, " PART ")) && (strstr(buf, "!")) && (buf[0] == ':') |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1221 && (!strstr(buf, " NOTICE "))) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1222 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1223 gchar u_channel[128]; |
1011 | 1224 gchar u_nick[128]; |
1847 | 1225 gchar *temp; |
1021 | 1226 struct irc_channel *channel; |
1011 | 1227 int j; |
1847 | 1228 temp = NULL; |
1011 | 1229 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
1230 u_nick[j] = buf[i]; | |
1231 } | |
1232 u_nick[j] = '\0'; | |
1233 | |
1234 i++; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1235 |
1011 | 1236 for (j = 0; buf[i] != '#'; j++, i++) { |
1237 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1238 |
1011 | 1239 i++; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1240 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1241 for (j = 0; buf[i] != ' '; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1242 if (buf[i] == '\0') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1243 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1244 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1245 u_channel[j] = buf[i]; |
1847 | 1246 } |
1247 u_channel[j] = '\0'; | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1248 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1249 /* Now, lets check to see if it was US that was leaving. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1250 * If so, do the correct thing by closing up all of our |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1251 * old channel stuff. Otherwise, |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1252 * we should just print that someone left */ |
1011 | 1253 |
1014 | 1254 channel = find_channel_by_name(gc, u_channel); |
1255 | |
1256 if (!channel) { | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1257 return; |
1014 | 1258 } |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1259 |
1011 | 1260 if (g_strcasecmp(u_nick, gc->username) == 0) { |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1261 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1262 /* Looks like we're going to leave the channel for |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1263 * real now. Let's create a valid channel structure |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1264 * and add it to our list */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1265 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1266 serv_got_chat_left(gc, channel->id); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1267 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1268 idata->channels = g_list_remove(idata->channels, channel); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1269 } else { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1270 struct conversation *convo = NULL; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1271 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1272 /* Find their conversation window */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1273 convo = find_conversation_by_id(gc, channel->id); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1274 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1275 if (!convo) { |
1014 | 1276 /* Some how the window doesn't exist. |
1277 * Let's get out of here */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1278 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1279 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1280 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1281 /* And remove their name */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1282 /* If the person is an op or voice, this won't work. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1283 * so we'll just do a nice hack and remove nick and |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1284 * @nick and +nick. Truly wasteful. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1285 */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1286 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1287 temp = (gchar *) g_malloc(strlen(u_nick) + 3); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1288 g_snprintf(temp, strlen(u_nick) + 2, "@%s", u_nick); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1289 remove_chat_buddy(convo, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1290 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1291 temp = (gchar *) g_malloc(strlen(u_nick) + 3); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1292 g_snprintf(temp, strlen(u_nick) + 2, "+%s", u_nick); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1293 remove_chat_buddy(convo, temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1294 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1295 remove_chat_buddy(convo, u_nick); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1296 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1297 |
1011 | 1298 } |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1299 |
1014 | 1300 /* Go Home! */ |
1011 | 1301 return; |
1302 } | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1303 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1304 if ((strstr(buf, " NOTICE ")) && (buf[0] == ':')) { |
1178 | 1305 gchar u_nick[128]; |
1306 gchar u_host[255]; | |
1307 gchar u_command[32]; | |
1308 gchar u_channel[128]; | |
1309 gchar u_message[IRC_BUF_LEN]; | |
1310 int j; | |
1311 | |
1312 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { | |
1313 u_nick[j] = buf[i]; | |
1314 } | |
1315 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1316 u_nick[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1317 i++; |
1178 | 1318 |
1319 for (j = 0; buf[i] != ' '; j++, i++) { | |
1320 u_host[j] = buf[i]; | |
1321 } | |
1322 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1323 u_host[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1324 i++; |
1178 | 1325 |
1326 for (j = 0; buf[i] != ' '; j++, i++) { | |
1327 u_command[j] = buf[i]; | |
1328 } | |
1329 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1330 u_command[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1331 i++; |
1178 | 1332 |
1333 for (j = 0; buf[i] != ':'; j++, i++) { | |
1334 u_channel[j] = buf[i]; | |
1335 } | |
1336 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1337 u_channel[j - 1] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1338 i++; |
1178 | 1339 |
1340 | |
1341 /* Now that everything is parsed, the rest of this baby must be our message */ | |
1342 strncpy(u_message, buf + i, IRC_BUF_LEN); | |
1343 | |
1344 /* Now, lets check the message to see if there's anything special in it */ | |
1345 if (u_message[0] == '\001') { | |
1346 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) { | |
1347 /* Someone's triyng to ping us. Let's respond */ | |
1348 gchar u_arg[24]; | |
1349 gchar u_buf[200]; | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1350 unsigned long tend = time((time_t *) NULL); |
1393 | 1351 unsigned long tstart; |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1352 |
1393 | 1353 printf("LA: %s\n", buf); |
1178 | 1354 |
1355 strcpy(u_arg, u_message + 6); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1356 u_arg[strlen(u_arg) - 1] = '\0'; |
1178 | 1357 |
1393 | 1358 tstart = atol(u_arg); |
1359 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1360 g_snprintf(u_buf, sizeof(u_buf), "Ping Reply From %s: [%ld seconds]", |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1361 u_nick, tend - tstart); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1362 |
1178 | 1363 do_error_dialog(u_buf, "Gaim IRC - Ping Reply"); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1364 |
1178 | 1365 return; |
1366 } | |
1367 } | |
1368 | |
1369 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1370 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1371 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1372 if ((strstr(buf, " PRIVMSG ")) && (buf[0] == ':')) { |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1373 gchar u_nick[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1374 gchar u_host[255]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1375 gchar u_command[32]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1376 gchar u_channel[128]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1377 gchar u_message[IRC_BUF_LEN]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1378 gboolean is_closing; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1379 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1380 int j; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1381 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1382 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1383 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1384 u_nick[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1385 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1386 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1387 u_nick[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1388 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1389 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1390 for (j = 0; buf[i] != ' '; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1391 u_host[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1392 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1393 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1394 u_host[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1395 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1396 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1397 for (j = 0; buf[i] != ' '; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1398 u_command[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1399 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1400 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1401 u_command[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1402 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1403 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1404 for (j = 0; buf[i] != ':'; j++, i++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1405 u_channel[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1406 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1407 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1408 u_channel[j - 1] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1409 i++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1410 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1411 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1412 /* Now that everything is parsed, the rest of this baby must be our message */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1413 strncpy(u_message, buf + i, IRC_BUF_LEN); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1414 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1415 /* Now, lets check the message to see if there's anything special in it */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1416 if (u_message[0] == '\001') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1417 if (g_strncasecmp(u_message, "\001VERSION", 8) == 0) { |
1017 | 1418 /* Looks like we have a version request. Let |
1419 * us handle it thusly */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1420 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1421 g_snprintf(buf, IRC_BUF_LEN, |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1422 "NOTICE %s :%cVERSION GAIM %s:The Pimpin Penguin AIM Clone:%s%c\n", |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1423 u_nick, '\001', VERSION, WEBSITE, '\001'); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1424 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1425 write(idata->fd, buf, strlen(buf)); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1426 |
1017 | 1427 /* And get the heck out of dodge */ |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1428 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1429 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1430 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1431 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) { |
1017 | 1432 /* Someone's triyng to ping us. Let's respond */ |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1433 gchar u_arg[24]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1434 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1435 strcpy(u_arg, u_message + 6); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1436 u_arg[strlen(u_arg) - 1] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1437 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1438 g_snprintf(buf, IRC_BUF_LEN, "NOTICE %s :%cPING %s%c\n", u_nick, '\001', |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1439 u_arg, '\001'); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1440 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1441 write(idata->fd, buf, strlen(buf)); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1442 |
1017 | 1443 /* And get the heck out of dodge */ |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1444 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1445 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1446 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1447 if (g_strncasecmp(u_message, "\001ACTION ", 8) == 0) { |
1011 | 1448 /* Looks like we have an action. Let's parse it a little */ |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1449 strcpy(buf, u_message); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1450 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1451 strcpy(u_message, "/me "); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1452 for (j = 4, i = 8; buf[i] != '\001'; i++, j++) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1453 u_message[j] = buf[i]; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1454 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1455 u_message[j] = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1456 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1457 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1458 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1459 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1460 /* OK, It is a chat or IM message. Here, let's translate the IRC formatting into |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1461 * good ol' fashioned gtkimhtml style hypertext markup. */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1462 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1463 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1464 is_closing = FALSE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1465 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1466 while (strchr(u_message, '\002')) { /* \002 = ^B */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1467 gchar *current; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1468 gchar *temp, *free_here; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1469 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1470 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1471 temp = g_strdup(strchr(u_message, '\002')); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1472 free_here = temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1473 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1474 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1475 current = strchr(u_message, '\002'); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1476 *current = '<'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1477 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1478 if (is_closing) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1479 *current = '/'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1480 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1481 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1482 *current = 'b'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1483 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1484 *current = '>'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1485 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1486 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1487 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1488 while (*temp != '\0') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1489 *current = *temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1490 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1491 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1492 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1493 *current = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1494 g_free(free_here); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1495 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1496 is_closing = !is_closing; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1497 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1498 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1499 is_closing = FALSE; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1500 while (strchr(u_message, '\037')) { /* \037 = ^_ */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1501 gchar *current; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1502 gchar *temp, *free_here; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1503 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1504 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1505 temp = g_strdup(strchr(u_message, '\037')); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1506 free_here = temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1507 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1508 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1509 current = strchr(u_message, '\037'); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1510 *current = '<'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1511 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1512 if (is_closing) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1513 *current = '/'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1514 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1515 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1516 *current = 'u'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1517 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1518 *current = '>'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1519 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1520 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1521 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1522 while (*temp != '\0') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1523 *current = *temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1524 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1525 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1526 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1527 *current = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1528 g_free(free_here); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1529 is_closing = !is_closing; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1530 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1531 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1532 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1533 while (strchr(u_message, '\003')) { /* \003 = ^C */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1534 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1535 /* This is color formatting. IRC uses its own weird little system |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1536 * that we must translate to HTML. */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1537 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1538 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1539 /* The format is something like this: |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1540 * ^C5 or ^C5,3 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1541 * The number before the comma is the foreground color, after is the |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1542 * background color. Either number can be 1 or two digits. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1543 */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1544 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1545 gchar *current; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1546 gchar *temp, *free_here; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1547 gchar *font_tag, *body_tag; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1548 int fg_color, bg_color; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1549 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1550 temp = g_strdup(strchr(u_message, '\003')); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1551 free_here = temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1552 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1553 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1554 fg_color = bg_color = -1; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1555 body_tag = font_tag = ""; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1556 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1557 /* Parsing the color information: */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1558 do { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1559 if (!isdigit(*temp)) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1560 break; /* This translates to </font> */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1561 fg_color = (int)(*temp - 48); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1562 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1563 if (isdigit(*temp)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1564 fg_color = (fg_color * 10) + (int)(*temp - 48); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1565 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1566 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1567 if (*temp != ',') |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1568 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1569 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1570 if (!isdigit(*temp)) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1571 break; /* This translates to </font> */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1572 bg_color = (int)(*temp - 48); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1573 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1574 if (isdigit(*temp)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1575 bg_color = (bg_color * 10) + (int)(*temp - 48); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1576 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1577 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1578 } while (FALSE); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1579 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1580 if (fg_color > 15) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1581 fg_color = fg_color % 16; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1582 if (bg_color > 15) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1583 bg_color = bg_color % 16; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1584 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1585 switch (fg_color) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1586 case -1: |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1587 font_tag = "</font></body>"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1588 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1589 case 0: /* WHITE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1590 font_tag = "<font color=\"#ffffff\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1591 /* If no background color is specified, we're going to make it black anyway. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1592 * That's probably what the sender anticipated the background color to be. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1593 * White on white would be illegible. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1594 */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1595 if (bg_color == -1) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1596 body_tag = "<body bgcolor=\"#000000\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1597 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1598 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1599 case 1: /* BLACK */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1600 font_tag = "<font color=\"#000000\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1601 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1602 case 2: /* NAVY BLUE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1603 font_tag = "<font color=\"#000066\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1604 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1605 case 3: /* GREEN */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1606 font_tag = "<font color=\"#006600\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1607 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1608 case 4: /* RED */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1609 font_tag = "<font color=\"#ff0000\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1610 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1611 case 5: /* MAROON */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1612 font_tag = "<font color=\"#660000\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1613 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1614 case 6: /* PURPLE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1615 font_tag = "<font color=\"#660066\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1616 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1617 case 7: /* DISGUSTING PUKE COLOR */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1618 font_tag = "<font color=\"#666600\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1619 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1620 case 8: /* YELLOW */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1621 font_tag = "<font color=\"#cccc00\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1622 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1623 case 9: /* LIGHT GREEN */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1624 font_tag = "<font color=\"#33cc33\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1625 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1626 case 10: /* TEAL */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1627 font_tag = "<font color=\"#00acac\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1628 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1629 case 11: /* CYAN */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1630 font_tag = "<font color=\"#00ccac\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1631 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1632 case 12: /* BLUE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1633 font_tag = "<font color=\"#0000ff\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1634 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1635 case 13: /* PINK */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1636 font_tag = "<font color=\"#cc00cc\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1637 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1638 case 14: /* GREY */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1639 font_tag = "<font color=\"#666666\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1640 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1641 case 15: /* SILVER */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1642 font_tag = "<font color=\"#00ccac\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1643 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1644 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1645 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1646 switch (bg_color) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1647 case 0: /* WHITE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1648 body_tag = "<body bgcolor=\"#ffffff\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1649 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1650 case 1: /* BLACK */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1651 body_tag = "<body bgcolor=\"#000000\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1652 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1653 case 2: /* NAVY BLUE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1654 body_tag = "<body bgcolor=\"#000066\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1655 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1656 case 3: /* GREEN */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1657 body_tag = "<body bgcolor=\"#006600\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1658 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1659 case 4: /* RED */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1660 body_tag = "<body bgcolor=\"#ff0000\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1661 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1662 case 5: /* MAROON */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1663 body_tag = "<body bgcolor=\"#660000\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1664 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1665 case 6: /* PURPLE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1666 body_tag = "<body bgcolor=\"#660066\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1667 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1668 case 7: /* DISGUSTING PUKE COLOR */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1669 body_tag = "<body bgcolor=\"#666600\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1670 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1671 case 8: /* YELLOW */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1672 body_tag = "<body bgcolor=\"#cccc00\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1673 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1674 case 9: /* LIGHT GREEN */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1675 body_tag = "<body bgcolor=\"#33cc33\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1676 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1677 case 10: /* TEAL */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1678 body_tag = "<body bgcolor=\"#00acac\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1679 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1680 case 11: /* CYAN */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1681 body_tag = "<body bgcolor=\"#00ccac\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1682 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1683 case 12: /* BLUE */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1684 body_tag = "<body bgcolor=\"#0000ff\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1685 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1686 case 13: /* PINK */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1687 body_tag = "<body bgcolor=\"#cc00cc\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1688 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1689 case 14: /* GREY */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1690 body_tag = "<body bgcolor=\"#666666\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1691 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1692 case 15: /* SILVER */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1693 body_tag = "<body bgcolor=\"#00ccac\">"; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1694 break; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1695 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1696 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1697 current = strchr(u_message, '\003'); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1698 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1699 while (*body_tag != '\0') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1700 *current = *body_tag; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1701 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1702 body_tag++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1703 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1704 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1705 while (*font_tag != '\0') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1706 *current = *font_tag; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1707 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1708 font_tag++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1709 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1710 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1711 while (*temp != '\0') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1712 *current = *temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1713 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1714 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1715 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1716 *current = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1717 g_free(free_here); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1718 is_closing = !is_closing; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1719 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1720 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1721 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1722 while (strchr(u_message, '\017')) { /* \017 = ^O */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1723 gchar *current; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1724 gchar *temp, *free_here; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1725 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1726 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1727 temp = g_strdup(strchr(u_message, '\017')); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1728 free_here = temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1729 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1730 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1731 current = strchr(u_message, '\017'); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1732 *current = '<'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1733 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1734 *current = '/'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1735 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1736 *current = 'b'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1737 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1738 *current = '>'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1739 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1740 *current = '<'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1741 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1742 *current = '/'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1743 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1744 *current = 'u'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1745 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1746 *current = '>'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1747 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1748 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1749 while (*temp != '\0') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1750 *current = *temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1751 current++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1752 temp++; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1753 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1754 *current = '\0'; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1755 g_free(free_here); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1756 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1757 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1758 /* Let's check to see if we have a channel on our hands */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1759 if (u_channel[0] == '#') { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1760 /* Yup. We have a channel */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1761 int id; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1762 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1763 id = find_id_by_name(gc, u_channel); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1764 if (id != -1) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1765 serv_got_chat_in(gc, id, u_nick, 0, u_message, time((time_t) NULL)); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1766 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1767 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1768 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1769 } else { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1770 /* Nope. Let's treat it as a private message */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1771 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1772 gchar *temp; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1773 temp = NULL; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1774 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1775 temp = (gchar *) g_malloc(strlen(u_nick) + 5); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1776 g_snprintf(temp, strlen(u_nick) + 2, "@%s", u_nick); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1777 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1778 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1779 /* If I get a message from SeanEgn, and I already have a window |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1780 * open for him as @SeanEgn or +SeanEgn, this will keep it in the |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1781 * same window. Unfortunately, if SeanEgn loses his op status |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1782 * (a sad thing indeed), the messages will still appear to come from |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1783 * @SeanEgn, until that convo is closed. |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1784 */ |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1785 |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1786 if (find_conversation(temp)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1787 serv_got_im(gc, temp, u_message, 0, time((time_t) NULL)); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1788 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1789 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1790 } else { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1791 g_snprintf(temp, strlen(u_nick) + 2, "+%s", u_nick); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1792 if (find_conversation(temp)) { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1793 serv_got_im(gc, temp, u_message, 0, time((time_t) NULL)); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1794 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1795 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1796 } else { |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1797 g_free(temp); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1798 serv_got_im(gc, u_nick, u_message, 0, time((time_t) NULL)); |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1799 return; |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1800 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1801 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1802 } |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1803 |
1848 | 1804 return; |
1011 | 1805 } |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1806 |
1011 | 1807 /* Let's parse PING requests so that we wont get booted for inactivity */ |
1808 | |
1809 if (strncmp(buf, "PING :", 6) == 0) { | |
1810 buf2 = g_strsplit(buf, ":", 1); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1811 |
1011 | 1812 /* Let's build a new response */ |
1813 g_snprintf(buf, IRC_BUF_LEN, "PONG :%s\n", buf2[1]); | |
1814 write(idata->fd, buf, strlen(buf)); | |
1815 | |
1816 /* And clean up after ourselves */ | |
1817 g_strfreev(buf2); | |
1818 | |
1819 return; | |
1820 } | |
1821 | |
1822 } | |
1823 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1824 static void irc_close(struct gaim_connection *gc) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1825 { |
1011 | 1826 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1021 | 1827 GList *chats = idata->channels; |
1828 struct irc_channel *cc; | |
1829 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1830 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN); |
1011 | 1831 |
1847 | 1832 g_snprintf(buf, IRC_BUF_LEN, "QUIT :Download GAIM [%s]\n", WEBSITE); |
1011 | 1833 write(idata->fd, buf, strlen(buf)); |
1834 | |
1835 g_free(buf); | |
1021 | 1836 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1837 if (idata->timer) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1838 gtk_timeout_remove(idata->timer); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1839 |
1021 | 1840 while (chats) { |
1841 cc = (struct irc_channel *)chats->data; | |
1842 g_free(cc->name); | |
1843 chats = g_list_remove(chats, cc); | |
1844 g_free(cc); | |
1845 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1846 |
1021 | 1847 if (gc->inpa) |
1848 gdk_input_remove(gc->inpa); | |
1849 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1850 if (idata->inpa) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1851 gdk_input_remove(idata->inpa); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1852 |
1011 | 1853 close(idata->fd); |
1854 g_free(gc->proto_data); | |
1855 } | |
1856 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1857 static void irc_chat_leave(struct gaim_connection *gc, int id) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1858 { |
1011 | 1859 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1860 struct irc_channel *channel; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1861 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1862 |
1011 | 1863 channel = find_channel_by_id(gc, id); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1864 |
1011 | 1865 if (!channel) { |
1866 return; | |
1867 } | |
1868 | |
1869 g_snprintf(buf, IRC_BUF_LEN, "PART #%s\n", channel->name); | |
1870 write(idata->fd, buf, strlen(buf)); | |
1871 | |
1872 g_free(buf); | |
1873 } | |
1874 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1875 static void irc_login_callback(gpointer data, gint source, GdkInputCondition condition) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1876 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1877 struct gaim_connection *gc = data; |
2003
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1878 struct irc_data *idata; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1879 char buf[4096]; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1880 |
2003
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1881 if (!g_slist_find(connections, gc)) { |
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1882 close(source); |
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1883 return; |
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1884 } |
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1885 |
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1886 idata = gc->proto_data; |
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1887 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1888 if (source == -1) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1889 hide_login_progress(gc, "Write error"); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1890 signoff(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1891 return; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1892 } |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1893 |
2003
ffae8228d63a
[gaim-migrate @ 2013]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1958
diff
changeset
|
1894 if (idata->fd != source) |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1895 idata->fd = source; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1896 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1897 g_snprintf(buf, 4096, "NICK %s\n USER %s localhost %s :GAIM (%s)\n", |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1898 gc->username, g_get_user_name(), gc->user->proto_opt[USEROPT_SERV], WEBSITE); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1899 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1900 if (write(idata->fd, buf, strlen(buf)) < 0) { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1901 hide_login_progress(gc, "Write error"); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1902 signoff(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1903 return; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1904 } |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1905 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1906 idata->inpa = gdk_input_add(idata->fd, GDK_INPUT_READ, irc_callback, gc); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1907 idata->inpa = 0; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1908 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1909 /* Now lets sign ourselves on */ |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1910 account_online(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1911 serv_finish_login(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1912 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1913 if (bud_list_cache_exists(gc)) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1914 do_import(NULL, gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1915 |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
1916 /* we don't call this now because otherwise some IRC servers might not like us */ |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1917 idata->timer = gtk_timeout_add(20000, (GtkFunction) irc_request_buddy_update, gc); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1918 } |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1919 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1920 static void irc_login(struct aim_user *user) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1921 { |
1011 | 1922 char buf[4096]; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1923 |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1075
diff
changeset
|
1924 struct gaim_connection *gc = new_gaim_conn(user); |
1011 | 1925 struct irc_data *idata = gc->proto_data = g_new0(struct irc_data, 1); |
1926 | |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1927 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1928 set_login_progress(gc, 2, buf); |
1011 | 1929 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1930 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV], |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1931 user->proto_opt[USEROPT_PORT][0] ? atoi(user-> |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1932 proto_opt[USEROPT_PORT]) : |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1933 6667, irc_login_callback, gc); |
1866
466fc4ada7cb
[gaim-migrate @ 1876]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1864
diff
changeset
|
1934 if (!user->gc || (idata->fd < 0)) { |
1011 | 1935 hide_login_progress(gc, "Unable to create socket"); |
1115
114cd406b022
[gaim-migrate @ 1125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1105
diff
changeset
|
1936 signoff(gc); |
1011 | 1937 return; |
1938 } | |
1939 } | |
1008 | 1940 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1941 static void irc_print_option(GtkEntry *entry, struct aim_user *user) |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1942 { |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1943 int entrynum; |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1944 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1945 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1946 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1947 if (entrynum == USEROPT_SERV) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1948 g_snprintf(user->proto_opt[USEROPT_SERV], |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1949 sizeof(user->proto_opt[USEROPT_SERV]), "%s", gtk_entry_get_text(entry)); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1950 } else if (entrynum == USEROPT_PORT) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1951 g_snprintf(user->proto_opt[USEROPT_PORT], |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1952 sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry)); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1953 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1954 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1955 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
1956 static void irc_user_opts(GtkWidget *book, struct aim_user *user) |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1957 { |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1958 /* so here, we create the new notebook page */ |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1959 GtkWidget *vbox; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1960 GtkWidget *hbox; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1961 GtkWidget *label; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1962 GtkWidget *entry; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1963 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1964 vbox = gtk_vbox_new(FALSE, 5); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1965 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1966 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("IRC Options")); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1967 gtk_widget_show(vbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1968 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1969 hbox = gtk_hbox_new(FALSE, 5); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1970 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1971 gtk_widget_show(hbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1972 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1973 label = gtk_label_new("Server:"); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1974 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1975 gtk_widget_show(label); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1976 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1977 entry = gtk_entry_new(); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1978 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1979 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SERV); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1980 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1981 if (user->proto_opt[USEROPT_SERV][0]) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1982 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SERV]); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1983 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SERV]); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1984 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1985 gtk_widget_show(entry); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1986 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1987 hbox = gtk_hbox_new(FALSE, 0); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1988 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1989 gtk_widget_show(hbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1990 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1991 label = gtk_label_new("Port:"); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1992 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1993 gtk_widget_show(label); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1994 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1995 entry = gtk_entry_new(); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1996 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1997 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PORT); |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1998 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1999 if (user->proto_opt[USEROPT_PORT][0]) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
2000 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
2001 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]); |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
2002 } else |
1875 | 2003 gtk_entry_set_text(GTK_ENTRY(entry), "6667"); |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
2004 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
2005 gtk_widget_show(entry); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
2006 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
2007 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2008 static char **irc_list_icon(int uc) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2009 { |
1178 | 2010 return free_icon_xpm; |
2011 } | |
2012 | |
2013 /* Send out a ping request to the specified user */ | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2014 static void irc_send_ping(GtkObject *w, char *who) |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2015 { |
1178 | 2016 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); |
2017 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
2018 char buf[BUF_LEN]; | |
2019 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2020 g_snprintf(buf, BUF_LEN, "PRIVMSG %s :%cPING %ld%c\n", who, '\001', time((time_t *) NULL), |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2021 '\001'); |
1178 | 2022 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2023 write(idata->fd, buf, strlen(buf)); |
1178 | 2024 } |
2025 | |
1673 | 2026 /* Do a whois check on someone :-) */ |
2027 static void irc_get_info(struct gaim_connection *gc, char *who) | |
2028 { | |
2029 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
2030 char buf[BUF_LEN]; | |
2031 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2032 if (((who[0] == '@') || (who[0] == '+')) && (strlen(who) > 1)) |
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2033 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who + 1); |
1673 | 2034 else |
2035 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who); | |
2036 write(idata->fd, buf, strlen(buf)); | |
2037 } | |
2038 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2039 static void irc_send_whois(GtkObject *w, char *who) |
1673 | 2040 { |
2041 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); | |
2042 irc_get_info(gc, who); | |
2043 } | |
1178 | 2044 |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2045 static void irc_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2046 { |
1178 | 2047 GtkWidget *button; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2048 |
1178 | 2049 button = gtk_menu_item_new_with_label("Ping"); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2050 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_ping), who); |
1178 | 2051 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
2052 gtk_menu_append(GTK_MENU(menu), button); | |
2053 gtk_widget_show(button); | |
1673 | 2054 |
2055 button = gtk_menu_item_new_with_label("Whois"); | |
2056 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_whois), who); | |
2057 gtk_object_set_user_data(GTK_OBJECT(button), gc); | |
2058 gtk_menu_append(GTK_MENU(menu), button); | |
2059 gtk_widget_show(button); | |
1178 | 2060 } |
2061 | |
2062 | |
1676 | 2063 static void irc_set_away(struct gaim_connection *gc, char *state, char *msg) |
2064 { | |
2065 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
2066 char buf[BUF_LEN]; | |
2067 | |
2068 if (msg) | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2069 g_snprintf(buf, BUF_LEN, "AWAY :%s\n", msg); |
1676 | 2070 else |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2071 g_snprintf(buf, BUF_LEN, "AWAY\n"); |
1676 | 2072 |
2073 write(idata->fd, buf, strlen(buf)); | |
2074 } | |
2075 | |
1678 | 2076 static void irc_fake_buddy(struct gaim_connection *gc, char *who) |
2077 { | |
2078 /* Heh, there is no buddy list. We fake it. | |
2079 * I just need this here so the add and remove buttons will | |
2080 * show up */ | |
2081 } | |
2082 | |
1958 | 2083 static void irc_chat_set_topic(struct gaim_connection *gc, int id, char *topic) |
2084 { | |
2085 struct irc_channel *ic = NULL; | |
2086 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
2087 char buf[BUF_LEN]; | |
1678 | 2088 |
1958 | 2089 ic = find_channel_by_id(gc, id); |
2090 | |
2091 /* If we ain't in no channel, foo, gets outta da kitchen beeyotch */ | |
2092 if (!ic) | |
2093 return; | |
2094 | |
2095 /* Prepare our command */ | |
2096 g_snprintf(buf, BUF_LEN, "TOPIC #%s :%s\n", ic->name, topic); | |
2097 | |
2098 /* And send it */ | |
2099 write(idata->fd, buf, strlen(buf)); | |
2100 } | |
1678 | 2101 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2102 static struct prpl *my_protocol = NULL; |
987 | 2103 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2104 static void irc_init(struct prpl *ret) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2105 { |
1008 | 2106 ret->protocol = PROTO_IRC; |
1958 | 2107 ret->options = OPT_PROTO_CHAT_TOPIC; |
1008 | 2108 ret->name = irc_name; |
1178 | 2109 ret->list_icon = irc_list_icon; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
2110 ret->buddy_menu = irc_buddy_menu; |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
2111 ret->user_opts = irc_user_opts; |
1008 | 2112 ret->login = irc_login; |
1011 | 2113 ret->close = irc_close; |
2114 ret->send_im = irc_send_im; | |
2115 ret->join_chat = irc_join_chat; | |
2116 ret->chat_leave = irc_chat_leave; | |
2117 ret->chat_send = irc_chat_send; | |
1673 | 2118 ret->get_info = irc_get_info; |
1676 | 2119 ret->set_away = irc_set_away; |
1678 | 2120 ret->add_buddy = irc_fake_buddy; |
2121 ret->remove_buddy = irc_fake_buddy; | |
1958 | 2122 ret->chat_set_topic = irc_chat_set_topic; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2123 my_protocol = ret; |
987 | 2124 } |
2125 | |
2047
21f1f1e0d4c5
[gaim-migrate @ 2057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2003
diff
changeset
|
2126 char *gaim_plugin_init(GModule *handle) |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2127 { |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1394
diff
changeset
|
2128 load_protocol(irc_init, sizeof(struct prpl)); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2129 return NULL; |
987 | 2130 } |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2131 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2132 void gaim_plugin_remove() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
2133 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2134 struct prpl *p = find_prpl(PROTO_IRC); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2135 if (p == my_protocol) |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2136 unload_protocol(p); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
2137 } |