added OPER support (let the bots try to op themselves)
[NeonServV5.git] / src / modules / NeonHelp.mod / bot_NeonHelp.c
index d02b30da9d4d461444e2621c37a5a59234e9b00e..614d0df4a6b346edcae945cf7959bc0248fe9dad 100644 (file)
@@ -15,6 +15,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
  */
 #include "../module.h"
+#include "../botid.h"
 
 #include "bot_NeonHelp.h"
 #include "../../modcmd.h"
@@ -31,7 +32,7 @@
 #include "../../DBHelper.h"
 #include "../../WHOHandler.h"
 
-#define BOTID 4
+#define BOTID NEONHELP_BOTID
 #define BOTALIAS "NeonHelp"
 
 static const struct default_language_entry msgtab[] = {
@@ -72,9 +73,12 @@ static void neonhelp_bot_ready(struct ClientSocket *client) {
     MYSQL_RES *res;
     MYSQL_ROW row;
     
-    printf_mysql_query("SELECT `automodes` FROM `bots` WHERE `id` = '%d'", client->clientid);
+    printf_mysql_query("SELECT `automodes`, `oper_user`, `oper_pass` FROM `bots` WHERE `id` = '%d'", client->clientid);
     res = mysql_use();
     if ((row = mysql_fetch_row(res)) != NULL) {
+        if(row[1] && row[2]) {
+            putsock(client, "OPER %s %s", row[1], row[2]);
+        }
         putsock(client, "MODE %s +%s", client->user->nick, row[0]);
     }