24 lines
597 B
C++
24 lines
597 B
C++
#include "snote_thread.hpp"
|
|
|
|
#include "irc_parse_thread.hpp"
|
|
#include "connection.hpp"
|
|
|
|
#include <cstring>
|
|
|
|
|
|
auto snote_thread(Connection * connection) -> void
|
|
{
|
|
static char const* const prefix = "*** Notice -- ";
|
|
connection->add_listener<IrcMsgEvent>([connection](IrcMsgEvent& event)
|
|
{
|
|
auto& args = event.irc.args;
|
|
if (IrcCommand::NOTICE == event.command
|
|
&& "*" == args[0]
|
|
&& args[1].starts_with(prefix))
|
|
{
|
|
event.handled_ = true;
|
|
connection->make_event<SnoteEvent>(args[1].substr(strlen(prefix)));
|
|
}
|
|
});
|
|
}
|