# HG changeset patch # User Ethan Blanton # Date 1100882527 0 # Node ID cbdce0acbbe6a89a21efb2695e51e3fcb9ba1110 # Parent 9d03dd6ccc9ad7172b354dfe6cabb5f3bfbc9e04 [gaim-migrate @ 11330] This implements irc_ischannel for HEAD, and fixes /names committer: Tailor Script diff -r 9d03dd6ccc9a -r cbdce0acbbe6 src/protocols/irc/cmds.c --- a/src/protocols/irc/cmds.c Fri Nov 19 06:24:50 2004 +0000 +++ b/src/protocols/irc/cmds.c Fri Nov 19 16:42:07 2004 +0000 @@ -197,7 +197,7 @@ return 0; if (!strcmp(cmd, "mode")) { - if (!args[0] && (*target == '#' || *target == '&')) + if (!args[0] && irc_ischannel(target)) buf = irc_format(irc, "vc", "MODE", target); else if (args[0] && (*args[0] == '+' || *args[0] == '-')) buf = irc_format(irc, "vcv", "MODE", target, args[0]); @@ -224,7 +224,7 @@ { char *buf; - if (!args) + if (!args || (!args[0] && !irc_ischannel(target))) return 0; buf = irc_format(irc, "vc", "NAMES", args[0] ? args[0] : target); @@ -317,7 +317,7 @@ char *buf; if (args && args[0]) { - if (*args[0] == '#' || *args[0] == '&') + if (irc_ischannel(args[0])) return 0; stamp = g_strdup_printf("\001PING %lu\001", time(NULL)); buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp); @@ -414,7 +414,7 @@ if (!args || !args[0]) return 0; - if (*target != '#' && *target != '&') /* not a channel, punt */ + if (!irc_ischannel(target)) /* not a channel, punt */ return 0; if (args[1]) diff -r 9d03dd6ccc9a -r cbdce0acbbe6 src/protocols/irc/irc.h --- a/src/protocols/irc/irc.h Fri Nov 19 06:24:50 2004 +0000 +++ b/src/protocols/irc/irc.h Fri Nov 19 16:42:07 2004 +0000 @@ -87,6 +87,8 @@ char *irc_mirc2html(const char *string); char *irc_mirc2txt(const char *string); +gboolean irc_ischannel(const char *string); + void irc_register_commands(void); void irc_msg_table_build(struct irc_conn *irc); void irc_parse_msg(struct irc_conn *irc, char *input); diff -r 9d03dd6ccc9a -r cbdce0acbbe6 src/protocols/irc/parse.c --- a/src/protocols/irc/parse.c Fri Nov 19 06:24:50 2004 +0000 +++ b/src/protocols/irc/parse.c Fri Nov 19 16:42:07 2004 +0000 @@ -366,6 +366,11 @@ return result; } +gboolean irc_ischannel(const char *string) +{ + return (string[0] == '#' || string[0] == '&'); +} + char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice) { GaimConnection *gc;