tried to fix the op issue, and added control command to sparrowmodule

This commit is contained in:
unknown 2015-06-09 13:16:20 +02:00
parent 12da0a08f7
commit 5d4ee3c6f6
3 changed files with 13 additions and 2 deletions

View File

@ -8,7 +8,7 @@ SUBDIRS = ircbot \
app.depends = ircbot
#copy res
copydata.commands = $(COPY_DIR) $$PWD/res $$OUT_PWD
copydata.commands = $(COPY_DIR) $$relative_path($$PWD/res) $$relative_path($$OUT_PWD)
first.depends = $(first) copydata
export(first.depends)
export(copydata.commands)

View File

@ -1,5 +1,6 @@
#include "sparrowmodule.h"
#include "message.h"
#include "basemodule.h"
SparrowModule::SparrowModule()
{
@ -15,6 +16,16 @@ bool SparrowModule::messageHandler(Message msg)
answer = say("Bienvenue sur #epicsparrow "+msg.nick+"!");
return true;
}
else if(msg.command.compare("PRIVMSG"))
{
User* user = getUsers()->getFromNick(msg.nick);
if(msg.args.startsWith("!control ") && user->isOp())
{
QString command = msg.args.remove(0, 9);
answer = command + "\r\n";
return true;
}
}
return false;
}

View File

@ -180,7 +180,7 @@ bool BaseModule::onChanHandler(Message msg)
QStringList chanList = msg.args.split(' ');
for(QString s : chanList)
{
if(s.endsWith(getChan()))
if(s.contains(getChan()))
{
u->setOp(s.startsWith('@'));
break;