Mercurial > pidgin.yaz
annotate plugins/irc.c @ 1843:4dbd8533d209
[gaim-migrate @ 1853]
http can be authenticated
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 12 May 2001 08:09:54 +0000 |
parents | 1d137dde946f |
children | 9845deede1e9 |
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> | |
39 #include "multi.h" | |
40 #include "prpl.h" | |
41 #include "gaim.h" | |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
42 #include "proxy.h" |
987 | 43 |
1178 | 44 #include "pixmaps/free_icon.xpm" |
45 | |
1011 | 46 #define IRC_BUF_LEN 4096 |
47 | |
1022 | 48 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
49 #define USEROPT_SERV 0 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
50 #define USEROPT_PORT 1 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
51 #define USEROPT_PROXYSERV 2 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
52 #define USEROPT_PROXYPORT 3 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
53 #define USEROPT_PROXYTYPE 4 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
54 #define USEROPT_USER 5 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
55 #define USEROPT_PASS 6 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
56 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
57 |
1011 | 58 static int chat_id = 0; |
59 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
60 struct irc_channel { |
1011 | 61 int id; |
62 gchar *name; | |
63 }; | |
64 | |
65 struct irc_data { | |
66 int fd; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
67 int inpa; /* used for non-block logins */ |
1011 | 68 |
1022 | 69 int timer; |
70 | |
71 int totalblocks; | |
72 int recblocks; | |
73 | |
74 GSList *templist; | |
1011 | 75 GList *channels; |
76 }; | |
77 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
78 static char *irc_name() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
79 { |
1008 | 80 return "IRC"; |
81 } | |
82 | |
1675 | 83 static void irc_get_info(struct gaim_connection *gc, char *who); |
84 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
85 char *name() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
86 { |
1008 | 87 return "IRC"; |
88 } | |
89 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
90 char *description() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
91 { |
1008 | 92 return "Allows gaim to use the IRC protocol"; |
93 } | |
94 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
95 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
|
96 { |
1011 | 97 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
98 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 99 |
100 g_snprintf(buf, IRC_BUF_LEN, "JOIN %s\n", name); | |
101 write(idata->fd, buf, strlen(buf)); | |
1742 | 102 write(idata->fd, buf, strlen(buf)); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
103 |
1011 | 104 g_free(buf); |
105 } | |
106 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
107 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
|
108 { |
1022 | 109 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
110 struct irc_channel *u; | |
111 GSList *temp = idata->templist; | |
112 | |
113 /* Loop through our list */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
114 |
1022 | 115 while (temp) { |
116 u = (struct irc_channel *)temp->data; | |
117 if (g_strcasecmp(u->name, name) == 0) { | |
118 u->id = status; | |
119 return; | |
120 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
121 |
1022 | 122 temp = g_slist_next(temp); |
123 } | |
124 return; | |
125 } | |
126 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
127 static void irc_request_buddy_update(struct gaim_connection *gc) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
128 { |
1022 | 129 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1046
4593605da0e2
[gaim-migrate @ 1056]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1022
diff
changeset
|
130 GSList *grp = gc->groups; |
4593605da0e2
[gaim-migrate @ 1056]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1022
diff
changeset
|
131 GSList *person; |
1022 | 132 struct group *g; |
133 struct buddy *b; | |
134 struct irc_channel *u; | |
135 | |
136 if (idata->templist != NULL) | |
137 return; | |
138 | |
139 idata->recblocks = 0; | |
140 idata->totalblocks = 1; | |
141 | |
1105 | 142 /* First, let's check to see if we have anyone on our buddylist */ |
143 if (!grp) { | |
144 return; | |
145 } | |
146 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
147 /* Send the first part of our request */ |
1022 | 148 write(idata->fd, "ISON", 4); |
149 | |
150 /* Step through our list of groups */ | |
151 while (grp) { | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
152 |
1022 | 153 g = (struct group *)grp->data; |
154 person = g->members; | |
155 | |
156 while (person) { | |
157 b = (struct buddy *)person->data; | |
158 | |
159 /* We will store our buddy info here. I know, this is cheap | |
160 * but hey, its the exact same data structure. Why should we | |
161 * bother with making another one */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
162 |
1022 | 163 u = g_new0(struct irc_channel, 1); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
164 u->id = 0; /* Assume by default that they're offline */ |
1022 | 165 u->name = strdup(b->name); |
166 | |
167 write(idata->fd, " ", 1); | |
168 write(idata->fd, u->name, strlen(u->name)); | |
169 idata->templist = g_slist_append(idata->templist, u); | |
170 | |
171 person = person->next; | |
172 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
173 |
1022 | 174 grp = g_slist_next(grp); |
175 } | |
176 write(idata->fd, "\n", 1); | |
177 } | |
178 | |
179 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
180 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
|
181 { |
1011 | 182 |
1742 | 183 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
184 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 185 |
186 /* Before we actually send this, we should check to see if they're trying | |
1674 | 187 * To issue a command and handle it properly. */ |
1011 | 188 |
1674 | 189 if (message[0] == '/') |
190 { | |
191 /* I'll change the implementation of this a little later :-) */ | |
192 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) { | |
193 /* We have /me!! We have /me!! :-) */ | |
1011 | 194 |
1674 | 195 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
196 strcpy(temp, message + 4); | |
197 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%cACTION %s%c\n", who, '\001', temp, '\001'); | |
198 g_free(temp); | |
199 } | |
1675 | 200 else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) { |
201 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
202 strcpy(temp, message + 7); | |
203 irc_get_info(gc, temp); | |
204 g_free(temp); | |
205 | |
206 return; | |
207 } | |
208 | |
1674 | 209 } |
210 else { | |
1011 | 211 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG %s :%s\n", who, message); |
212 } | |
213 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
214 write(idata->fd, buf, strlen(buf)); |
1011 | 215 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
216 g_free(buf); |
1011 | 217 } |
218 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
219 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
|
220 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
221 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 222 GList *templist; |
223 struct irc_channel *channel; | |
224 | |
225 templist = ((struct irc_data *)gc->proto_data)->channels; | |
226 | |
227 while (templist) { | |
228 channel = (struct irc_channel *)templist->data; | |
229 | |
230 g_snprintf(temp, IRC_BUF_LEN, "#%s", channel->name); | |
231 | |
232 if (g_strcasecmp(temp, name) == 0) { | |
233 g_free(temp); | |
234 return channel->id; | |
235 } | |
236 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
237 templist = templist->next; |
1011 | 238 } |
239 | |
240 g_free(temp); | |
241 | |
242 /* Return -1 if we have no ID */ | |
243 return -1; | |
244 } | |
245 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
246 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
|
247 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
248 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1011 | 249 GList *templist; |
250 struct irc_channel *channel; | |
251 | |
252 templist = ((struct irc_data *)gc->proto_data)->channels; | |
253 | |
254 while (templist) { | |
255 channel = (struct irc_channel *)templist->data; | |
256 | |
257 g_snprintf(temp, IRC_BUF_LEN, "%s", channel->name); | |
258 | |
259 if (g_strcasecmp(temp, name) == 0) { | |
260 g_free(temp); | |
261 return channel; | |
262 } | |
263 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
264 templist = templist->next; |
1011 | 265 } |
266 | |
267 g_free(temp); | |
268 | |
269 /* If we found nothing, return nothing :-) */ | |
270 return NULL; | |
271 } | |
272 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
273 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
|
274 { |
1011 | 275 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
276 struct irc_channel *channel; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
277 |
1011 | 278 GList *temp; |
279 | |
280 temp = idata->channels; | |
281 | |
282 while (temp) { | |
283 channel = (struct irc_channel *)temp->data; | |
284 | |
285 if (channel->id == id) { | |
286 /* We've found our man */ | |
287 return channel; | |
288 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
289 |
1011 | 290 temp = temp->next; |
291 } | |
292 | |
293 | |
294 /* If we didnt find one, return NULL */ | |
295 return NULL; | |
296 } | |
297 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
298 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
|
299 { |
1011 | 300 |
1742 | 301 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1021 | 302 struct irc_channel *channel = NULL; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
303 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
1742 | 304 char **kick; |
305 gboolean is_command = FALSE; | |
1011 | 306 /* First lets get our current channel */ |
307 channel = find_channel_by_id(gc, id); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
308 |
1011 | 309 |
310 if (!channel) { | |
311 /* If for some reason we've lost our channel, let's bolt */ | |
1021 | 312 g_free(buf); |
1011 | 313 return; |
314 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
315 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
316 |
1011 | 317 /* Before we actually send this, we should check to see if they're trying |
1675 | 318 * To issue a command and handle it properly. */ |
1011 | 319 |
1675 | 320 if (message[0] == '/') |
1742 | 321 { |
322 | |
323 if ((g_strncasecmp(message, "/me ", 4) == 0) && (strlen(message) > 4)) { | |
324 /* We have /me!! We have /me!! :-) */ | |
325 | |
326 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
327 strcpy(temp, message + 4); | |
328 | |
329 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%cACTION %s%c\n", channel->name, '\001', temp, | |
330 '\001'); | |
331 g_free(temp); | |
332 } | |
333 else if ((g_strncasecmp(message, "/op ", 4) == 0) && (strlen(message) > 4)) { | |
334 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
335 strcpy(temp, message + 4); | |
336 | |
337 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s +o %s\n", channel->name, temp); | |
338 | |
339 g_free(temp); | |
340 is_command = TRUE; | |
341 | |
342 } | |
343 else if ((g_strncasecmp(message, "/deop ", 6) == 0) && (strlen(message) > 6)) { | |
344 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
345 strcpy(temp, message + 6); | |
346 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s -o %s\n", channel->name, temp); | |
347 | |
348 g_free(temp); | |
349 is_command = TRUE; | |
1675 | 350 } |
1742 | 351 |
352 else if ((g_strncasecmp(message, "/voice ", 7) == 0) && (strlen(message) > 7)) { | |
353 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
354 strcpy(temp, message + 7); | |
355 | |
356 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s +v %s\n", channel->name, temp); | |
357 | |
358 g_free(temp); | |
359 is_command = TRUE; | |
360 | |
361 } | |
362 else if ((g_strncasecmp(message, "/devoice ", 9) == 0) && (strlen(message) > 9)) { | |
363 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
364 strcpy(temp, message + 6); | |
365 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s -v %s\n", channel->name, temp); | |
366 | |
367 g_free(temp); | |
368 is_command = TRUE; | |
369 } | |
370 else if ((g_strncasecmp(message, "/mode ", 6) == 0) && (strlen(message) > 6)) { | |
371 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
372 strcpy(temp, message + 6); | |
373 g_snprintf(buf, IRC_BUF_LEN, "MODE #%s %s\n", channel->name, temp); | |
374 g_free(temp); | |
375 is_command = TRUE; | |
376 } | |
377 | |
378 else if (!g_strncasecmp(message, "/whois ", 7) && (strlen(message) > 7)) { | |
379 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
380 | |
381 strcpy(temp, message + 7); | |
382 irc_get_info(gc, temp); | |
383 g_free(temp); | |
384 | |
385 | |
386 } | |
387 | |
388 else if (!g_strncasecmp(message, "/raw ", 5) && (strlen(message) > 5)){ | |
389 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
390 strcpy(temp, message + 5); | |
391 g_snprintf(buf, IRC_BUF_LEN, "%s\r\n", temp); | |
392 g_free(temp); | |
393 is_command = TRUE; | |
394 } | |
1675 | 395 |
1742 | 396 else if (!g_strncasecmp(message, "/quote ", 7) && (strlen(message) >7)) { |
397 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
398 strcpy(temp, message + 7); | |
399 g_snprintf(buf, IRC_BUF_LEN, "%s\r\n", temp); | |
400 g_free(temp); | |
401 is_command = TRUE; | |
402 } | |
403 | |
404 else if (!g_strncasecmp(message, "/kick ", 6) && (strlen(message) > 6)) { | |
405 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
406 strcpy(temp, message + 6); | |
407 kick = g_strsplit(temp, " ", 2); | |
408 g_snprintf(buf, IRC_BUF_LEN, "KICK #%s %s :%s\r\n", channel->name, kick[0], kick[1]); | |
409 g_free(temp); | |
410 is_command = TRUE; | |
411 } | |
412 | |
413 /* FIXME: I'll go back in and grab this later. -- Rob */ | |
414 /* | |
415 I THOUGHT THIS WOULD WORK, BUT I WAS WRONG. WOULD SOMEONE KINDLY FIX IT? | |
1675 | 416 |
1742 | 417 |
418 else if (!g_strncasecmp(message, "/help", 5)) { | |
419 gchar *temp = (gchar *) g_malloc(IRC_BUF_LEN + 1); | |
420 strcpy(temp, message + 5); | |
421 if (temp == "") { | |
422 | |
423 serv_got_chat_in(gc, id, "gAIM", 0, "Available Commands:"); | |
424 serv_got_chat_in(gc, id, "gAIM", 0, " "); | |
425 serv_got_chat_in(gc, id, "gAIM", 0, "<b>op voice kick </b>"); | |
426 serv_got_chat_in(gc, id, "gAIM", 0, "<b>deop devoice whois</b>"); | |
427 serv_got_chat_in(gc, id, "gAIM", 0, "<b>me raw quote</b>"); | |
428 serv_got_chat_in(gc, id, "gAIM", 0, "<b>mode</b>"); | |
429 } | |
430 else { | |
431 serv_got_chat_in(gc, id, "gAIM", 0, "Usage: "); | |
432 if (temp == "op") | |
433 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/op <nick></b> - Gives operator status to user."); | |
434 else if (temp == "deop") | |
435 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/deop <nick></b> - Removes operator status from user."); | |
436 else if (temp == "me") | |
437 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/me <action></b> - Sends an action to the channel."); | |
438 else if (temp == "mode") | |
439 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."); | |
440 else if (temp == "voice") | |
441 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/voice <nick></b> - Gives voice status to user."); | |
442 else if (temp == "devoice") | |
443 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/devoice <nick></b> - Removes voice status from user."); | |
444 else if (temp == "raw") | |
445 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/raw <text></b> - Sends raw text to the server."); | |
446 else if (temp == "kick") | |
447 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/kick [<comment>]</b> - Kicks a user out of the channel."); | |
448 else if (temp == "whois") | |
449 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/whois <nick></b> - Gets information about user."); | |
450 else if (temp == "quote") | |
451 serv_got_chat_in(gc, id, "gAIM", 0, "<b>/raw <text></b> - Sends raw text to the server."); | |
452 else | |
453 serv_got_chat_in(gc, id, "gAIM", 0, "No such command."); | |
454 } | |
455 | |
456 g_free(temp); | |
457 is_command = TRUE; | |
458 } | |
459 */ | |
460 | |
461 } | |
462 | |
1675 | 463 else { |
1742 | 464 g_snprintf(buf, IRC_BUF_LEN, "PRIVMSG #%s :%s\n", channel->name, message); |
465 | |
466 } | |
467 | |
468 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
469 write(idata->fd, buf, strlen(buf)); |
1742 | 470 |
1011 | 471 /* Since AIM expects us to receive the message we send, we gotta fake it */ |
1742 | 472 if (is_command==FALSE) |
1764 | 473 serv_got_chat_in(gc, id, gc->username, 0, message, time((time_t)NULL)); |
1742 | 474 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
475 g_free(buf); |
1742 | 476 |
477 | |
1008 | 478 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
479 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
|
480 { |
1014 | 481 GSList *bc = gc->buddy_chats; |
482 struct conversation *b = NULL; | |
483 | |
484 while (bc) { | |
485 b = (struct conversation *)bc->data; | |
486 if (id == b->id) { | |
487 break; | |
488 } | |
489 bc = bc->next; | |
490 b = NULL; | |
491 } | |
492 | |
493 if (!b) { | |
494 return NULL; | |
495 } | |
496 | |
497 return b; | |
498 } | |
499 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
500 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
|
501 { |
1014 | 502 GSList *bc = gc->buddy_chats; |
503 struct conversation *b = NULL; | |
504 | |
505 while (bc) { | |
506 b = (struct conversation *)bc->data; | |
507 | |
508 if (g_strcasecmp(name, b->name) == 0) { | |
509 break; | |
510 } | |
511 bc = bc->next; | |
512 b = NULL; | |
513 } | |
514 | |
515 if (!b) { | |
516 return NULL; | |
517 } | |
518 | |
519 return b; | |
520 } | |
521 | |
522 | |
523 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
524 static void irc_callback(gpointer data, gint source, GdkInputCondition condition) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
525 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
526 struct gaim_connection *gc = data; |
1011 | 527 int i = 0; |
528 gchar buf[4096]; | |
529 gchar **buf2; | |
530 struct irc_data *idata; | |
1742 | 531 |
532 idata = (struct irc_data *)gc->proto_data; | |
1011 | 533 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
534 |
1011 | 535 do { |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
536 if (read(idata->fd, buf + i, 1) < 0) { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
537 hide_login_progress(gc, "Read error"); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
538 signoff(gc); |
1105 | 539 return; |
1011 | 540 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
541 } while (buf[i++] != '\n'); |
1011 | 542 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
543 buf[--i] = '\0'; |
1301 | 544 g_strchomp(buf); |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
545 g_print("%s\n", buf); |
1105 | 546 |
547 /* Check for errors */ | |
548 | |
549 if (((strstr(buf, "ERROR :") && (!strstr(buf, "PRIVMSG ")) && | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
550 (!strstr(buf, "NOTICE ")) && (strlen(buf) > 7)))) { |
1105 | 551 |
552 gchar *u_errormsg; | |
553 | |
554 /* Let's get our error message */ | |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
555 u_errormsg = g_strdup(buf + 7); |
1105 | 556 |
557 /* We got our error message. Now, let's reaise an | |
558 * error dialog */ | |
559 | |
560 do_error_dialog(u_errormsg, "Gaim: IRC Error"); | |
561 | |
562 /* And our necessary garbage collection */ | |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
563 g_free(u_errormsg); |
1105 | 564 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
565 |
1673 | 566 /* This should be a whois response. I only care about the first (311) one. I might do |
567 * the other's later. They're boring. */ | |
568 | |
569 if (((strstr(buf, " 311 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { | |
570 char **res; | |
571 | |
572 res = g_strsplit(buf, " ", 7); | |
573 | |
574 if (!strcmp(res[1], "311")) | |
575 { | |
576 char buf[8192]; | |
577 | |
578 g_snprintf(buf, 4096, "<b>Nick:</b> %s<br>" | |
579 "<b>Host:</b> %s@%s<br>" | |
580 "<b>Name:</b> %s<br>", res[3], res[4], res[5], res[7]+1); | |
581 | |
582 g_show_info_text(buf); | |
583 } | |
584 | |
585 g_strfreev(res); | |
586 } | |
587 | |
1676 | 588 /* Autoresponse to an away message */ |
589 if (((strstr(buf, " 301 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { | |
590 char **res; | |
591 | |
592 res = g_strsplit(buf, " ", 5); | |
593 | |
594 if (!strcmp(res[1], "301")) | |
1764 | 595 serv_got_im(gc, res[3], res[4] + 1, 1, time((time_t)NULL)); |
1676 | 596 |
597 g_strfreev(res); | |
598 } | |
599 | |
1014 | 600 /* Parse the list of names that we receive when we first sign on to |
601 * a channel */ | |
602 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
603 if (((strstr(buf, " 353 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { |
1014 | 604 gchar u_host[255]; |
605 gchar u_command[32]; | |
606 gchar u_channel[128]; | |
607 gchar u_names[IRC_BUF_LEN + 1]; | |
608 struct conversation *convo = NULL; | |
609 int j; | |
610 | |
611 for (j = 0, i = 0; buf[i] != ' '; j++, i++) { | |
612 u_host[j] = buf[i]; | |
613 } | |
614 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
615 u_host[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
616 i++; |
1014 | 617 |
618 for (j = 0; buf[i] != ' '; j++, i++) { | |
619 u_command[j] = buf[i]; | |
620 } | |
621 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
622 u_command[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
623 i++; |
1014 | 624 |
625 for (j = 0; buf[i] != '#'; j++, i++) { | |
626 } | |
627 i++; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
628 |
1014 | 629 for (j = 0; buf[i] != ':'; j++, i++) { |
630 u_channel[j] = buf[i]; | |
631 } | |
632 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
633 u_channel[j - 1] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
634 i++; |
1014 | 635 |
636 while ((buf[i] == ' ') || (buf[i] == ':')) { | |
637 i++; | |
638 } | |
639 | |
640 strcpy(u_names, buf + i); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
641 |
1014 | 642 buf2 = g_strsplit(u_names, " ", 0); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
643 |
1014 | 644 /* Let's get our conversation window */ |
645 convo = find_conversation_by_name(gc, u_channel); | |
646 | |
647 if (!convo) { | |
648 return; | |
649 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
650 |
1014 | 651 /* Now that we've parsed the hell out of this big |
652 * mess, let's try to split up the names properly */ | |
653 | |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
654 for (i = 0; buf2[i] != NULL; i++) |
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
655 add_chat_buddy(convo, buf2[i]); |
1021 | 656 |
657 /* And free our pointers */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
658 g_strfreev(buf2); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
659 |
1014 | 660 return; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
661 |
1014 | 662 } |
663 | |
1022 | 664 /* Receive a list of users that are currently online */ |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
665 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
666 if (((strstr(buf, " 303 ")) && (!strstr(buf, "PRIVMSG")) && (!strstr(buf, "NOTICE")))) { |
1022 | 667 gchar u_host[255]; |
668 gchar u_command[32]; | |
669 gchar u_names[IRC_BUF_LEN + 1]; | |
670 int j; | |
671 | |
672 for (j = 0, i = 0; buf[i] != ' '; j++, i++) { | |
673 u_host[j] = buf[i]; | |
674 } | |
675 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
676 u_host[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
677 i++; |
1022 | 678 |
679 for (j = 0; buf[i] != ' '; j++, i++) { | |
680 u_command[j] = buf[i]; | |
681 } | |
682 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
683 u_command[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
684 i++; |
1022 | 685 |
686 for (j = 0; buf[i] != ':'; j++, i++) { | |
687 /* My Nick */ | |
688 } | |
689 i++; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
690 |
1022 | 691 strcpy(u_names, buf + i); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
692 |
1022 | 693 buf2 = g_strsplit(u_names, " ", 0); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
694 |
1022 | 695 /* Now that we've parsed the hell out of this big |
696 * mess, let's try to split up the names properly */ | |
697 | |
698 for (i = 0; buf2[i] != NULL; i++) { | |
699 /* If we have a name here then our buddy is online. We should | |
700 * update our temporary gslist accordingly. When we achieve our maximum | |
701 * list of names then we should force an update */ | |
702 | |
703 irc_update_user(gc, buf2[i], 1); | |
704 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
705 |
1022 | 706 /* Increase our received blocks counter */ |
707 idata->recblocks++; | |
708 | |
709 /* If we have our total number of blocks */ | |
710 if (idata->recblocks == idata->totalblocks) { | |
711 GSList *temp; | |
712 struct irc_channel *u; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
713 |
1022 | 714 /* Let's grab our list of people and bring them all on or off line */ |
715 temp = idata->templist; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
716 |
1022 | 717 /* Loop */ |
718 while (temp) { | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
719 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
720 u = temp->data; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
721 |
1022 | 722 /* Tell Gaim to bring the person on or off line */ |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
723 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
|
724 |
1022 | 725 /* Grab the next entry */ |
726 temp = g_slist_next(temp); | |
727 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
728 |
1022 | 729 /* And now, let's delete all of our entries */ |
730 temp = idata->templist; | |
731 while (temp) { | |
732 u = temp->data; | |
733 g_free(u->name); | |
734 temp = g_slist_remove(temp, u); | |
735 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
736 |
1022 | 737 /* Reset our list */ |
738 idata->totalblocks = 0; | |
739 idata->recblocks = 0; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
740 |
1022 | 741 idata->templist = NULL; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
742 |
1022 | 743 return; |
744 } | |
745 | |
746 /* And free our pointers */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
747 g_strfreev(buf2); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
748 |
1022 | 749 return; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
750 |
1022 | 751 } |
752 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
753 |
1831
1b61db419774
[gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
754 if ((strstr(buf, " JOIN ")) && (strstr(buf, "!")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) { |
1011 | 755 |
756 gchar u_channel[128]; | |
1012 | 757 gchar u_nick[128]; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
758 |
1011 | 759 struct irc_channel *channel; |
760 int j; | |
761 | |
1012 | 762 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
763 u_nick[j] = buf[i]; | |
764 } | |
765 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
766 u_nick[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
767 i++; |
1012 | 768 |
769 for (j = 0; buf[i] != '#'; j++, i++) { | |
1011 | 770 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
771 |
1011 | 772 i++; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
773 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
774 strcpy(u_channel, buf + i); |
1011 | 775 |
1301 | 776 g_strchomp(u_channel); |
777 | |
1014 | 778 /* Looks like we're going to join the channel for real |
779 * now. Let's create a valid channel structure and add | |
780 * it to our list. Let's make sure that | |
1011 | 781 * we are not already in a channel first */ |
782 | |
783 channel = find_channel_by_name(gc, u_channel); | |
784 | |
785 if (!channel) { | |
1301 | 786 |
1011 | 787 chat_id++; |
788 | |
789 channel = g_new0(struct irc_channel, 1); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
790 |
1011 | 791 channel->id = chat_id; |
792 channel->name = strdup(u_channel); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
793 |
1011 | 794 idata->channels = g_list_append(idata->channels, channel); |
795 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
796 serv_got_joined_chat(gc, chat_id, u_channel); |
1011 | 797 } else { |
1014 | 798 struct conversation *convo = NULL; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
799 |
1014 | 800 /* Someone else joined. Find their conversation |
801 * window */ | |
802 convo = find_conversation_by_id(gc, channel->id); | |
803 | |
804 /* And add their name to it */ | |
805 add_chat_buddy(convo, u_nick); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
806 |
1011 | 807 } |
808 | |
809 return; | |
810 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
811 |
1831
1b61db419774
[gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
812 if ((strstr(buf, " NICK ")) && (strstr(buf, "!")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) { |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
813 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
814 gchar old[128]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
815 gchar new[128]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
816 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
817 GList *templist; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
818 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
819 struct irc_channel *channel; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
820 int j; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
821 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
822 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
823 old[j] = buf[i]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
824 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
825 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
826 old[j] = '\0'; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
827 i++; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
828 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
829 for (j = 0; buf[i] != ':'; j++, i++) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
830 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
831 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
832 i++; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
833 strcpy(new, buf + i); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
834 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
835 g_strchomp(new); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
836 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
837 templist = ((struct irc_data *)gc->proto_data)->channels; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
838 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
839 while (templist) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
840 struct conversation *convo = NULL; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
841 channel = templist->data; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
842 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
843 convo = find_conversation_by_id(gc, channel->id); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
844 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
845 rename_chat_buddy(convo, old, new); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
846 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
847 templist = templist->next; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
848 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
849 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
850 |
1831
1b61db419774
[gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
851 if ((strstr(buf, "QUIT ")) && (buf[0] == ':') && (strstr(buf, "!")) && (!strstr(buf, " NOTICE "))) { |
1504
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
852 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
853 gchar u_nick[128]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
854 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
855 GList *templist; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
856 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
857 struct irc_channel *channel; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
858 int j; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
859 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
860 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
861 u_nick[j] = buf[i]; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
862 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
863 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
864 u_nick[j] = '\0'; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
865 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
866 templist = ((struct irc_data *)gc->proto_data)->channels; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
867 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
868 while (templist) { |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
869 struct conversation *convo = NULL; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
870 channel = templist->data; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
871 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
872 convo = find_conversation_by_id(gc, channel->id); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
873 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
874 remove_chat_buddy(convo, u_nick); |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
875 |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
876 templist = templist->next; |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
877 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
878 } |
cac3efeb4d9c
[gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
879 |
1831
1b61db419774
[gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
880 if ((strstr(buf, " PART ")) && (strstr(buf, "!")) && (buf[0] == ':') && (!strstr(buf, " NOTICE "))) { |
1011 | 881 |
882 gchar u_channel[128]; | |
883 gchar u_nick[128]; | |
884 | |
1021 | 885 struct irc_channel *channel; |
1011 | 886 int j; |
887 | |
888 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { | |
889 u_nick[j] = buf[i]; | |
890 } | |
891 u_nick[j] = '\0'; | |
892 | |
893 i++; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
894 |
1011 | 895 for (j = 0; buf[i] != '#'; j++, i++) { |
896 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
897 |
1011 | 898 i++; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
899 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
900 strcpy(u_channel, buf + i); |
1011 | 901 |
902 | |
1014 | 903 /* Now, lets check to see if it was US that was leaving. |
904 * If so, do the correct thing by closing up all of our | |
905 * old channel stuff. Otherwise, | |
1011 | 906 * we should just print that someone left */ |
907 | |
1014 | 908 channel = find_channel_by_name(gc, u_channel); |
909 | |
910 if (!channel) { | |
911 return; | |
912 } | |
913 | |
1011 | 914 if (g_strcasecmp(u_nick, gc->username) == 0) { |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
915 |
1014 | 916 /* Looks like we're going to leave the channel for |
917 * real now. Let's create a valid channel structure | |
918 * and add it to our list */ | |
1011 | 919 |
920 serv_got_chat_left(gc, channel->id); | |
921 | |
922 idata->channels = g_list_remove(idata->channels, channel); | |
1014 | 923 } else { |
924 struct conversation *convo = NULL; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
925 |
1014 | 926 /* Find their conversation window */ |
927 convo = find_conversation_by_id(gc, channel->id); | |
928 | |
929 if (!convo) { | |
930 /* Some how the window doesn't exist. | |
931 * Let's get out of here */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
932 return; |
1014 | 933 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
934 |
1014 | 935 /* And remove their name */ |
936 remove_chat_buddy(convo, u_nick); | |
937 | |
1011 | 938 } |
939 | |
1014 | 940 /* Go Home! */ |
1011 | 941 return; |
942 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
943 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
944 if ((strstr(buf, " NOTICE ")) && (buf[0] == ':')) { |
1178 | 945 gchar u_nick[128]; |
946 gchar u_host[255]; | |
947 gchar u_command[32]; | |
948 gchar u_channel[128]; | |
949 gchar u_message[IRC_BUF_LEN]; | |
950 int j; | |
951 | |
952 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { | |
953 u_nick[j] = buf[i]; | |
954 } | |
955 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
956 u_nick[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
957 i++; |
1178 | 958 |
959 for (j = 0; buf[i] != ' '; j++, i++) { | |
960 u_host[j] = buf[i]; | |
961 } | |
962 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
963 u_host[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
964 i++; |
1178 | 965 |
966 for (j = 0; buf[i] != ' '; j++, i++) { | |
967 u_command[j] = buf[i]; | |
968 } | |
969 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
970 u_command[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
971 i++; |
1178 | 972 |
973 for (j = 0; buf[i] != ':'; j++, i++) { | |
974 u_channel[j] = buf[i]; | |
975 } | |
976 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
977 u_channel[j - 1] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
978 i++; |
1178 | 979 |
980 | |
981 /* Now that everything is parsed, the rest of this baby must be our message */ | |
982 strncpy(u_message, buf + i, IRC_BUF_LEN); | |
983 | |
984 /* Now, lets check the message to see if there's anything special in it */ | |
985 if (u_message[0] == '\001') { | |
986 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) { | |
987 /* Someone's triyng to ping us. Let's respond */ | |
988 gchar u_arg[24]; | |
989 gchar u_buf[200]; | |
1393 | 990 unsigned long tend= time((time_t *)NULL); |
991 unsigned long tstart; | |
992 | |
993 printf("LA: %s\n", buf); | |
1178 | 994 |
995 strcpy(u_arg, u_message + 6); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
996 u_arg[strlen(u_arg) - 1] = '\0'; |
1178 | 997 |
1393 | 998 tstart = atol(u_arg); |
999 | |
1000 g_snprintf(u_buf, sizeof(u_buf), "Ping Reply From %s: [%ld seconds]", u_nick, tend-tstart); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1001 |
1178 | 1002 do_error_dialog(u_buf, "Gaim IRC - Ping Reply"); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1003 |
1178 | 1004 return; |
1005 } | |
1006 } | |
1007 | |
1008 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1009 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1010 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1011 if ((strstr(buf, " PRIVMSG ")) && (buf[0] == ':')) { |
1011 | 1012 gchar u_nick[128]; |
1013 gchar u_host[255]; | |
1014 gchar u_command[32]; | |
1015 gchar u_channel[128]; | |
1016 gchar u_message[IRC_BUF_LEN]; | |
1017 int j; | |
1018 | |
1019 for (j = 0, i = 1; buf[i] != '!'; j++, i++) { | |
1020 u_nick[j] = buf[i]; | |
1021 } | |
1022 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1023 u_nick[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1024 i++; |
1011 | 1025 |
1026 for (j = 0; buf[i] != ' '; j++, i++) { | |
1027 u_host[j] = buf[i]; | |
1028 } | |
1029 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1030 u_host[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1031 i++; |
1011 | 1032 |
1033 for (j = 0; buf[i] != ' '; j++, i++) { | |
1034 u_command[j] = buf[i]; | |
1035 } | |
1036 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1037 u_command[j] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1038 i++; |
1011 | 1039 |
1040 for (j = 0; buf[i] != ':'; j++, i++) { | |
1041 u_channel[j] = buf[i]; | |
1042 } | |
1043 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1044 u_channel[j - 1] = '\0'; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1045 i++; |
1011 | 1046 |
1047 | |
1048 /* Now that everything is parsed, the rest of this baby must be our message */ | |
1049 strncpy(u_message, buf + i, IRC_BUF_LEN); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1050 |
1011 | 1051 /* Now, lets check the message to see if there's anything special in it */ |
1052 if (u_message[0] == '\001') { | |
1017 | 1053 if (g_strncasecmp(u_message, "\001VERSION", 8) == 0) { |
1054 /* Looks like we have a version request. Let | |
1055 * us handle it thusly */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1056 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1057 g_snprintf(buf, IRC_BUF_LEN, |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1058 "NOTICE %s :%cVERSION GAIM %s:The Pimpin Penguin AIM Clone:www.marko.net/gaim%c\n", |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1059 u_nick, '\001', VERSION, '\001'); |
1017 | 1060 |
1061 write(idata->fd, buf, strlen(buf)); | |
1062 | |
1063 /* And get the heck out of dodge */ | |
1064 return; | |
1065 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1066 |
1017 | 1067 if ((g_strncasecmp(u_message, "\001PING ", 6) == 0) && (strlen(u_message) > 6)) { |
1068 /* Someone's triyng to ping us. Let's respond */ | |
1069 gchar u_arg[24]; | |
1070 | |
1071 strcpy(u_arg, u_message + 6); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1072 u_arg[strlen(u_arg) - 1] = '\0'; |
1017 | 1073 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1074 g_snprintf(buf, IRC_BUF_LEN, "NOTICE %s :%cPING %s%c\n", u_nick, '\001', |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1075 u_arg, '\001'); |
1017 | 1076 |
1077 write(idata->fd, buf, strlen(buf)); | |
1078 | |
1079 /* And get the heck out of dodge */ | |
1080 return; | |
1081 } | |
1082 | |
1011 | 1083 if (g_strncasecmp(u_message, "\001ACTION ", 8) == 0) { |
1084 /* Looks like we have an action. Let's parse it a little */ | |
1085 strcpy(buf, u_message); | |
1086 | |
1087 strcpy(u_message, "/me "); | |
1088 for (j = 4, i = 8; buf[i] != '\001'; i++, j++) { | |
1089 u_message[j] = buf[i]; | |
1090 } | |
1091 u_message[j] = '\0'; | |
1092 } | |
1093 } | |
1094 | |
1095 | |
1096 /* Let's check to see if we have a channel on our hands */ | |
1097 if (u_channel[0] == '#') { | |
1098 /* Yup. We have a channel */ | |
1099 int id; | |
1100 | |
1101 id = find_id_by_name(gc, u_channel); | |
1102 if (id != -1) { | |
1764 | 1103 serv_got_chat_in(gc, id, u_nick, 0, u_message, time((time_t)NULL)); |
1011 | 1104 } |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1105 } else { |
1011 | 1106 /* Nope. Let's treat it as a private message */ |
1764 | 1107 serv_got_im(gc, u_nick, u_message, 0, time((time_t)NULL)); |
1011 | 1108 } |
1109 | |
1110 return; | |
1111 } | |
1112 | |
1113 /* Let's parse PING requests so that we wont get booted for inactivity */ | |
1114 | |
1115 if (strncmp(buf, "PING :", 6) == 0) { | |
1116 buf2 = g_strsplit(buf, ":", 1); | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1117 |
1011 | 1118 /* Let's build a new response */ |
1119 g_snprintf(buf, IRC_BUF_LEN, "PONG :%s\n", buf2[1]); | |
1120 write(idata->fd, buf, strlen(buf)); | |
1121 | |
1122 /* And clean up after ourselves */ | |
1123 g_strfreev(buf2); | |
1124 | |
1125 return; | |
1126 } | |
1127 | |
1128 } | |
1129 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1130 static void irc_close(struct gaim_connection *gc) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1131 { |
1011 | 1132 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1021 | 1133 GList *chats = idata->channels; |
1134 struct irc_channel *cc; | |
1135 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1136 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN); |
1011 | 1137 |
1021 | 1138 g_snprintf(buf, IRC_BUF_LEN, "QUIT :Download GAIM [www.marko.net/gaim]\n"); |
1011 | 1139 write(idata->fd, buf, strlen(buf)); |
1140 | |
1141 g_free(buf); | |
1021 | 1142 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1143 if (idata->timer) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1144 gtk_timeout_remove(idata->timer); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1145 |
1021 | 1146 while (chats) { |
1147 cc = (struct irc_channel *)chats->data; | |
1148 g_free(cc->name); | |
1149 chats = g_list_remove(chats, cc); | |
1150 g_free(cc); | |
1151 } | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1152 |
1021 | 1153 if (gc->inpa) |
1154 gdk_input_remove(gc->inpa); | |
1155 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1156 if (idata->inpa) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1157 gdk_input_remove(idata->inpa); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1158 |
1011 | 1159 close(idata->fd); |
1160 g_free(gc->proto_data); | |
1161 } | |
1162 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1163 static void irc_chat_leave(struct gaim_connection *gc, int id) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1164 { |
1011 | 1165 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1166 struct irc_channel *channel; | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1167 gchar *buf = (gchar *) g_malloc(IRC_BUF_LEN + 1); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1168 |
1011 | 1169 channel = find_channel_by_id(gc, id); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1170 |
1011 | 1171 if (!channel) { |
1172 return; | |
1173 } | |
1174 | |
1175 g_snprintf(buf, IRC_BUF_LEN, "PART #%s\n", channel->name); | |
1176 write(idata->fd, buf, strlen(buf)); | |
1177 | |
1178 g_free(buf); | |
1179 } | |
1180 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1181 static void irc_login_callback(gpointer data, gint source, GdkInputCondition condition) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1182 { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1183 struct gaim_connection *gc = data; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1184 struct irc_data *idata = gc->proto_data; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1185 char buf[4096]; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1186 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1187 if (source == -1) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1188 hide_login_progress(gc, "Write error"); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1189 signoff(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1190 return; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1191 } |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1192 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1193 if (idata->fd == 0) |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1194 idata->fd = source; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1195 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1196 g_snprintf(buf, 4096, "NICK %s\n USER %s localhost %s :GAIM (www.marko.net/gaim)\n", |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1197 gc->username, g_get_user_name(), gc->user->proto_opt[USEROPT_SERV]); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1198 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1199 if (write(idata->fd, buf, strlen(buf)) < 0) { |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1200 hide_login_progress(gc, "Write error"); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1201 signoff(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1202 return; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1203 } |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1204 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1205 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
|
1206 idata->inpa = 0; |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1207 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1208 /* Now lets sign ourselves on */ |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1209 account_online(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1210 serv_finish_login(gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1211 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1212 if (bud_list_cache_exists(gc)) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1213 do_import(NULL, gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1214 |
1269
677e2c9e8baf
[gaim-migrate @ 1279]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1266
diff
changeset
|
1215 /* we don't call this now because otherwise some IRC servers might not like us */ |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1216 idata->timer = gtk_timeout_add(20000, (GtkFunction)irc_request_buddy_update, gc); |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1217 } |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1218 |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1219 static void irc_login(struct aim_user *user) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1220 { |
1011 | 1221 char buf[4096]; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1222 |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1075
diff
changeset
|
1223 struct gaim_connection *gc = new_gaim_conn(user); |
1011 | 1224 struct irc_data *idata = gc->proto_data = g_new0(struct irc_data, 1); |
1225 | |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1226 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1227 set_login_progress(gc, 2, buf); |
1011 | 1228 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1229 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV], |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1230 user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 6667, |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1231 user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]), |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1232 atoi(user->proto_opt[USEROPT_PROXYTYPE]), |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1233 user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1234 irc_login_callback, gc); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1235 if (idata->fd < 0) { |
1011 | 1236 hide_login_progress(gc, "Unable to create socket"); |
1115
114cd406b022
[gaim-migrate @ 1125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1105
diff
changeset
|
1237 signoff(gc); |
1011 | 1238 return; |
1239 } | |
1240 } | |
1008 | 1241 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1242 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
|
1243 { |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1244 int entrynum; |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1245 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1246 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1247 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1248 if (entrynum == USEROPT_SERV) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1249 g_snprintf(user->proto_opt[USEROPT_SERV], |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1250 sizeof(user->proto_opt[USEROPT_SERV]), "%s", gtk_entry_get_text(entry)); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1251 } else if (entrynum == USEROPT_PORT) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1252 g_snprintf(user->proto_opt[USEROPT_PORT], |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1253 sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry)); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1254 } else if (entrynum == USEROPT_PROXYSERV) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1255 g_snprintf(user->proto_opt[USEROPT_PROXYSERV], |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1256 sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry)); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1257 } else if (entrynum == USEROPT_PROXYPORT) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1258 g_snprintf(user->proto_opt[USEROPT_PROXYPORT], |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1259 sizeof(user->proto_opt[USEROPT_PROXYPORT]), "%s", gtk_entry_get_text(entry)); |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1260 } else if (entrynum == USEROPT_USER) { |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1261 g_snprintf(user->proto_opt[USEROPT_USER], |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1262 sizeof(user->proto_opt[USEROPT_USER]), "%s", gtk_entry_get_text(entry)); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1263 } else if (entrynum == USEROPT_PASS) { |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1264 g_snprintf(user->proto_opt[USEROPT_PASS], |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1265 sizeof(user->proto_opt[USEROPT_PASS]), "%s", gtk_entry_get_text(entry)); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1266 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1267 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1268 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1269 static void irc_print_optionrad(GtkRadioButton * entry, struct aim_user *user) |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1270 { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1271 int entrynum; |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1272 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1273 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1274 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1275 g_snprintf(user->proto_opt[USEROPT_PROXYTYPE], |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1276 sizeof(user->proto_opt[USEROPT_PROXYTYPE]), "%d", entrynum); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1277 } |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1278 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1279 static void irc_user_opts(GtkWidget * book, struct aim_user *user) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1280 { |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1281 /* so here, we create the new notebook page */ |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1282 GtkWidget *vbox; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1283 GtkWidget *hbox; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1284 GtkWidget *label; |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1285 GtkWidget *entry; |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1286 GtkWidget *first, *opt; |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1287 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1288 vbox = gtk_vbox_new(FALSE, 5); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1289 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1290 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
|
1291 gtk_widget_show(vbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1292 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1293 hbox = gtk_hbox_new(FALSE, 5); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1294 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
|
1295 gtk_widget_show(hbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1296 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1297 label = gtk_label_new("Server:"); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1298 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
|
1299 gtk_widget_show(label); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1300 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1301 entry = gtk_entry_new(); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1302 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1303 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
|
1304 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
|
1305 if (user->proto_opt[USEROPT_SERV][0]) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1306 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SERV]); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1307 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
|
1308 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1309 gtk_widget_show(entry); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1310 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1311 hbox = gtk_hbox_new(FALSE, 0); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1312 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
|
1313 gtk_widget_show(hbox); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1314 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1315 label = gtk_label_new("Port:"); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1316 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1317 gtk_widget_show(label); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1318 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1319 entry = gtk_entry_new(); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1320 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1321 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
|
1322 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
|
1323 if (user->proto_opt[USEROPT_PORT][0]) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1324 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1325 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
|
1326 } else |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1327 gtk_entry_set_text(GTK_ENTRY(entry), "9898"); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1328 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1329 gtk_widget_show(entry); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1330 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1331 hbox = gtk_hbox_new(TRUE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1332 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1333 gtk_widget_show(hbox); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1334 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1335 first = gtk_radio_button_new_with_label(NULL, "No proxy"); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1336 gtk_box_pack_start(GTK_BOX(hbox), first, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1337 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1338 gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1339 gtk_widget_show(first); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1340 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE) |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1341 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1342 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1343 opt = |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1344 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4"); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1345 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1346 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1347 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1348 gtk_widget_show(opt); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1349 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4) |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1350 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1351 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1352 hbox = gtk_hbox_new(TRUE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1353 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1354 gtk_widget_show(hbox); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1355 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1356 opt = |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1357 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1358 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1359 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1360 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1361 gtk_widget_show(opt); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1362 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5) |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1363 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1364 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1365 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP"); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1366 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1367 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1368 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1369 gtk_widget_show(opt); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1370 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1371 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1372 |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1373 hbox = gtk_hbox_new(FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1374 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1375 gtk_widget_show(hbox); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1376 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1377 label = gtk_label_new("Proxy Host:"); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1378 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
|
1379 gtk_widget_show(label); |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1380 |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1381 entry = gtk_entry_new(); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1382 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1383 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PROXYSERV); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1384 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1385 if (user->proto_opt[USEROPT_PROXYSERV][0]) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1386 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYSERV]); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1387 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYSERV]); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1388 } |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1389 gtk_widget_show(entry); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1390 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1391 hbox = gtk_hbox_new(FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1392 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1393 gtk_widget_show(hbox); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1394 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1395 label = gtk_label_new("Proxy Port:"); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1396 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1397 gtk_widget_show(label); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1398 |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1399 entry = gtk_entry_new(); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1400 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1401 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PROXYPORT); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1402 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1403 if (user->proto_opt[USEROPT_PROXYPORT][0]) { |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1404 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); |
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1405 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1406 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1407 gtk_widget_show(entry); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1408 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1409 hbox = gtk_hbox_new(FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1410 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1411 gtk_widget_show(hbox); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1412 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1413 label = gtk_label_new("HTTP User:"); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1414 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1415 gtk_widget_show(label); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1416 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1417 entry = gtk_entry_new(); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1418 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1419 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_USER); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1420 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1421 if (user->proto_opt[USEROPT_USER][0]) { |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1422 debug_printf("setting text %s\n", user->proto_opt[USEROPT_USER]); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1423 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_USER]); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1424 } |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1425 gtk_widget_show(entry); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1426 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1427 hbox = gtk_hbox_new(FALSE, 5); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1428 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1429 gtk_widget_show(hbox); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1430 |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1431 label = gtk_label_new("HTTP Password:"); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1432 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1433 gtk_widget_show(label); |
1842
1d137dde946f
[gaim-migrate @ 1852]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1831
diff
changeset
|
1434 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1435 entry = gtk_entry_new(); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1436 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1437 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1438 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PASS); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1439 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1440 if (user->proto_opt[USEROPT_PASS][0]) { |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1441 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PASS]); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1442 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PASS]); |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1443 } |
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1842
diff
changeset
|
1444 gtk_widget_show(entry); |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1445 } |
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1446 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1447 static char **irc_list_icon(int uc) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1448 { |
1178 | 1449 return free_icon_xpm; |
1450 } | |
1451 | |
1452 /* Send out a ping request to the specified user */ | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1453 static void irc_send_ping(GtkObject * w, char *who) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1454 { |
1178 | 1455 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); |
1456 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
1457 char buf[BUF_LEN]; | |
1458 | |
1393 | 1459 g_snprintf(buf, BUF_LEN, "PRIVMSG %s :%cPING %ld%c\n", who, '\001', time((time_t *)NULL), '\001'); |
1178 | 1460 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1461 write(idata->fd, buf, strlen(buf)); |
1178 | 1462 } |
1463 | |
1673 | 1464 /* Do a whois check on someone :-) */ |
1465 static void irc_get_info(struct gaim_connection *gc, char *who) | |
1466 { | |
1467 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
1468 char buf[BUF_LEN]; | |
1469 | |
1831
1b61db419774
[gaim-migrate @ 1841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1470 if (((who[0] == '@') || (who[0] == '+')) && (strlen(who)>1)) |
1673 | 1471 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who+1); |
1472 else | |
1473 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who); | |
1474 write(idata->fd, buf, strlen(buf)); | |
1475 } | |
1476 | |
1477 static void irc_send_whois(GtkObject * w, char *who) | |
1478 { | |
1479 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); | |
1480 irc_get_info(gc, who); | |
1481 } | |
1178 | 1482 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
1483 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
|
1484 { |
1178 | 1485 GtkWidget *button; |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1486 |
1178 | 1487 button = gtk_menu_item_new_with_label("Ping"); |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1488 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_ping), who); |
1178 | 1489 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
1490 gtk_menu_append(GTK_MENU(menu), button); | |
1491 gtk_widget_show(button); | |
1673 | 1492 |
1493 button = gtk_menu_item_new_with_label("Whois"); | |
1494 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_whois), who); | |
1495 gtk_object_set_user_data(GTK_OBJECT(button), gc); | |
1496 gtk_menu_append(GTK_MENU(menu), button); | |
1497 gtk_widget_show(button); | |
1178 | 1498 } |
1499 | |
1500 | |
1676 | 1501 static void irc_set_away(struct gaim_connection *gc, char *state, char *msg) |
1502 { | |
1503 struct irc_data *idata = (struct irc_data *)gc->proto_data; | |
1504 char buf[BUF_LEN]; | |
1505 | |
1506 if (msg) | |
1507 g_snprintf(buf, BUF_LEN, "AWAY :%s\n", msg); | |
1508 else | |
1509 g_snprintf(buf, BUF_LEN, "AWAY\n"); | |
1510 | |
1511 write(idata->fd, buf, strlen(buf)); | |
1512 } | |
1513 | |
1678 | 1514 static void irc_fake_buddy(struct gaim_connection *gc, char *who) |
1515 { | |
1516 /* Heh, there is no buddy list. We fake it. | |
1517 * I just need this here so the add and remove buttons will | |
1518 * show up */ | |
1519 } | |
1520 | |
1521 | |
1522 | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1523 static struct prpl *my_protocol = NULL; |
987 | 1524 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1525 static void irc_init(struct prpl *ret) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1526 { |
1008 | 1527 ret->protocol = PROTO_IRC; |
1528 ret->name = irc_name; | |
1178 | 1529 ret->list_icon = irc_list_icon; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
1530 ret->buddy_menu = irc_buddy_menu; |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1056
diff
changeset
|
1531 ret->user_opts = irc_user_opts; |
1008 | 1532 ret->login = irc_login; |
1011 | 1533 ret->close = irc_close; |
1534 ret->send_im = irc_send_im; | |
1535 ret->join_chat = irc_join_chat; | |
1536 ret->chat_leave = irc_chat_leave; | |
1537 ret->chat_send = irc_chat_send; | |
1673 | 1538 ret->get_info = irc_get_info; |
1676 | 1539 ret->set_away = irc_set_away; |
1678 | 1540 ret->add_buddy = irc_fake_buddy; |
1541 ret->remove_buddy = irc_fake_buddy; | |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1542 |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1543 my_protocol = ret; |
987 | 1544 } |
1545 | |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1546 char *gaim_plugin_init(GModule * handle) |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1547 { |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1394
diff
changeset
|
1548 load_protocol(irc_init, sizeof(struct prpl)); |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1549 return NULL; |
987 | 1550 } |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1551 |
1266
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1552 void gaim_plugin_remove() |
aac04affc65d
[gaim-migrate @ 1276]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1265
diff
changeset
|
1553 { |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1554 struct prpl *p = find_prpl(PROTO_IRC); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1555 if (p == my_protocol) |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1556 unload_protocol(p); |
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1046
diff
changeset
|
1557 } |