25 lines
624 B
C++
25 lines
624 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& irc = event.irc;
|
||
|
if ("NOTICE" == irc.command
|
||
|
&& 2 == irc.args.size()
|
||
|
&& "*" == irc.args[0]
|
||
|
&& irc.args[1].starts_with(prefix))
|
||
|
{
|
||
|
event.handled_ = true;
|
||
|
connection->make_event<SnoteEvent>(irc.args[1].substr(strlen(prefix)));
|
||
|
}
|
||
|
});
|
||
|
}
|