Windows | Linux | Azure (Linux/macOS) |
---|---|---|
First create a function (name it whatever you want) with two arguments, an IRCMessage and a pointer to IRCClient:
void onPrivMsg(IRCMessage message, IRCClient* client)
{
// Check who can "control" us
if (message.prefix.nick != "YourNick")
return;
// received text
std::string text = message.parameters.at(message.parameters.size() - 1);
if (text == "join #channel")
client->SendIRC("JOIN #channel");
if (text == "leave #channel")
client->SendIRC("PART #channel");
if (text == "quit now")
client->SendIRC("QUIT");
}
Then, after you create the IRCClient instance, you can hook it:
IRCClient client;
// Hook PRIVMSG
client.HookIRCCommand("PRIVMSG", &onPrivMsg);
Just send a pull request! :)
IRCClient is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
http://www.gnu.org/licenses/lgpl.html