From 9dffb541b93b03d45a176e2ab13babc9ebf8f377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ken-H=C3=A5vard=20Lieng?= Date: Mon, 3 Jul 2017 07:25:38 +0200 Subject: [PATCH] Print ERROR messages --- irc/const.go | 11 ++++++----- server/irc_handler.go | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/irc/const.go b/irc/const.go index f521f44a..660bc938 100644 --- a/irc/const.go +++ b/irc/const.go @@ -1,15 +1,16 @@ package irc const ( - Ping = "PING" - Nick = "NICK" + Error = "ERROR" Join = "JOIN" - Part = "PART" Mode = "MODE" - Privmsg = "PRIVMSG" + Nick = "NICK" Notice = "NOTICE" - Topic = "TOPIC" + Part = "PART" + Ping = "PING" + Privmsg = "PRIVMSG" Quit = "QUIT" + Topic = "TOPIC" ReplyWelcome = "001" ReplyYourHost = "002" diff --git a/server/irc_handler.go b/server/irc_handler.go index a0bc61db..3e7ac711 100644 --- a/server/irc_handler.go +++ b/server/irc_handler.go @@ -287,6 +287,10 @@ func (i *ircHandler) badNick(msg *irc.Message) { }) } +func (i *ircHandler) error(msg *irc.Message) { + i.session.printError(msg.LastParam()) +} + func (i *ircHandler) initHandlers() { i.handlers = map[string]func(*irc.Message){ irc.Nick: i.nick, @@ -297,6 +301,7 @@ func (i *ircHandler) initHandlers() { irc.Notice: i.message, irc.Quit: i.quit, irc.Topic: i.topic, + irc.Error: i.error, irc.ReplyWelcome: i.info, irc.ReplyYourHost: i.info, irc.ReplyCreated: i.info,