Sun, 06 Mar 2005 16:32:40 +0000
[gaim-migrate @ 12192]
478: ban list full on HEAD
| 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
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
61 | if (gaim_conv_chat_find_user(GAIM_CONV_CHAT(convo), data[0])) |
|
7118
280b3b85a28a
[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
280b3b85a28a
[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 | ||
|
10659
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
113 | void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args) |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
114 | { |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
115 | GaimConversation *convo; |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
116 | char *buf, *nick; |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
117 | |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
118 | if (!args || !args[0] || !args[1] || !args[2]) |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
119 | return; |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
120 | |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
121 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
122 | if (!convo) |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
123 | return; |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
124 | |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
125 | nick = g_markup_escape_text(args[2], -1); |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
126 | buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick); |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
127 | g_free(nick); |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
128 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", buf, |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
129 | GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
130 | time(NULL)); |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
131 | g_free(buf); |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
132 | } |
|
caf16376fba0
[gaim-migrate @ 12192]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10637
diff
changeset
|
133 | |
| 6333 | 134 | void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 135 | { | |
| 136 | GaimConversation *convo; | |
| 137 | char *buf; | |
| 138 | ||
| 139 | if (!args || !args[1] || !args[2]) | |
| 140 | return; | |
| 141 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
142 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); |
| 6333 | 143 | if (!convo) /* XXX punt on channels we are not in for now */ |
| 144 | return; | |
| 145 | ||
| 146 | buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], args[3] ? args[3] : ""); | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
147 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 148 | g_free(buf); |
| 149 | ||
| 150 | return; | |
| 151 | } | |
| 152 | ||
| 153 | void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 154 | { | |
| 155 | if (!irc->whois.nick) { | |
| 156 | gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected WHOIS reply for %s\n", args[1]); | |
| 157 | return; | |
| 158 | } | |
| 159 | ||
| 160 | if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { | |
| 161 | gaim_debug(GAIM_DEBUG_WARNING, "irc", "Got WHOIS reply for %s while waiting for %s\n", args[1], irc->whois.nick); | |
| 162 | return; | |
| 163 | } | |
| 164 | ||
| 165 | if (!strcmp(name, "301")) { | |
| 166 | irc->whois.away = g_strdup(args[2]); | |
| 167 | } else if (!strcmp(name, "311")) { | |
| 168 | irc->whois.userhost = g_strdup_printf("%s@%s", args[2], args[3]); | |
| 169 | irc->whois.name = g_strdup(args[5]); | |
| 170 | } else if (!strcmp(name, "312")) { | |
| 171 | irc->whois.server = g_strdup(args[2]); | |
| 172 | irc->whois.serverinfo = g_strdup(args[3]); | |
| 173 | } else if (!strcmp(name, "313")) { | |
| 174 | irc->whois.ircop = 1; | |
| 175 | } else if (!strcmp(name, "317")) { | |
| 176 | irc->whois.idle = atoi(args[2]); | |
| 177 | if (args[3]) | |
| 178 | irc->whois.signon = (time_t)atoi(args[3]); | |
| 179 | } else if (!strcmp(name, "319")) { | |
| 180 | irc->whois.channels = g_strdup(args[2]); | |
| 181 | } else if (!strcmp(name, "320")) { | |
| 182 | irc->whois.identified = 1; | |
| 183 | } | |
| 184 | } | |
| 185 | ||
| 186 | void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 187 | { | |
| 188 | GaimConnection *gc; | |
| 189 | GString *info; | |
|
7062
26abb8b189ce
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
190 | char buffer[256]; |
| 10634 | 191 | char *str, *tmp; |
| 6333 | 192 | |
| 193 | if (!irc->whois.nick) { | |
| 194 | gaim_debug(GAIM_DEBUG_WARNING, "irc", "Unexpected End of WHOIS for %s\n", args[1]); | |
| 195 | return; | |
| 196 | } | |
| 197 | if (gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { | |
| 198 | gaim_debug(GAIM_DEBUG_WARNING, "irc", "Received end of WHOIS for %s, expecting %s\n", args[1], irc->whois.nick); | |
| 199 | return; | |
| 200 | } | |
| 201 | ||
| 202 | info = g_string_new(""); | |
| 10634 | 203 | tmp = g_markup_escape_text(args[1], -1); |
| 204 | g_string_append_printf(info, _("<b>%s:</b> %s"), _("Nick"), tmp); | |
| 205 | g_free(tmp); | |
| 9558 | 206 | g_string_append_printf(info, "%s%s<br>", |
| 6333 | 207 | irc->whois.ircop ? _(" <i>(ircop)</i>") : "", |
| 208 | irc->whois.identified ? _(" <i>(identified)</i>") : ""); | |
| 209 | if (irc->whois.away) { | |
| 10634 | 210 | tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away)); |
| 6333 | 211 | g_free(irc->whois.away); |
|
9589
229d4c811c01
[gaim-migrate @ 10432]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9558
diff
changeset
|
212 | g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Away"), tmp); |
|
229d4c811c01
[gaim-migrate @ 10432]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9558
diff
changeset
|
213 | g_free(tmp); |
| 6333 | 214 | } |
| 215 | if (irc->whois.userhost) { | |
| 10634 | 216 | tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name)); |
|
9589
229d4c811c01
[gaim-migrate @ 10432]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9558
diff
changeset
|
217 | g_free(irc->whois.name); |
| 9558 | 218 | g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Username"), irc->whois.userhost); |
|
9589
229d4c811c01
[gaim-migrate @ 10432]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9558
diff
changeset
|
219 | g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Realname"), tmp); |
| 6333 | 220 | g_free(irc->whois.userhost); |
|
9589
229d4c811c01
[gaim-migrate @ 10432]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9558
diff
changeset
|
221 | g_free(tmp); |
| 6333 | 222 | } |
| 223 | if (irc->whois.server) { | |
| 9558 | 224 | g_string_append_printf(info, _("<b>%s:</b> %s"), _("Server"), irc->whois.server); |
| 225 | g_string_append_printf(info, " (%s)<br>", irc->whois.serverinfo); | |
| 6333 | 226 | g_free(irc->whois.server); |
| 227 | g_free(irc->whois.serverinfo); | |
| 228 | } | |
| 229 | if (irc->whois.channels) { | |
| 9558 | 230 | g_string_append_printf(info, _("<b>%s:</b> %s<br>"), _("Currently on"), irc->whois.channels); |
| 6333 | 231 | g_free(irc->whois.channels); |
| 232 | } | |
| 233 | if (irc->whois.idle) { | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
234 | gchar *timex = gaim_str_seconds_to_string(irc->whois.idle); |
|
6357
f83643b0a067
[gaim-migrate @ 6856]
Mark Doliner <markdoliner@pidgin.im>
parents:
6351
diff
changeset
|
235 | g_string_append_printf(info, _("<b>Idle for:</b> %s<br>"), timex); |
|
f83643b0a067
[gaim-migrate @ 6856]
Mark Doliner <markdoliner@pidgin.im>
parents:
6351
diff
changeset
|
236 | g_free(timex); |
| 9558 | 237 | g_string_append_printf(info, _("<b>%s:</b> %s"), _("Online since"), ctime(&irc->whois.signon)); |
| 6333 | 238 | } |
| 239 | if (!strcmp(irc->whois.nick, "Paco-Paco")) { | |
| 240 | g_string_append_printf(info, _("<br><b>Defining adjective:</b> Glorious<br>")); | |
| 241 | } | |
| 242 | ||
| 243 | gc = gaim_account_get_connection(irc->account); | |
| 244 | str = g_string_free(info, FALSE); | |
|
7062
26abb8b189ce
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
245 | |
|
26abb8b189ce
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
246 | g_snprintf(buffer, sizeof(buffer), |
|
26abb8b189ce
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
247 | _("Buddy Information for %s"), irc->whois.nick); |
| 9797 | 248 | gaim_notify_userinfo(gc, irc->whois.nick, NULL, buffer, NULL, str, NULL, NULL); |
|
7062
26abb8b189ce
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
249 | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10246
diff
changeset
|
250 | g_free(irc->whois.nick); |
| 6333 | 251 | g_free(str); |
| 252 | memset(&irc->whois, 0, sizeof(irc->whois)); | |
| 253 | } | |
| 254 | ||
| 8114 | 255 | void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 256 | { | |
| 257 | if (!irc->roomlist) | |
| 258 | return; | |
| 259 | ||
| 260 | if (!strcmp(name, "321")) { | |
| 261 | gaim_roomlist_set_in_progress(irc->roomlist, TRUE); | |
| 262 | return; | |
| 263 | } | |
| 264 | ||
| 265 | if (!strcmp(name, "323")) { | |
| 266 | gaim_roomlist_set_in_progress(irc->roomlist, FALSE); | |
| 267 | gaim_roomlist_unref(irc->roomlist); | |
| 268 | irc->roomlist = NULL; | |
| 269 | } | |
| 270 | ||
| 271 | if (!strcmp(name, "322")) { | |
| 272 | GaimRoomlistRoom *room; | |
| 273 | ||
| 274 | if (!args[0] || !args[1] || !args[2] || !args[3]) | |
| 275 | return; | |
| 276 | ||
| 277 | room = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL); | |
| 278 | gaim_roomlist_room_add_field(irc->roomlist, room, args[1]); | |
| 279 | gaim_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10))); | |
| 280 | gaim_roomlist_room_add_field(irc->roomlist, room, args[3]); | |
| 281 | gaim_roomlist_room_add(irc->roomlist, room); | |
| 282 | } | |
| 283 | } | |
| 284 | ||
| 6333 | 285 | void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 286 | { | |
| 9762 | 287 | char *chan, *topic, *msg, *nick, *tmp, *tmp2; |
| 6333 | 288 | GaimConversation *convo; |
| 289 | ||
| 290 | if (!strcmp(name, "topic")) { | |
| 291 | chan = args[0]; | |
| 8529 | 292 | topic = irc_mirc2txt (args[1]); |
| 6333 | 293 | } else { |
| 294 | chan = args[1]; | |
| 8529 | 295 | topic = irc_mirc2txt (args[2]); |
| 6333 | 296 | } |
| 297 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
298 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, chan, irc->account); |
| 6333 | 299 | if (!convo) { |
| 300 | gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan); | |
| 301 | } | |
| 9518 | 302 | |
| 6333 | 303 | /* If this is an interactive update, print it out */ |
| 8504 | 304 | tmp = gaim_escape_html(topic); |
| 9762 | 305 | tmp2 = gaim_markup_linkify(tmp); |
| 306 | g_free(tmp); | |
| 6333 | 307 | if (!strcmp(name, "topic")) { |
| 308 | nick = irc_mask_nick(from); | |
| 9518 | 309 | gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), nick, topic); |
| 9762 | 310 | msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick, tmp2); |
| 6333 | 311 | g_free(nick); |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
312 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 6333 | 313 | g_free(msg); |
| 314 | } else { | |
| 9762 | 315 | msg = g_strdup_printf(_("The topic for %s is: %s"), chan, tmp2); |
| 9518 | 316 | gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, topic); |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
317 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 6333 | 318 | g_free(msg); |
| 319 | } | |
| 9762 | 320 | g_free(tmp2); |
| 8529 | 321 | g_free(topic); |
| 6333 | 322 | } |
| 323 | ||
| 324 | void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 325 | { | |
| 326 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 327 | char *buf; | |
| 328 | ||
| 329 | if (!args || !args[1] || !gc) | |
| 330 | return; | |
| 331 | ||
| 332 | buf = g_strdup_printf(_("Unknown message '%s'"), args[1]); | |
| 333 | gaim_notify_error(gc, _("Unknown message"), buf, _("Gaim has sent a message the IRC server did not understand.")); | |
| 334 | g_free(buf); | |
| 335 | } | |
| 336 | ||
| 337 | void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 338 | { | |
| 339 | char *names, *cur, *end, *tmp, *msg; | |
| 340 | GaimConversation *convo; | |
| 341 | ||
| 342 | if (!strcmp(name, "366")) { | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
343 | convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, irc->nameconv ? irc->nameconv : args[1], irc->account); |
| 6333 | 344 | if (!convo) { |
| 345 | gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[2]); | |
| 346 | g_string_free(irc->names, TRUE); | |
| 347 | irc->names = NULL; | |
| 348 | g_free(irc->nameconv); | |
| 349 | irc->nameconv = NULL; | |
| 350 | return; | |
| 351 | } | |
| 352 | ||
| 353 | names = cur = g_string_free(irc->names, FALSE); | |
| 354 | irc->names = NULL; | |
| 355 | if (irc->nameconv) { | |
| 9274 | 356 | msg = g_strdup_printf(_("Users on %s: %s"), args[1], names); |
| 6333 | 357 | if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
358 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 359 | else |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
360 | gaim_conv_im_write(GAIM_CONV_IM(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 361 | g_free(msg); |
| 362 | g_free(irc->nameconv); | |
| 363 | irc->nameconv = NULL; | |
| 364 | } else { | |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
365 | GList *users = NULL; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
366 | GList *flags = NULL; |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
367 | |
| 6333 | 368 | while (*cur) { |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
369 | GaimConvChatBuddyFlags f = GAIM_CBFLAGS_NONE; |
| 6333 | 370 | end = strchr(cur, ' '); |
| 371 | if (!end) | |
| 372 | end = cur + strlen(cur); | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
373 | if (*cur == '@') { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
374 | f = GAIM_CBFLAGS_OP; |
| 6333 | 375 | cur++; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
376 | } else if (*cur == '%') { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
377 | f = GAIM_CBFLAGS_HALFOP; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
378 | cur++; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
379 | } else if(*cur == '+') { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
380 | f = GAIM_CBFLAGS_VOICE; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
381 | cur++; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
382 | } |
| 6333 | 383 | tmp = g_strndup(cur, end - cur); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
384 | users = g_list_append(users, tmp); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
385 | flags = g_list_append(flags, GINT_TO_POINTER(f)); |
| 6333 | 386 | cur = end; |
| 387 | if (*cur) | |
| 388 | cur++; | |
| 389 | } | |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
390 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
391 | if (users != NULL) { |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
392 | GList *l; |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
393 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
394 | gaim_conv_chat_add_users(GAIM_CONV_CHAT(convo), users, flags); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
395 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
396 | for (l = users; l != NULL; l = l->next) |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
397 | g_free(l->data); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
398 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
399 | g_list_free(users); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
400 | g_list_free(flags); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
401 | } |
| 6333 | 402 | } |
| 403 | g_free(names); | |
| 404 | } else { | |
| 405 | if (!irc->names) | |
| 406 | irc->names = g_string_new(""); | |
| 407 | ||
| 408 | irc->names = g_string_append(irc->names, args[3]); | |
| 409 | } | |
| 410 | } | |
| 411 | ||
| 412 | void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 413 | { | |
| 414 | GaimConnection *gc; | |
| 415 | if (!strcmp(name, "375")) { | |
| 416 | gc = gaim_account_get_connection(irc->account); | |
| 417 | if (gc) | |
| 418 | gaim_connection_set_display_name(gc, args[0]); | |
| 419 | } | |
| 420 | ||
| 421 | if (!irc->motd) | |
| 422 | irc->motd = g_string_new(""); | |
| 423 | ||
| 424 | g_string_append_printf(irc->motd, "%s<br>", args[1]); | |
| 425 | } | |
| 426 | ||
| 427 | void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 428 | { | |
| 429 | GaimConnection *gc; | |
| 430 | ||
| 431 | gc = gaim_account_get_connection(irc->account); | |
| 432 | if (!gc) | |
| 433 | return; | |
| 434 | ||
| 435 | gaim_connection_set_state(gc, GAIM_CONNECTED); | |
| 9057 | 436 | serv_finish_login (gc); |
| 6333 | 437 | |
| 438 | irc_blist_timeout(irc); | |
| 8872 | 439 | if (!irc->timer) |
| 440 | irc->timer = gaim_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc); | |
| 6333 | 441 | } |
| 442 | ||
| 10564 | 443 | void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 444 | { | |
| 445 | GaimConnection *gc; | |
| 446 | ||
| 447 | gc = gaim_account_get_connection(irc->account); | |
| 448 | if (gc == NULL || args == NULL || args[2] == NULL) | |
| 449 | return; | |
| 450 | ||
| 451 | gaim_notify_message(gc, GAIM_NOTIFY_MSG_INFO, _("Time Response"), | |
| 452 | _("The IRC server's local time is:"), | |
| 453 | args[2], NULL, NULL); | |
| 454 | } | |
| 455 | ||
| 7877 | 456 | void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 457 | { | |
| 458 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 459 | ||
| 460 | if (gc == NULL || args == NULL || args[1] == NULL) | |
| 461 | return; | |
| 462 | ||
| 463 | gaim_notify_error(gc, NULL, _("No such channel"), args[1]); | |
| 464 | } | |
| 465 | ||
| 6333 | 466 | void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 467 | { | |
| 468 | GaimConnection *gc; | |
| 469 | GaimConversation *convo; | |
| 10634 | 470 | char *nick; |
| 6333 | 471 | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
472 | convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, args[1], irc->account); |
| 6333 | 473 | if (convo) { |
| 474 | if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */ | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
475 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"), |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6407
diff
changeset
|
476 | GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 477 | else |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
478 | gaim_conv_im_write(GAIM_CONV_IM(convo), args[1], _("User is not logged in"), |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6407
diff
changeset
|
479 | GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 480 | } else { |
| 481 | if ((gc = gaim_account_get_connection(irc->account)) == NULL) | |
| 482 | return; | |
| 10637 | 483 | nick = g_markup_escape_text(args[1], -1); |
| 10634 | 484 | gaim_notify_error(gc, NULL, _("No such nick or channel"), nick); |
| 485 | g_free(nick); | |
| 6333 | 486 | } |
| 487 | ||
| 488 | if (irc->whois.nick && !gaim_utf8_strcasecmp(irc->whois.nick, args[1])) { | |
| 489 | g_free(irc->whois.nick); | |
| 490 | irc->whois.nick = NULL; | |
| 491 | } | |
| 492 | } | |
| 493 | ||
| 494 | void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 495 | { | |
| 496 | GaimConnection *gc; | |
| 497 | GaimConversation *convo; | |
| 498 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
499 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); |
| 6333 | 500 | if (convo) { |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
501 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 502 | } else { |
| 503 | if ((gc = gaim_account_get_connection(irc->account)) == NULL) | |
| 504 | return; | |
| 505 | gaim_notify_error(gc, NULL, _("Could not send"), args[2]); | |
| 506 | } | |
| 507 | } | |
| 508 | ||
| 509 | void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 510 | { | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
511 | GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); |
| 6333 | 512 | |
| 513 | gaim_debug(GAIM_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]); | |
| 514 | if (convo) { | |
| 515 | /*g_slist_remove(irc->gc->buddy_chats, convo); | |
| 516 | gaim_conversation_set_account(convo, NULL);*/ | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
517 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 518 | } |
| 519 | } | |
| 520 | ||
| 521 | void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 522 | { | |
| 523 | GaimConversation *convo; | |
| 524 | ||
| 525 | if (!args || !args[1] || !args[2]) | |
| 526 | return; | |
| 527 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
528 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); |
| 6333 | 529 | if (!convo) |
| 530 | return; | |
| 531 | ||
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
532 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", args[2], GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 6333 | 533 | } |
| 534 | ||
| 535 | void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 536 | { | |
| 537 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 538 | GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 539 | char *nick = irc_mask_nick(from); | |
| 540 | ||
| 541 | if (!args || !args[1] || !gc) { | |
| 542 | g_free(nick); | |
| 543 | g_hash_table_destroy(components); | |
| 544 | return; | |
| 545 | } | |
| 546 | ||
| 547 | g_hash_table_insert(components, strdup("channel"), strdup(args[1])); | |
| 548 | ||
| 549 | serv_got_chat_invite(gc, args[1], nick, NULL, components); | |
| 550 | g_free(nick); | |
| 551 | } | |
| 552 | ||
| 553 | void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 554 | { | |
| 555 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 556 | char *buf; | |
| 557 | ||
| 558 | if (!args || !args[1] || !gc) | |
| 559 | return; | |
| 560 | ||
| 561 | buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]); | |
| 562 | gaim_notify_error(gc, _("Invitation only"), _("Invitation only"), buf); | |
| 563 | g_free(buf); | |
| 564 | } | |
| 565 | ||
| 566 | void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 567 | { | |
| 568 | char **nicks; | |
| 569 | struct irc_buddy *ib; | |
| 570 | int i; | |
| 571 | ||
| 572 | if (!args || !args[1]) | |
| 573 | return; | |
| 574 | ||
| 575 | nicks = g_strsplit(args[1], " ", -1); | |
| 576 | ||
| 577 | for (i = 0; nicks[i]; i++) { | |
| 578 | if ((ib = g_hash_table_lookup(irc->buddies, (gconstpointer)nicks[i])) == NULL) { | |
| 579 | continue; | |
| 580 | } | |
| 581 | ib->flag = TRUE; | |
| 582 | } | |
| 583 | ||
| 6350 | 584 | g_strfreev(nicks); |
| 585 | ||
| 6333 | 586 | g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_status, (gpointer)irc); |
| 587 | } | |
| 588 | ||
| 589 | static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc) | |
| 590 | { | |
| 591 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 6695 | 592 | GaimBuddy *buddy = gaim_find_buddy(irc->account, name); |
| 6333 | 593 | |
| 594 | if (!gc || !buddy) | |
| 595 | return; | |
| 596 | ||
| 597 | if (ib->online && !ib->flag) { | |
| 10242 | 598 | gaim_prpl_got_user_status(irc->account, name, "offline", NULL); |
| 6333 | 599 | ib->online = FALSE; |
| 10242 | 600 | } else if (!ib->online && ib->flag) { |
| 601 | gaim_prpl_got_user_status(irc->account, name, "online", NULL); | |
| 6333 | 602 | ib->online = TRUE; |
| 603 | } | |
| 604 | } | |
| 605 | ||
| 606 | void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 607 | { | |
| 608 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 609 | GaimConversation *convo; | |
| 610 | char *nick = irc_mask_nick(from), *userhost; | |
| 9238 | 611 | struct irc_buddy *ib; |
| 6333 | 612 | static int id = 1; |
| 613 | ||
| 614 | if (!gc) { | |
| 615 | g_free(nick); | |
| 616 | return; | |
| 617 | } | |
| 618 | ||
| 619 | if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) { | |
| 620 | /* We are joining a channel for the first time */ | |
| 621 | serv_got_joined_chat(gc, id++, args[0]); | |
| 622 | g_free(nick); | |
| 623 | return; | |
| 624 | } | |
| 625 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
626 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); |
| 6333 | 627 | if (convo == NULL) { |
| 628 | gaim_debug(GAIM_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]); | |
| 629 | g_free(nick); | |
| 630 | return; | |
| 631 | } | |
| 632 | ||
| 633 | userhost = irc_mask_userhost(from); | |
|
9846
61f7349c153a
[gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9797
diff
changeset
|
634 | gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), nick, userhost, GAIM_CBFLAGS_NONE, TRUE); |
| 9238 | 635 | |
| 636 | if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) { | |
| 637 | ib->flag = TRUE; | |
| 638 | irc_buddy_status(nick, ib, irc); | |
| 639 | } | |
| 640 | ||
| 6333 | 641 | g_free(userhost); |
| 642 | g_free(nick); | |
| 643 | } | |
| 644 | ||
| 645 | void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 646 | { | |
| 647 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
648 | GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); |
| 6333 | 649 | char *nick = irc_mask_nick(from), *buf; |
| 650 | ||
| 651 | if (!gc) { | |
| 652 | g_free(nick); | |
| 653 | return; | |
| 654 | } | |
| 655 | ||
| 656 | if (!convo) { | |
| 657 | gaim_debug(GAIM_DEBUG_ERROR, "irc", "Recieved a KICK for unknown channel %s\n", args[0]); | |
| 658 | g_free(nick); | |
| 659 | return; | |
| 660 | } | |
| 661 | ||
| 662 | if (!gaim_utf8_strcasecmp(gaim_connection_get_display_name(gc), args[1])) { | |
| 663 | buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]); | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
664 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 6333 | 665 | g_free(buf); |
| 8256 | 666 | serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo))); |
| 6333 | 667 | } else { |
| 668 | buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]); | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
669 | gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), args[1], buf); |
| 6333 | 670 | g_free(buf); |
| 671 | } | |
| 672 | ||
| 673 | g_free(nick); | |
| 674 | return; | |
| 675 | } | |
| 676 | ||
| 677 | void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 678 | { | |
| 679 | GaimConversation *convo; | |
| 680 | char *nick = irc_mask_nick(from), *buf; | |
| 681 | ||
| 682 | if (*args[0] == '#' || *args[0] == '&') { /* Channel */ | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
683 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); |
| 6333 | 684 | if (!convo) { |
| 685 | gaim_debug(GAIM_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]); | |
| 686 | g_free(nick); | |
| 687 | return; | |
| 688 | } | |
| 689 | buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], args[2] ? args[2] : "", nick); | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
690 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 691 | g_free(buf); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
692 | if(args[2]) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
693 | GaimConvChatBuddyFlags newflag, flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
694 | char *mcur, *cur, *end, *user; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
695 | gboolean add = FALSE; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
696 | mcur = args[1]; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
697 | cur = args[2]; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
698 | while (*cur && *mcur) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
699 | if ((*mcur == '+') || (*mcur == '-')) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
700 | add = (*mcur == '+') ? TRUE : FALSE; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
701 | mcur++; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
702 | continue; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
703 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
704 | end = strchr(cur, ' '); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
705 | if (!end) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
706 | end = cur + strlen(cur); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
707 | user = g_strndup(cur, end - cur); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
708 | flags = gaim_conv_chat_user_get_flags(GAIM_CONV_CHAT(convo), user); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
709 | newflag = GAIM_CBFLAGS_NONE; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
710 | if (*mcur == 'o') |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
711 | newflag = GAIM_CBFLAGS_OP; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
712 | else if (*mcur =='h') |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
713 | newflag = GAIM_CBFLAGS_HALFOP; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
714 | else if (*mcur == 'v') |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
715 | newflag = GAIM_CBFLAGS_VOICE; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
716 | if (newflag) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
717 | if (add) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
718 | flags |= newflag; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
719 | else |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
720 | flags &= ~newflag; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
721 | gaim_conv_chat_user_set_flags(GAIM_CONV_CHAT(convo), user, flags); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
722 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
723 | g_free(user); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
724 | cur = end; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
725 | if (*cur) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
726 | cur++; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
727 | if (*mcur) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
728 | mcur++; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
729 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9518
diff
changeset
|
730 | } |
| 6333 | 731 | } else { /* User */ |
| 732 | } | |
| 733 | g_free(nick); | |
| 734 | } | |
| 735 | ||
| 736 | void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 737 | { | |
| 738 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 10617 | 739 | GaimConversation *conv; |
| 6333 | 740 | GSList *chats; |
| 741 | char *nick = irc_mask_nick(from); | |
| 742 | ||
| 743 | if (!gc) { | |
| 744 | g_free(nick); | |
| 745 | return; | |
| 746 | } | |
| 747 | chats = gc->buddy_chats; | |
| 748 | ||
| 749 | if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) { | |
| 750 | gaim_connection_set_display_name(gc, args[0]); | |
| 751 | } | |
| 752 | ||
| 753 | while (chats) { | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
754 | GaimConvChat *chat = GAIM_CONV_CHAT(chats->data); |
| 9593 | 755 | /* This is ugly ... */ |
| 756 | if (gaim_conv_chat_find_user(chat, nick)) | |
| 757 | gaim_conv_chat_rename_user(chat, nick, args[0]); | |
| 6333 | 758 | chats = chats->next; |
| 759 | } | |
| 10617 | 760 | |
| 761 | conv = gaim_find_conversation_with_account(GAIM_CONV_IM, nick, | |
| 762 | irc->account); | |
| 763 | if (conv != NULL) | |
| 764 | gaim_conversation_set_name(conv, args[0]); | |
| 765 | ||
| 6333 | 766 | g_free(nick); |
| 767 | } | |
| 768 | ||
| 10633 | 769 | void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 770 | { | |
| 771 | gaim_connection_error(gaim_account_get_connection(irc->account), | |
| 772 | _("Your selected account name was rejected by the server. It probably contains invalid characters.")); | |
| 773 | } | |
| 774 | ||
| 6333 | 775 | void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 776 | { | |
| 777 | char *newnick, *buf, *end; | |
| 778 | ||
| 779 | if (!args || !args[1]) | |
| 780 | return; | |
| 781 | ||
| 782 | newnick = strdup(args[1]); | |
| 783 | end = newnick + strlen(newnick) - 1; | |
| 784 | /* try three fallbacks */ | |
| 785 | if (*end == 2) *end = '3'; | |
| 786 | else if (*end == 1) *end = '2'; | |
| 787 | else *end = '1'; | |
| 788 | ||
| 789 | buf = irc_format(irc, "vn", "NICK", newnick); | |
| 790 | irc_send(irc, buf); | |
| 791 | g_free(buf); | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10246
diff
changeset
|
792 | g_free(newnick); |
| 6333 | 793 | } |
| 794 | ||
| 795 | void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 796 | { | |
| 797 | char *newargs[2]; | |
| 798 | ||
| 799 | newargs[0] = " notice "; /* The spaces are magic, leave 'em in! */ | |
| 800 | newargs[1] = args[1]; | |
| 801 | irc_msg_privmsg(irc, name, from, newargs); | |
| 802 | } | |
| 803 | ||
| 6718 | 804 | void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 805 | { | |
| 806 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 807 | char *msg; | |
| 808 | ||
| 6753 | 809 | if (!args || !args[2] || !gc) |
| 6718 | 810 | return; |
| 811 | ||
| 6753 | 812 | msg = g_strdup_printf(_("Could not change nick")); |
| 6718 | 813 | gaim_notify_error(gc, _("Cannot change nick"), msg, args[2]); |
| 814 | g_free(msg); | |
| 815 | } | |
| 816 | ||
| 6333 | 817 | void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 818 | { | |
| 819 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 820 | GaimConversation *convo; | |
| 821 | char *nick, *msg; | |
| 822 | ||
| 8186 | 823 | if (!args || !args[0] || !gc) |
| 6333 | 824 | return; |
| 825 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
826 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); |
| 6333 | 827 | if (!convo) { |
| 828 | gaim_debug(GAIM_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", args[0]); | |
| 829 | return; | |
| 830 | } | |
| 831 | ||
| 832 | nick = irc_mask_nick(from); | |
| 833 | if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) { | |
| 8186 | 834 | msg = g_strdup_printf(_("You have parted the channel%s%s"), |
|
10551
9a6a1e333609
[gaim-migrate @ 11926]
Daniel Atallah <datallah@pidgin.im>
parents:
10504
diff
changeset
|
835 | (args[1] && *args[1]) ? ": " : "", |
|
9a6a1e333609
[gaim-migrate @ 11926]
Daniel Atallah <datallah@pidgin.im>
parents:
10504
diff
changeset
|
836 | (args[1] && *args[1]) ? args[1] : ""); |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
837 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[0], msg, GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 6333 | 838 | g_free(msg); |
| 8256 | 839 | serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo))); |
| 6333 | 840 | } else { |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
841 | gaim_conv_chat_remove_user(GAIM_CONV_CHAT(convo), nick, args[1]); |
| 6333 | 842 | } |
| 843 | g_free(nick); | |
| 844 | } | |
| 845 | ||
| 846 | void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 847 | { | |
| 848 | char *buf; | |
| 849 | if (!args || !args[0]) | |
| 850 | return; | |
| 851 | ||
| 852 | buf = irc_format(irc, "v:", "PONG", args[0]); | |
| 853 | irc_send(irc, buf); | |
| 854 | g_free(buf); | |
| 855 | } | |
| 856 | ||
| 857 | void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 858 | { | |
| 859 | GaimConversation *convo; | |
| 860 | GaimConnection *gc; | |
| 861 | char **parts, *msg; | |
| 862 | time_t oldstamp; | |
| 863 | ||
| 864 | if (!args || !args[1]) | |
| 865 | return; | |
| 866 | ||
| 867 | parts = g_strsplit(args[1], " ", 2); | |
| 868 | ||
| 869 | if (!parts[0] || !parts[1]) { | |
| 870 | g_strfreev(parts); | |
| 871 | return; | |
| 872 | } | |
| 873 | ||
| 874 | if (sscanf(parts[1], "%lu", &oldstamp) != 1) { | |
| 875 | msg = g_strdup(_("Error: invalid PONG from server")); | |
| 876 | } else { | |
| 6350 | 877 | msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp); |
| 6333 | 878 | } |
| 879 | ||
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
880 | convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, parts[0], irc->account); |
| 6333 | 881 | g_strfreev(parts); |
| 882 | if (convo) { | |
| 883 | if (gaim_conversation_get_type (convo) == GAIM_CONV_CHAT) | |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
884 | gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 885 | else |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
886 | gaim_conv_im_write(GAIM_CONV_IM(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 887 | } else { |
| 888 | gc = gaim_account_get_connection(irc->account); | |
| 889 | if (!gc) { | |
| 890 | g_free(msg); | |
| 891 | return; | |
| 892 | } | |
| 893 | gaim_notify_info(gc, NULL, "PONG", msg); | |
| 894 | } | |
| 895 | g_free(msg); | |
| 896 | } | |
| 897 | ||
| 898 | void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 899 | { | |
| 900 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 901 | GaimConversation *convo; | |
| 902 | char *nick = irc_mask_nick(from), *tmp, *msg; | |
| 903 | int notice = 0; | |
| 904 | ||
| 905 | if (!args || !args[0] || !args[1] || !gc) { | |
| 906 | g_free(nick); | |
| 907 | return; | |
| 908 | } | |
| 909 | ||
| 910 | notice = !strcmp(args[0], " notice "); | |
| 911 | tmp = irc_parse_ctcp(irc, nick, args[0], args[1], notice); | |
| 912 | if (!tmp) { | |
| 913 | g_free(nick); | |
| 914 | return; | |
| 915 | } | |
| 8163 | 916 | |
| 917 | msg = gaim_escape_html(tmp); | |
| 6333 | 918 | g_free(tmp); |
| 8163 | 919 | |
| 920 | tmp = irc_mirc2html(msg); | |
| 921 | g_free(msg); | |
| 922 | msg = tmp; | |
| 6333 | 923 | if (notice) { |
| 924 | tmp = g_strdup_printf("(notice) %s", msg); | |
| 925 | g_free(msg); | |
| 926 | msg = tmp; | |
| 927 | } | |
| 928 | ||
| 929 | if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) { | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6753
diff
changeset
|
930 | serv_got_im(gc, nick, msg, 0, time(NULL)); |
| 6333 | 931 | } else if (notice) { |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6753
diff
changeset
|
932 | serv_got_im(gc, nick, msg, 0, time(NULL)); |
| 6333 | 933 | } else { |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10242
diff
changeset
|
934 | convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); |
| 6333 | 935 | if (convo) |
|
7118
280b3b85a28a
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
936 | serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); |
| 6333 | 937 | else |
| 938 | gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a PRIVMSG on %s, which does not exist\n", args[0]); | |
| 939 | } | |
| 940 | g_free(msg); | |
| 941 | g_free(nick); | |
| 942 | } | |
| 943 | ||
| 6714 | 944 | void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 945 | { | |
| 946 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 947 | char *msg; | |
| 948 | ||
| 949 | if (!args || !args[1] || !args[2] || !gc) | |
| 950 | return; | |
| 951 | ||
| 952 | msg = g_strdup_printf(_("Cannot join %s:"), args[1]); | |
| 953 | gaim_notify_error(gc, _("Cannot join channel"), msg, args[2]); | |
| 954 | g_free(msg); | |
| 955 | } | |
| 956 | ||
| 6333 | 957 | void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 958 | { | |
| 959 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 9238 | 960 | struct irc_buddy *ib; |
| 6333 | 961 | char *data[2]; |
| 962 | ||
| 963 | if (!args || !args[0] || !gc) | |
| 964 | return; | |
| 965 | ||
| 966 | data[0] = irc_mask_nick(from); | |
| 967 | data[1] = args[0]; | |
| 968 | /* XXX this should have an API, I shouldn't grab this directly */ | |
| 969 | g_slist_foreach(gc->buddy_chats, (GFunc)irc_chat_remove_buddy, data); | |
| 9238 | 970 | |
| 971 | if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) { | |
| 972 | ib->flag = FALSE; | |
| 973 | irc_buddy_status(data[0], ib, irc); | |
| 974 | } | |
| 6333 | 975 | g_free(data[0]); |
| 976 | ||
| 977 | return; | |
| 978 | } | |
| 979 | ||
| 980 | void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 981 | { | |
| 982 | GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 8965 | 983 | char *nick, *msg, *wallop; |
| 6333 | 984 | |
| 985 | if (!args || !args[0] || !gc) | |
| 986 | return; | |
| 987 | ||
| 988 | nick = irc_mask_nick(from); | |
| 989 | msg = g_strdup_printf (_("Wallops from %s"), nick); | |
| 990 | g_free(nick); | |
| 8965 | 991 | wallop = g_markup_escape_text(args[0], strlen(args[0])); |
| 992 | gaim_notify_info(gc, NULL, msg, wallop); | |
| 6333 | 993 | g_free(msg); |
| 8965 | 994 | g_free(wallop); |
| 6333 | 995 | } |
| 996 | ||
| 997 | void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args) | |
| 998 | { | |
| 999 | return; | |
| 1000 | } |