mirror of
https://gitlab.com/wirelos/sprocket-plugin-irc.git
synced 2025-12-14 05:36:50 +01:00
foo
This commit is contained in:
@@ -9,8 +9,8 @@ void IrcPlugin::applyConfig(IrcConfig cfg)
|
||||
{
|
||||
server = String(cfg.server);
|
||||
port = cfg.port;
|
||||
nick = String(cfg.nickname);
|
||||
user = String(cfg.user);
|
||||
nick = String(cfg.nickname ? cfg.nickname : "Sprocket" + String(ESP.getChipId()));
|
||||
user = String(cfg.user ? cfg.user : "Sprocket" + String(ESP.getChipId()));
|
||||
}
|
||||
|
||||
void IrcPlugin::applyConfigFromFile(const char *fileName)
|
||||
@@ -35,11 +35,6 @@ void IrcPlugin::activate(Scheduler *scheduler)
|
||||
subscribe("irc/join", bind(&IrcPlugin::join, this, _1));
|
||||
subscribe("irc/sendMessage", bind(&IrcPlugin::sendMessage, this, _1));
|
||||
|
||||
if (server.length() == 0 || port == 0 || nick.length() == 0 || user.length() == 0)
|
||||
{
|
||||
publish("irc/needsConfig", "");
|
||||
}
|
||||
|
||||
//enableConnectTask(scheduler);
|
||||
enableProcessTask(scheduler);
|
||||
PRINT_MSG(Serial, "IRC", "plugin activated");
|
||||
@@ -61,6 +56,11 @@ void IrcPlugin::enableProcessTask(Scheduler *scheduler)
|
||||
|
||||
void IrcPlugin::connect()
|
||||
{
|
||||
if (server.length() == 0 || port == 0 || nick.length() == 0 || user.length() == 0)
|
||||
{
|
||||
publish("irc/needsConfig", "");
|
||||
return;
|
||||
}
|
||||
if (!client->connected())
|
||||
{
|
||||
PRINT_MSG(Serial, "IRC", String("Attempting connection to " + server + ":" + String(port)).c_str());
|
||||
|
||||
Reference in New Issue
Block a user