Mercurial > pidgin
annotate src/protocols/irc/msgs.c @ 9554:8b2451878e26
[gaim-migrate @ 10387]
" This patch adds chat user status icons (voice / halfop
/ op / founder) to chats
There's a screenshot here, showing ops, voices and
ignored ops and voices
http://nosnilmot.com/gaim/chatusers.png
This required some changes in how the core stores the
list of users in chats to be able to store the status
too, which are detailed below.
I also fixed up some memory leaks as I came across them
(string values returned by gtk_tree_model_get() not
being g_free()'d) and a minor bug in signals-test.c
Conversation API:
Changed:
gaim_conv_chat_add_user() (added flags parameter)
gaim_conv_chat_add_users() now (added GList of flags
parameter)
gaim_conv_chat_get_users() now returns a GList of
GaimChatBuddy's
gaim_conv_chat_set_users() now expects a GList of
GaimChatBuddy's
Added:
gaim_conv_chat_set_user_flags()
gaim_conv_chat_get_user_flags()
gaim_conv_chat_find_user()
gaim_conv_chat_cb_new()
gaim_conv_chat_cb_find()
gaim_conv_chat_cb_destroy()
gaim_conv_chat_cb_get_name()
Conversation UI ops:
added: chat_update_user()
Signals:
Changed: chat-buddy-joining & chat-buddy-joined now
include the user's flags
Added: chat-buddy-flags for when user's flags change
Added:
gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT
(required for the new chat-buddy-flags signal)
Protocol Plugins:
All updated to work with above changes (obviously)
User flags support added to IRC, Jabber and SILC
New Files:
pixmaps/status/default/ voice.svg halfop.svg op.svg
founder.svg
" --Stu Tomlinson
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sat, 17 Jul 2004 18:11:12 +0000 |
parents | 6c24a6f07256 |
children | f1137cf462d8 |
rev | line source |
---|---|
6333 | 1 /** |
2 * @file msgs.c | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu> | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 | |
23 #include "internal.h" | |
24 | |
25 #include "conversation.h" | |
26 #include "blist.h" | |
27 #include "notify.h" | |
28 #include "util.h" | |
29 #include "debug.h" | |
30 #include "irc.h" | |
31 | |
32 #include <stdio.h> | |
33 | |
34 static char *irc_mask_nick(const char *mask); | |
35 static char *irc_mask_userhost(const char *mask); | |
36 static void irc_chat_remove_buddy(GaimConversation *convo, char *data[2]); | |
37 static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc); | |
38 | |
39 static char *irc_mask_nick(const char *mask) | |
40 { | |
41 char *end, *buf; | |
42 | |
43 end = strchr(mask, '!'); | |
44 if (!end) | |
45 buf = g_strdup(mask); | |
46 else | |
47 buf = g_strndup(mask, end - mask); | |
48 | |
49 return buf; | |
50 } | |
51 | |
52 static char *irc_mask_userhost(const char *mask) | |
53 { | |
54 return g_strdup(strchr(mask, '!') + 1); | |
55 } | |
56 | |
57 static void irc_chat_remove_buddy(GaimConversation *convo, char *data[2]) | |
58 { | |
59 char *message = g_strdup_printf("quit: %s", data[1]); | |
60 | |
9554 | 61 if (gaim_conv_chat_find_user(GAIM_CONV_CHAT(convo), data[0])) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
62 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), data[0], message); |
6333 | 63 |
64 g_free(message); | |
65 } | |
66 | |
67 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) | |
68 { | |
69 gaim_debug(GAIM_DEBUG_INFO, "irc", "Unrecognized message: %s\n", args[0]); | |
70 } | |
71 | |
72 void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args) | |
73 { | |
74 GaimConnection *gc; | |
75 | |
76 if (!args || !args[1]) | |
77 return; | |
78 | |
79 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { | |
80 /* We're doing a whois, show this in the whois dialog */ | |
81 irc_msg_whois(irc, name, from, args); | |
82 return; | |
83 } | |
84 | |
85 gc = gaim_account_get_connection(irc->account); | |
86 if (gc) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
87 serv_got_im(gc, args[1], args[2], GAIM_CONV_IM_AUTO_RESP, time(NULL)); |
6333 | 88 } |
89 | |
90 void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args) | |
91 { | |
92 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
93 | |
94 if (!args || !args[1] || !gc) | |
95 return; | |
96 | |
97 gaim_notify_error(gc, NULL, _("Bad mode"), args[1]); | |
98 } | |
99 | |
100 void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args) | |
101 { | |
102 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
103 char *buf; | |
104 | |
105 if (!args || !args[1] || !gc) | |
106 return; | |
107 | |
108 buf = g_strdup_printf(_("You are banned from %s."), args[1]); | |
109 gaim_notify_error(gc, _("Banned"), _("Banned"), buf); | |
110 g_free(buf); | |
111 } | |
112 | |
113 void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args) | |
114 { | |
115 GaimConversation *convo; | |
116 char *buf; | |
117 | |
118 if (!args || !args[1] || !args[2]) | |
119 return; | |
120 | |
121 convo = gaim_find_conversation_with_account(args[1], irc->account); | |
122 if (!convo) /* XXX punt on channels we are not in for now */ | |
123 return; | |
124 | |
125 buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], args[3] ? args[3] : ""); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
126 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 127 g_free(buf); |
128 | |
129 return; | |
130 } | |
131 | |
132 void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args) | |
133 { | |
134 if (!irc->whois.nick) { | |
135 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected WHOIS reply for %s\n", args[1]); | |
136 return; | |
137 } | |
138 | |
139 if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { | |
140 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Got WHOIS reply for %s while waiting for %s\n", args[1], irc->whois.nick); | |
141 return; | |
142 } | |
143 | |
144 if (!strcmp(name, "301")) { | |
145 irc->whois.away = g_strdup(args[2]); | |
146 } else if (!strcmp(name, "311")) { | |
147 irc->whois.userhost = g_strdup_printf("%s@%s", args[2], args[3]); | |
148 irc->whois.name = g_strdup(args[5]); | |
149 } else if (!strcmp(name, "312")) { | |
150 irc->whois.server = g_strdup(args[2]); | |
151 irc->whois.serverinfo = g_strdup(args[3]); | |
152 } else if (!strcmp(name, "313")) { | |
153 irc->whois.ircop = 1; | |
154 } else if (!strcmp(name, "317")) { | |
155 irc->whois.idle = atoi(args[2]); | |
156 if (args[3]) | |
157 irc->whois.signon = (time_t)atoi(args[3]); | |
158 } else if (!strcmp(name, "319")) { | |
159 irc->whois.channels = g_strdup(args[2]); | |
160 } else if (!strcmp(name, "320")) { | |
161 irc->whois.identified = 1; | |
162 } | |
163 } | |
164 | |
165 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args) | |
166 { | |
167 GaimConnection *gc; | |
168 GString *info; | |
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
169 char buffer[256]; |
6333 | 170 char *str; |
171 | |
172 if (!irc->whois.nick) { | |
173 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected End of WHOIS for %s\n", args[1]); | |
174 return; | |
175 } | |
176 if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { | |
177 gaim_debug(GAIM_DEBUG_WARNING, "irc", "Received end of WHOIS for %s, expecting %s\n", args[1], irc->whois.nick); | |
178 return; | |
179 } | |
180 | |
181 info = g_string_new(""); | |
182 g_string_append_printf(info, "<b>%s:</b> %s%s%s<br>", _("Nick"), args[1], | |
183 irc->whois.ircop ? _(" <i>(ircop)</i>") : "", | |
184 irc->whois.identified ? _(" <i>(identified)</i>") : ""); | |
185 if (irc->whois.away) { | |
186 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Away"), irc->whois.away); | |
187 g_free(irc->whois.away); | |
188 } | |
189 if (irc->whois.userhost) { | |
190 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Username"), irc->whois.userhost); | |
191 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Realname"), irc->whois.name); | |
192 g_free(irc->whois.userhost); | |
193 g_free(irc->whois.name); | |
194 } | |
195 if (irc->whois.server) { | |
196 g_string_append_printf(info, "<b>%s:</b> %s (%s)<br>", _("Server"), irc->whois.server, irc->whois.serverinfo); | |
197 g_free(irc->whois.server); | |
198 g_free(irc->whois.serverinfo); | |
199 } | |
200 if (irc->whois.channels) { | |
201 g_string_append_printf(info, "<b>%s:</b> %s<br>", _("Currently on"), irc->whois.channels); | |
202 g_free(irc->whois.channels); | |
203 } | |
204 if (irc->whois.idle) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
205 gchar *timex = gaim_str_seconds_to_string(irc->whois.idle); |
6357 | 206 g_string_append_printf(info, _("<b>Idle for:</b> %s<br>"), timex); |
207 g_free(timex); | |
6333 | 208 g_string_append_printf(info, "<b>%s:</b> %s", _("Online since"), ctime(&irc->whois.signon)); |
209 } | |
210 if (!strcmp(irc->whois.nick, "Paco-Paco")) { | |
211 g_string_append_printf(info, _("<br><b>Defining adjective:</b> Glorious<br>")); | |
212 } | |
213 | |
214 gc = gaim_account_get_connection(irc->account); | |
215 str = g_string_free(info, FALSE); | |
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
216 |
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
217 g_snprintf(buffer, sizeof(buffer), |
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
218 _("Buddy Information for %s"), irc->whois.nick); |
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
219 gaim_notify_formatted(gc, NULL, buffer, NULL, str, NULL, NULL); |
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
220 |
6333 | 221 g_free(str); |
222 memset(&irc->whois, 0, sizeof(irc->whois)); | |
223 } | |
224 | |
8114 | 225 void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args) |
226 { | |
227 if (!irc->roomlist) | |
228 return; | |
229 | |
230 if (!strcmp(name, "321")) { | |
231 gaim_roomlist_set_in_progress(irc->roomlist, TRUE); | |
232 return; | |
233 } | |
234 | |
235 if (!strcmp(name, "323")) { | |
236 gaim_roomlist_set_in_progress(irc->roomlist, FALSE); | |
237 gaim_roomlist_unref(irc->roomlist); | |
238 irc->roomlist = NULL; | |
239 } | |
240 | |
241 if (!strcmp(name, "322")) { | |
242 GaimRoomlistRoom *room; | |
243 | |
244 if (!args[0] || !args[1] || !args[2] || !args[3]) | |
245 return; | |
246 | |
247 room = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL); | |
248 gaim_roomlist_room_add_field(irc->roomlist, room, args[1]); | |
249 gaim_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10))); | |
250 gaim_roomlist_room_add_field(irc->roomlist, room, args[3]); | |
251 gaim_roomlist_room_add(irc->roomlist, room); | |
252 } | |
253 } | |
254 | |
6333 | 255 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args) |
256 { | |
8504 | 257 char *chan, *topic, *msg, *nick, *tmp; |
6333 | 258 GaimConversation *convo; |
259 | |
260 if (!strcmp(name, "topic")) { | |
261 chan = args[0]; | |
8529 | 262 topic = irc_mirc2txt (args[1]); |
6333 | 263 } else { |
264 chan = args[1]; | |
8529 | 265 topic = irc_mirc2txt (args[2]); |
6333 | 266 } |
267 | |
268 convo = gaim_find_conversation_with_account(chan, irc->account); | |
269 if (!convo) { | |
270 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan); | |
271 } | |
9518 | 272 |
6333 | 273 /* If this is an interactive update, print it out */ |
8504 | 274 tmp = gaim_escape_html(topic); |
6333 | 275 if (!strcmp(name, "topic")) { |
276 nick = irc_mask_nick(from); | |
9518 | 277 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic); |
8504 | 278 msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick, tmp); |
6333 | 279 g_free(nick); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
280 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); |
6333 | 281 g_free(msg); |
282 } else { | |
8504 | 283 msg = g_strdup_printf(_("The topic for %s is: %s"), chan, tmp); |
9518 | 284 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
285 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM, time(NULL)); |
6333 | 286 g_free(msg); |
287 } | |
8504 | 288 g_free(tmp); |
8529 | 289 g_free(topic); |
6333 | 290 } |
291 | |
292 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args) | |
293 { | |
294 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
295 char *buf; | |
296 | |
297 if (!args || !args[1] || !gc) | |
298 return; | |
299 | |
300 buf = g_strdup_printf(_("Unknown message '%s'"), args[1]); | |
301 gaim_notify_error(gc, _("Unknown message"), buf, _("Gaim has sent a message the IRC server did not understand.")); | |
302 g_free(buf); | |
303 } | |
304 | |
305 void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args) | |
306 { | |
307 char *names, *cur, *end, *tmp, *msg; | |
308 GaimConversation *convo; | |
309 | |
310 if (!strcmp(name, "366")) { | |
311 convo = gaim_find_conversation_with_account(irc->nameconv ? irc->nameconv : args[1], irc->account); | |
312 if (!convo) { | |
313 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[2]); | |
314 g_string_free(irc->names, TRUE); | |
315 irc->names = NULL; | |
316 g_free(irc->nameconv); | |
317 irc->nameconv = NULL; | |
318 return; | |
319 } | |
320 | |
321 names = cur = g_string_free(irc->names, FALSE); | |
322 irc->names = NULL; | |
323 if (irc->nameconv) { | |
9274 | 324 msg = g_strdup_printf(_("Users on %s: %s"), args[1], names); |
6333 | 325 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
326 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 327 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
328 gaim_conv_im_write(GAIM_CONV_IM(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 329 g_free(msg); |
330 g_free(irc->nameconv); | |
331 irc->nameconv = NULL; | |
332 } else { | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
333 GList *users = NULL; |
9554 | 334 GList *flags = NULL; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
335 |
6333 | 336 while (*cur) { |
9554 | 337 GaimConvChatBuddyFlags f = GAIM_CBFLAGS_NONE; |
6333 | 338 end = strchr(cur, ' '); |
339 if (!end) | |
340 end = cur + strlen(cur); | |
9554 | 341 if (*cur == '@') { |
342 f = GAIM_CBFLAGS_OP; | |
6333 | 343 cur++; |
9554 | 344 } else if (*cur == '%') { |
345 f = GAIM_CBFLAGS_HALFOP; | |
346 cur++; | |
347 } else if(*cur == '+') { | |
348 f = GAIM_CBFLAGS_VOICE; | |
349 cur++; | |
350 } | |
6333 | 351 tmp = g_strndup(cur, end - cur); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
352 users = g_list_append(users, tmp); |
9554 | 353 flags = g_list_append(flags, GINT_TO_POINTER(f)); |
6333 | 354 cur = end; |
355 if (*cur) | |
356 cur++; | |
357 } | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
358 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
359 if (users != NULL) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
360 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
361 |
9554 | 362 gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users, flags); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
363 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
364 for (l = users; l != NULL; l = l->next) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
365 g_free(l->data); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
366 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
367 g_list_free(users); |
9554 | 368 g_list_free(flags); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
369 } |
6333 | 370 } |
371 g_free(names); | |
372 } else { | |
373 if (!irc->names) | |
374 irc->names = g_string_new(""); | |
375 | |
376 irc->names = g_string_append(irc->names, args[3]); | |
377 } | |
378 } | |
379 | |
380 void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args) | |
381 { | |
382 GaimConnection *gc; | |
383 if (!strcmp(name, "375")) { | |
384 gc = gaim_account_get_connection(irc->account); | |
385 if (gc) | |
386 gaim_connection_set_display_name(gc, args[0]); | |
387 } | |
388 | |
389 if (!irc->motd) | |
390 irc->motd = g_string_new(""); | |
391 | |
392 g_string_append_printf(irc->motd, "%s<br>", args[1]); | |
393 } | |
394 | |
395 void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args) | |
396 { | |
397 GaimConnection *gc; | |
398 | |
399 gc = gaim_account_get_connection(irc->account); | |
400 if (!gc) | |
401 return; | |
402 | |
403 gaim_connection_set_state(gc, GAIM_CONNECTED); | |
9057 | 404 serv_finish_login (gc); |
6333 | 405 |
406 irc_blist_timeout(irc); | |
8872 | 407 if (!irc->timer) |
408 irc->timer = gaim_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc); | |
6333 | 409 } |
410 | |
7877 | 411 void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args) |
412 { | |
413 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
414 | |
415 if (gc == NULL || args == NULL || args[1] == NULL) | |
416 return; | |
417 | |
418 gaim_notify_error(gc, NULL, _("No such channel"), args[1]); | |
419 } | |
420 | |
6333 | 421 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) |
422 { | |
423 GaimConnection *gc; | |
424 GaimConversation *convo; | |
425 | |
426 convo = gaim_find_conversation_with_account(args[1], irc->account); | |
427 if (convo) { | |
428 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
429 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"), |
6621 | 430 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 431 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
432 gaim_conv_im_write(GAIM_CONV_IM(convo), args[1], _("User is not logged in"), |
6621 | 433 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 434 } else { |
435 if ((gc = gaim_account_get_connection(irc->account)) == NULL) | |
436 return; | |
437 gaim_notify_error(gc, NULL, _("No such nick or channel"), args[1]); | |
438 } | |
439 | |
440 if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { | |
441 g_free(irc->whois.nick); | |
442 irc->whois.nick = NULL; | |
443 } | |
444 } | |
445 | |
446 void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args) | |
447 { | |
448 GaimConnection *gc; | |
449 GaimConversation *convo; | |
450 | |
451 convo = gaim_find_conversation_with_account(args[1], irc->account); | |
452 if (convo) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
453 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 454 } else { |
455 if ((gc = gaim_account_get_connection(irc->account)) == NULL) | |
456 return; | |
457 gaim_notify_error(gc, NULL, _("Could not send"), args[2]); | |
458 } | |
459 } | |
460 | |
461 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) | |
462 { | |
463 GaimConversation *convo = gaim_find_conversation_with_account(args[1], irc->account); | |
464 | |
465 gaim_debug(GAIM_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]); | |
466 if (convo) { | |
467 /*g_slist_remove(irc->gc->buddy_chats, convo); | |
468 gaim_conversation_set_account(convo, NULL);*/ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
469 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 470 } |
471 } | |
472 | |
473 void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args) | |
474 { | |
475 GaimConversation *convo; | |
476 | |
477 if (!args || !args[1] || !args[2]) | |
478 return; | |
479 | |
480 convo = gaim_find_conversation_with_account(args[1], irc->account); | |
481 if (!convo) | |
482 return; | |
483 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
484 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", args[2], GAIM_MESSAGE_SYSTEM, time(NULL)); |
6333 | 485 } |
486 | |
487 void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args) | |
488 { | |
489 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
490 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
491 char *nick = irc_mask_nick(from); | |
492 | |
493 if (!args || !args[1] || !gc) { | |
494 g_free(nick); | |
495 g_hash_table_destroy(components); | |
496 return; | |
497 } | |
498 | |
499 g_hash_table_insert(components, strdup("channel"), strdup(args[1])); | |
500 | |
501 serv_got_chat_invite(gc, args[1], nick, NULL, components); | |
502 g_free(nick); | |
503 } | |
504 | |
505 void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args) | |
506 { | |
507 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
508 char *buf; | |
509 | |
510 if (!args || !args[1] || !gc) | |
511 return; | |
512 | |
513 buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]); | |
514 gaim_notify_error(gc, _("Invitation only"), _("Invitation only"), buf); | |
515 g_free(buf); | |
516 } | |
517 | |
518 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args) | |
519 { | |
520 char **nicks; | |
521 struct irc_buddy *ib; | |
522 int i; | |
523 | |
524 if (!args || !args[1]) | |
525 return; | |
526 | |
527 nicks = g_strsplit(args[1], " ", -1); | |
528 | |
529 for (i = 0; nicks[i]; i++) { | |
530 if ((ib = g_hash_table_lookup(irc->buddies, (gconstpointer)nicks[i])) == NULL) { | |
531 continue; | |
532 } | |
533 ib->flag = TRUE; | |
534 } | |
535 | |
6350 | 536 g_strfreev(nicks); |
537 | |
6333 | 538 g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_status, (gpointer)irc); |
539 } | |
540 | |
541 static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc) | |
542 { | |
543 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
6695 | 544 GaimBuddy *buddy = gaim_find_buddy(irc->account, name); |
6333 | 545 |
546 if (!gc || !buddy) | |
547 return; | |
548 | |
549 if (ib->online && !ib->flag) { | |
550 serv_got_update(gc, buddy->name, 0, 0, 0, 0, 0); | |
551 ib->online = FALSE; | |
552 } | |
553 | |
554 if (!ib->online && ib->flag) { | |
555 serv_got_update(gc, buddy->name, 1, 0, 0, 0, 0); | |
556 ib->online = TRUE; | |
557 } | |
558 } | |
559 | |
560 void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args) | |
561 { | |
562 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
563 GaimConversation *convo; | |
564 char *nick = irc_mask_nick(from), *userhost; | |
9238 | 565 struct irc_buddy *ib; |
6333 | 566 static int id = 1; |
567 | |
568 if (!gc) { | |
569 g_free(nick); | |
570 return; | |
571 } | |
572 | |
573 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) { | |
574 /* We are joining a channel for the first time */ | |
575 serv_got_joined_chat(gc, id++, args[0]); | |
576 g_free(nick); | |
577 return; | |
578 } | |
579 | |
580 convo = gaim_find_conversation_with_account(args[0], irc->account); | |
581 if (convo == NULL) { | |
582 gaim_debug(GAIM_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]); | |
583 g_free(nick); | |
584 return; | |
585 } | |
586 | |
587 userhost = irc_mask_userhost(from); | |
9554 | 588 gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), nick, userhost, GAIM_CBFLAGS_NONE); |
9238 | 589 |
590 if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) { | |
591 ib->flag = TRUE; | |
592 irc_buddy_status(nick, ib, irc); | |
593 } | |
594 | |
6333 | 595 g_free(userhost); |
596 g_free(nick); | |
597 } | |
598 | |
599 void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) | |
600 { | |
601 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
602 GaimConversation *convo = gaim_find_conversation_with_account(args[0], irc->account); | |
603 char *nick = irc_mask_nick(from), *buf; | |
604 | |
605 if (!gc) { | |
606 g_free(nick); | |
607 return; | |
608 } | |
609 | |
610 if (!convo) { | |
611 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Recieved a KICK for unknown channel %s\n", args[0]); | |
612 g_free(nick); | |
613 return; | |
614 } | |
615 | |
616 if (!gaim_utf8_strcasecmp(gaim_connection_get_display_name(gc), args[1])) { | |
617 buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
618 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
6333 | 619 g_free(buf); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8186
diff
changeset
|
620 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo))); |
6333 | 621 } else { |
622 buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
623 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), args[1], buf); |
6333 | 624 g_free(buf); |
625 } | |
626 | |
627 g_free(nick); | |
628 return; | |
629 } | |
630 | |
631 void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args) | |
632 { | |
633 GaimConversation *convo; | |
634 char *nick = irc_mask_nick(from), *buf; | |
635 | |
636 if (*args[0] == '#' || *args[0] == '&') { /* Channel */ | |
637 convo = gaim_find_conversation_with_account(args[0], irc->account); | |
638 if (!convo) { | |
639 gaim_debug(GAIM_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]); | |
640 g_free(nick); | |
641 return; | |
642 } | |
643 buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], args[2] ? args[2] : "", nick); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
644 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 645 g_free(buf); |
9554 | 646 if(args[2]) { |
647 GaimConvChatBuddyFlags newflag, flags; | |
648 char *mcur, *cur, *end, *user; | |
649 gboolean add = FALSE; | |
650 mcur = args[1]; | |
651 cur = args[2]; | |
652 while (*cur && *mcur) { | |
653 if ((*mcur == '+') || (*mcur == '-')) { | |
654 add = (*mcur == '+') ? TRUE : FALSE; | |
655 mcur++; | |
656 continue; | |
657 } | |
658 end = strchr(cur, ' '); | |
659 if (!end) | |
660 end = cur + strlen(cur); | |
661 user = g_strndup(cur, end - cur); | |
662 flags = gaim_conv_chat_user_get_flags(GAIM_CONV_CHAT(convo), user); | |
663 newflag = GAIM_CBFLAGS_NONE; | |
664 if (*mcur == 'o') | |
665 newflag = GAIM_CBFLAGS_OP; | |
666 else if (*mcur =='h') | |
667 newflag = GAIM_CBFLAGS_HALFOP; | |
668 else if (*mcur == 'v') | |
669 newflag = GAIM_CBFLAGS_VOICE; | |
670 if (newflag) { | |
671 if (add) | |
672 flags |= newflag; | |
673 else | |
674 flags &= ~newflag; | |
675 gaim_conv_chat_user_set_flags(GAIM_CONV_CHAT(convo), user, flags); | |
676 } | |
677 g_free(user); | |
678 cur = end; | |
679 if (*cur) | |
680 cur++; | |
681 if (*mcur) | |
682 mcur++; | |
683 } | |
684 } | |
6333 | 685 } else { /* User */ |
686 } | |
687 g_free(nick); | |
688 } | |
689 | |
690 void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args) | |
691 { | |
692 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
693 GSList *chats; | |
694 char *nick = irc_mask_nick(from); | |
695 | |
696 if (!gc) { | |
697 g_free(nick); | |
698 return; | |
699 } | |
700 chats = gc->buddy_chats; | |
701 | |
702 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) { | |
703 gaim_connection_set_display_name(gc, args[0]); | |
704 } | |
705 | |
706 while (chats) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
707 GaimConvChat *chat = GAIM_CONV_CHAT(chats->data); |
9554 | 708 gaim_conv_chat_rename_user(chat, nick, args[0]); |
6333 | 709 chats = chats->next; |
710 } | |
711 g_free(nick); | |
712 } | |
713 | |
714 void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args) | |
715 { | |
716 char *newnick, *buf, *end; | |
717 | |
718 if (!args || !args[1]) | |
719 return; | |
720 | |
721 newnick = strdup(args[1]); | |
722 end = newnick + strlen(newnick) - 1; | |
723 /* try three fallbacks */ | |
724 if (*end == 2) *end = '3'; | |
725 else if (*end == 1) *end = '2'; | |
726 else *end = '1'; | |
727 | |
728 buf = irc_format(irc, "vn", "NICK", newnick); | |
729 irc_send(irc, buf); | |
730 g_free(buf); | |
731 } | |
732 | |
733 void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args) | |
734 { | |
735 char *newargs[2]; | |
736 | |
737 newargs[0] = " notice "; /* The spaces are magic, leave 'em in! */ | |
738 newargs[1] = args[1]; | |
739 irc_msg_privmsg(irc, name, from, newargs); | |
740 } | |
741 | |
6718 | 742 void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args) |
743 { | |
744 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
745 char *msg; | |
746 | |
6753 | 747 if (!args || !args[2] || !gc) |
6718 | 748 return; |
749 | |
6753 | 750 msg = g_strdup_printf(_("Could not change nick")); |
6718 | 751 gaim_notify_error(gc, _("Cannot change nick"), msg, args[2]); |
752 g_free(msg); | |
753 } | |
754 | |
6333 | 755 void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args) |
756 { | |
757 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
758 GaimConversation *convo; | |
759 char *nick, *msg; | |
760 | |
8186 | 761 if (!args || !args[0] || !gc) |
6333 | 762 return; |
763 | |
764 convo = gaim_find_conversation_with_account(args[0], irc->account); | |
765 if (!convo) { | |
766 gaim_debug(GAIM_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", args[0]); | |
767 return; | |
768 } | |
769 | |
770 nick = irc_mask_nick(from); | |
771 if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) { | |
8186 | 772 msg = g_strdup_printf(_("You have parted the channel%s%s"), |
773 (args[1] && *args[1]) ? ": " : "", args[1]); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
774 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], msg, GAIM_MESSAGE_SYSTEM, time(NULL)); |
6333 | 775 g_free(msg); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8186
diff
changeset
|
776 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo))); |
6333 | 777 } else { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
778 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), nick, args[1]); |
6333 | 779 } |
780 g_free(nick); | |
781 } | |
782 | |
783 void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args) | |
784 { | |
785 char *buf; | |
786 if (!args || !args[0]) | |
787 return; | |
788 | |
789 buf = irc_format(irc, "v:", "PONG", args[0]); | |
790 irc_send(irc, buf); | |
791 g_free(buf); | |
792 } | |
793 | |
794 void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args) | |
795 { | |
796 GaimConversation *convo; | |
797 GaimConnection *gc; | |
798 char **parts, *msg; | |
799 time_t oldstamp; | |
800 | |
801 if (!args || !args[1]) | |
802 return; | |
803 | |
804 parts = g_strsplit(args[1], " ", 2); | |
805 | |
806 if (!parts[0] || !parts[1]) { | |
807 g_strfreev(parts); | |
808 return; | |
809 } | |
810 | |
811 if (sscanf(parts[1], "%lu", &oldstamp) != 1) { | |
812 msg = g_strdup(_("Error: invalid PONG from server")); | |
813 } else { | |
6350 | 814 msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp); |
6333 | 815 } |
816 | |
817 convo = gaim_find_conversation_with_account(parts[0], irc->account); | |
818 g_strfreev(parts); | |
819 if (convo) { | |
820 if (gaim_conversation_get_type (convo) == GAIM_CONV_CHAT) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
821 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 822 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
823 gaim_conv_im_write(GAIM_CONV_IM(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
6333 | 824 } else { |
825 gc = gaim_account_get_connection(irc->account); | |
826 if (!gc) { | |
827 g_free(msg); | |
828 return; | |
829 } | |
830 gaim_notify_info(gc, NULL, "PONG", msg); | |
831 } | |
832 g_free(msg); | |
833 } | |
834 | |
835 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args) | |
836 { | |
837 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
838 GaimConversation *convo; | |
839 char *nick = irc_mask_nick(from), *tmp, *msg; | |
840 int notice = 0; | |
841 | |
842 if (!args || !args[0] || !args[1] || !gc) { | |
843 g_free(nick); | |
844 return; | |
845 } | |
846 | |
847 notice = !strcmp(args[0], " notice "); | |
848 tmp = irc_parse_ctcp(irc, nick, args[0], args[1], notice); | |
849 if (!tmp) { | |
850 g_free(nick); | |
851 return; | |
852 } | |
8163 | 853 |
854 msg = gaim_escape_html(tmp); | |
6333 | 855 g_free(tmp); |
8163 | 856 |
857 tmp = irc_mirc2html(msg); | |
858 g_free(msg); | |
859 msg = tmp; | |
6333 | 860 if (notice) { |
861 tmp = g_strdup_printf("(notice) %s", msg); | |
862 g_free(msg); | |
863 msg = tmp; | |
864 } | |
865 | |
866 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) { | |
6982 | 867 serv_got_im(gc, nick, msg, 0, time(NULL)); |
6333 | 868 } else if (notice) { |
6982 | 869 serv_got_im(gc, nick, msg, 0, time(NULL)); |
6333 | 870 } else { |
871 convo = gaim_find_conversation_with_account(args[0], irc->account); | |
872 if (convo) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
873 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); |
6333 | 874 else |
875 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a PRIVMSG on %s, which does not exist\n", args[0]); | |
876 } | |
877 g_free(msg); | |
878 g_free(nick); | |
879 } | |
880 | |
6714 | 881 void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args) |
882 { | |
883 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
884 char *msg; | |
885 | |
886 if (!args || !args[1] || !args[2] || !gc) | |
887 return; | |
888 | |
889 msg = g_strdup_printf(_("Cannot join %s:"), args[1]); | |
890 gaim_notify_error(gc, _("Cannot join channel"), msg, args[2]); | |
891 g_free(msg); | |
892 } | |
893 | |
6333 | 894 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args) |
895 { | |
896 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
9238 | 897 struct irc_buddy *ib; |
6333 | 898 char *data[2]; |
899 | |
900 if (!args || !args[0] || !gc) | |
901 return; | |
902 | |
903 data[0] = irc_mask_nick(from); | |
904 data[1] = args[0]; | |
905 /* XXX this should have an API, I shouldn't grab this directly */ | |
906 g_slist_foreach(gc->buddy_chats, (GFunc)irc_chat_remove_buddy, data); | |
9238 | 907 |
908 if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) { | |
909 ib->flag = FALSE; | |
910 irc_buddy_status(data[0], ib, irc); | |
911 } | |
6333 | 912 g_free(data[0]); |
913 | |
914 return; | |
915 } | |
916 | |
917 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args) | |
918 { | |
919 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
8965 | 920 char *nick, *msg, *wallop; |
6333 | 921 |
922 if (!args || !args[0] || !gc) | |
923 return; | |
924 | |
925 nick = irc_mask_nick(from); | |
926 msg = g_strdup_printf (_("Wallops from %s"), nick); | |
927 g_free(nick); | |
8965 | 928 wallop = g_markup_escape_text(args[0], strlen(args[0])); |
929 gaim_notify_info(gc, NULL, msg, wallop); | |
6333 | 930 g_free(msg); |
8965 | 931 g_free(wallop); |
6333 | 932 } |
933 | |
934 void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args) | |
935 { | |
936 return; | |
937 } |