diff options
| -rw-r--r-- | include/users.h | 2 | ||||
| -rw-r--r-- | src/modules/mysql/db_mysql_execute.cpp | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/users.h b/include/users.h index 719957616..0d701f839 100644 --- a/include/users.h +++ b/include/users.h @@ -157,7 +157,7 @@ class CoreExport User : public Extensible /** Login the user to a NickCore * @param core The account the user is useing */ - virtual void Login(NickCore *core); + void Login(NickCore *core); /** Logout the user */ diff --git a/src/modules/mysql/db_mysql_execute.cpp b/src/modules/mysql/db_mysql_execute.cpp index 125bdfca0..dcae53ade 100644 --- a/src/modules/mysql/db_mysql_execute.cpp +++ b/src/modules/mysql/db_mysql_execute.cpp @@ -66,7 +66,6 @@ class FakeUser : public User void SendMessage(const std::string &, const char *, ...) { } void SendMessage(const std::string &, const std::string &) { } - void Login(NickCore *core) { nc = core; } NickCore *Account() const { return nc; } const bool IsIdentified() const { return nc ? true : false; } } SQLUser; @@ -95,14 +94,15 @@ class SQLTimer : public Timer { User *u; NickAlias *na = NULL; + bool logout = false; /* If they want -SQLUser to execute the command, use it */ if (qres[i]["nick"] == "-SQLUser") { u = &SQLUser; u->SetNewNick("-SQLUser"); - SQLCore.Users.clear(); u->Login(&SQLCore); + logout = true; } else { @@ -119,6 +119,7 @@ class SQLTimer : public Timer u = &SQLUser; u->SetNewNick(SQLAssign(qres[i]["nick"])); u->Login(na->nc); + logout = true; } } else @@ -131,6 +132,7 @@ class SQLTimer : public Timer u = &SQLUser; u->SetNewNick(SQLAssign(qres[i]["nick"])); u->Logout(); + logout = true; } } } @@ -147,6 +149,9 @@ class SQLTimer : public Timer char *cmd = strtok(cmdbuf, " "); mod_run_cmd(bi->nick, u, bi->cmdTable, cmd); delete [] cmdbuf; + + if (logout) + u->Logout(); } query << "TRUNCATE TABLE `anope_commands`"; |
