diff --git a/Applications/IRCClient/IRCClient.cpp b/Applications/IRCClient/IRCClient.cpp index 976c2256d1..01821615b4 100644 --- a/Applications/IRCClient/IRCClient.cpp +++ b/Applications/IRCClient/IRCClient.cpp @@ -267,7 +267,10 @@ void IRCClient::handle(const Message& msg) return handle_topic(msg); if (msg.command == "PRIVMSG") - return handle_privmsg(msg); + return handle_privmsg_or_notice(msg, PrivmsgOrNotice::Privmsg); + + if (msg.command == "NOTICE") + return handle_privmsg_or_notice(msg, PrivmsgOrNotice::Notice); if (msg.command == "NICK") return handle_nick(msg); @@ -326,7 +329,7 @@ bool IRCClient::is_nick_prefix(char ch) const return false; } -void IRCClient::handle_privmsg(const Message& msg) +void IRCClient::handle_privmsg_or_notice(const Message& msg, PrivmsgOrNotice type) { if (msg.arguments.size() < 2) return; @@ -337,7 +340,10 @@ void IRCClient::handle_privmsg(const Message& msg) auto target = msg.arguments[0]; #ifdef IRC_DEBUG - printf("handle_privmsg: sender_nick='%s', target='%s'\n", sender_nick.characters(), target.characters()); + printf("handle_privmsg_or_notice: type='%s', sender_nick='%s', target='%s'\n", + type == PrivmsgOrNotice::Privmsg ? "privmsg" : "notice", + sender_nick.characters(), + target.characters()); #endif if (sender_nick.is_empty()) diff --git a/Applications/IRCClient/IRCClient.h b/Applications/IRCClient/IRCClient.h index e72b7cfc7a..f276b22c73 100644 --- a/Applications/IRCClient/IRCClient.h +++ b/Applications/IRCClient/IRCClient.h @@ -87,6 +87,11 @@ private: Vector arguments; }; + enum class PrivmsgOrNotice { + Privmsg, + Notice, + }; + void receive_from_server(); void send(const String&); void send_user(); @@ -109,7 +114,7 @@ private: void handle_rpl_topicwhotime(const Message&); void handle_rpl_endofnames(const Message&); void handle_rpl_namreply(const Message&); - void handle_privmsg(const Message&); + void handle_privmsg_or_notice(const Message&, PrivmsgOrNotice); void handle_nick(const Message&); void handle(const Message&); void handle_user_command(const String&);