basic irc plugin

This commit is contained in:
2018-11-23 14:38:39 +01:00
commit 90f7af7bdc
15 changed files with 571 additions and 0 deletions

47
src/IrcPlugin.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef __IRC_PLUGIN__
#define __IRC_PLUGIN__
#define _TASK_SLEEP_ON_IDLE_RUN
#define _TASK_STD_FUNCTION
#include <IRCClient.h>
#include <WiFiClient.h>
#include <Plugin.h>
#include "utils/print.h"
#include "IrcConfig.h"
using namespace std;
using namespace std::placeholders;
#define REPLY_TO "mentex" // Reply only to this nick
class IrcPlugin : public Plugin
{
public:
IrcPlugin(IrcConfig cfg);
void activate(Scheduler *scheduler);
private:
WiFiClient wifiClient;
IRCClient* client;
Task connectTask;
Task processTask;
String server;
int port;
String nick;
String user;
void applyConfig(IrcConfig cfg);
void applyConfigFromFile(const char *fileName);
void enableConnectTask(Scheduler *scheduler);
void enableProcessTask(Scheduler *scheduler);
virtual void connect();
virtual void callback(IRCMessage ircMessage);
virtual void debugSentCallback(String data);
void join(String channel);
void sendMessage(String to, String msg);
};
#endif