mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +00:00
IRCClient: Process incoming NOTICE messages like PRIVMSG.
They should be handled slightly differently, but at least now we're doing *something* withthem.
This commit is contained in:
parent
d9d13f2445
commit
9a7b638743
2 changed files with 15 additions and 4 deletions
|
@ -267,7 +267,10 @@ void IRCClient::handle(const Message& msg)
|
||||||
return handle_topic(msg);
|
return handle_topic(msg);
|
||||||
|
|
||||||
if (msg.command == "PRIVMSG")
|
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")
|
if (msg.command == "NICK")
|
||||||
return handle_nick(msg);
|
return handle_nick(msg);
|
||||||
|
@ -326,7 +329,7 @@ bool IRCClient::is_nick_prefix(char ch) const
|
||||||
return false;
|
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)
|
if (msg.arguments.size() < 2)
|
||||||
return;
|
return;
|
||||||
|
@ -337,7 +340,10 @@ void IRCClient::handle_privmsg(const Message& msg)
|
||||||
auto target = msg.arguments[0];
|
auto target = msg.arguments[0];
|
||||||
|
|
||||||
#ifdef IRC_DEBUG
|
#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
|
#endif
|
||||||
|
|
||||||
if (sender_nick.is_empty())
|
if (sender_nick.is_empty())
|
||||||
|
|
|
@ -87,6 +87,11 @@ private:
|
||||||
Vector<String> arguments;
|
Vector<String> arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class PrivmsgOrNotice {
|
||||||
|
Privmsg,
|
||||||
|
Notice,
|
||||||
|
};
|
||||||
|
|
||||||
void receive_from_server();
|
void receive_from_server();
|
||||||
void send(const String&);
|
void send(const String&);
|
||||||
void send_user();
|
void send_user();
|
||||||
|
@ -109,7 +114,7 @@ private:
|
||||||
void handle_rpl_topicwhotime(const Message&);
|
void handle_rpl_topicwhotime(const Message&);
|
||||||
void handle_rpl_endofnames(const Message&);
|
void handle_rpl_endofnames(const Message&);
|
||||||
void handle_rpl_namreply(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_nick(const Message&);
|
||||||
void handle(const Message&);
|
void handle(const Message&);
|
||||||
void handle_user_command(const String&);
|
void handle_user_command(const String&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue