mirror of
https://gitlab.com/wirelos/sprocket-plugin-irc.git
synced 2025-12-14 21:42:21 +01:00
foo
This commit is contained in:
@@ -54,14 +54,16 @@ void IrcPlugin::enableProcessTask(Scheduler *scheduler)
|
|||||||
processTask.enable();
|
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()
|
void IrcPlugin::connect()
|
||||||
{
|
{
|
||||||
if (server.length() == 0 || port == 0 || nick.length() == 0 || user.length() == 0)
|
if (checkConfig() && !client->connected())
|
||||||
{
|
|
||||||
publish("irc/needsConfig", "");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!client->connected())
|
|
||||||
{
|
{
|
||||||
PRINT_MSG(Serial, "IRC", String("Attempting connection to " + server + ":" + String(port)).c_str());
|
PRINT_MSG(Serial, "IRC", String("Attempting connection to " + server + ":" + String(port)).c_str());
|
||||||
PRINT_MSG(Serial, "IRC", String("NICK " + nick).c_str());
|
PRINT_MSG(Serial, "IRC", String("NICK " + nick).c_str());
|
||||||
@@ -82,7 +84,7 @@ void IrcPlugin::connect()
|
|||||||
|
|
||||||
void IrcPlugin::join(String c)
|
void IrcPlugin::join(String c)
|
||||||
{
|
{
|
||||||
if (client->connected())
|
if (checkConfig() && client->connected())
|
||||||
{
|
{
|
||||||
|
|
||||||
channel = c;
|
channel = c;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ private:
|
|||||||
virtual void debugSentCallback(String data);
|
virtual void debugSentCallback(String data);
|
||||||
void join(String channel);
|
void join(String channel);
|
||||||
void sendMessage(String msg);
|
void sendMessage(String msg);
|
||||||
|
virtual int checkConfig();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user