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:
@@ -54,14 +54,16 @@ void IrcPlugin::enableProcessTask(Scheduler *scheduler)
|
||||
processTask.enable();
|
||||
}
|
||||
|
||||
int IrcPlugin::checkConfig(){
|
||||
int isValid = server.length() == 0 || port == 0 || nick.length() == 0 || user.length() == 0;
|
||||
publish("irc/configValid", String(isValid));
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
void IrcPlugin::connect()
|
||||
{
|
||||
if (server.length() == 0 || port == 0 || nick.length() == 0 || user.length() == 0)
|
||||
{
|
||||
publish("irc/needsConfig", "");
|
||||
return;
|
||||
}
|
||||
if (!client->connected())
|
||||
if (checkConfig() && !client->connected())
|
||||
{
|
||||
PRINT_MSG(Serial, "IRC", String("Attempting connection to " + server + ":" + String(port)).c_str());
|
||||
PRINT_MSG(Serial, "IRC", String("NICK " + nick).c_str());
|
||||
@@ -82,7 +84,7 @@ void IrcPlugin::connect()
|
||||
|
||||
void IrcPlugin::join(String c)
|
||||
{
|
||||
if (client->connected())
|
||||
if (checkConfig() && client->connected())
|
||||
{
|
||||
|
||||
channel = c;
|
||||
|
||||
@@ -43,6 +43,7 @@ private:
|
||||
virtual void debugSentCallback(String data);
|
||||
void join(String channel);
|
||||
void sendMessage(String msg);
|
||||
virtual int checkConfig();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user