aboutsummaryrefslogtreecommitdiffstats
path: root/irc_commands.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-07-01 00:01:33 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-07-01 00:01:33 +0100
commitd7f850037c6288b5a2eebae789ed0247d0e5f7b3 (patch)
treede3232c23ff3128fff0eb180ca75edd6e3bc1204 /irc_commands.c
parent217bf4e0401435dce8dec87d2644fcadc986fa93 (diff)
Support /NOTICE, although for now just to yourself - some IRC clients use
this to measure lag.
Diffstat (limited to 'irc_commands.c')
-rw-r--r--irc_commands.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/irc_commands.c b/irc_commands.c
index bcb2fef2..0a9b2c61 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -333,6 +333,20 @@ static void irc_cmd_privmsg( irc_t *irc, char **cmd )
}
}
+static void irc_cmd_notice( irc_t *irc, char **cmd )
+{
+ if( !cmd[2] )
+ {
+ irc_send_num( irc, 412, ":No text to send" );
+ return;
+ }
+
+ /* At least for now just echo. IIRC some IRC clients use self-notices
+ for lag checks, so try to support that. */
+ if( nick_cmp( cmd[1], irc->user->nick ) == 0 )
+ irc_send_msg( irc->user, "NOTICE", irc->user->nick, cmd[2], NULL );
+}
+
static void irc_cmd_nickserv( irc_t *irc, char **cmd )
{
/* [SH] This aliases the NickServ command to PRIVMSG root */
@@ -602,6 +616,7 @@ static const command_t irc_commands[] = {
{ "mode", 1, irc_cmd_mode, IRC_CMD_LOGGED_IN },
{ "who", 0, irc_cmd_who, IRC_CMD_LOGGED_IN },
{ "privmsg", 1, irc_cmd_privmsg, IRC_CMD_LOGGED_IN },
+ { "notice", 1, irc_cmd_notice, IRC_CMD_LOGGED_IN },
{ "nickserv", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN },
{ "ns", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN },
{ "away", 0, irc_cmd_away, IRC_CMD_LOGGED_IN },
@@ -611,9 +626,6 @@ static const command_t irc_commands[] = {
{ "ison", 1, irc_cmd_ison, IRC_CMD_LOGGED_IN },
{ "watch", 1, irc_cmd_watch, IRC_CMD_LOGGED_IN },
{ "invite", 2, irc_cmd_invite, IRC_CMD_LOGGED_IN },
-#if 0
- { "notice", 1, irc_cmd_privmsg, IRC_CMD_LOGGED_IN },
-#endif
{ "topic", 1, irc_cmd_topic, IRC_CMD_LOGGED_IN },
{ "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN },
{ "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },