fixed language format string fail
[NeonServV5.git] / src / modules / NeonServ.mod / bot_NeonServ.c
index 16d6dbdfe5d943568b1deeb64c53a97f13967364..0ea4cbbd7b1fff63244c9511b246470dcdb25adb 100644 (file)
@@ -1,4 +1,4 @@
-/* bot_NeonServ.c - NeonServ v5.4
+/* bot_NeonServ.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -243,7 +243,7 @@ static const struct default_language_entry msgtab[] = {
     {"NS_RESYNC_DONE", "Synchronized users in $b%s$b with the userlist."}, /* {ARGS: "#TestChan"} */
     {"NS_TIMEBAN_DURATION_TOO_SHORT", "You must specify a ban duration of at least %d seconds."}, /* {ARGS: 30} */
     {"NS_TIMEBAN_DONE", "Banned $b%s$b from %s for %s. (matching %d users)"}, /* {ARGS: "*!*@bla*", "#TestChan", "2 hours", 5} */
-    {"NS_MODE_INVALID", "$b%c$b is an invalid set of channel modes."}, /* {ARGS: "+xyz"} */
+    {"NS_MODE_INVALID", "$b%s$b is an invalid set of channel modes."}, /* {ARGS: "+xyz"} */
     {"NS_MODE_LOCKED", "Modes conflicting with $b%s$b are not allowed in %s."}, /* {ARGS: "+xyz", "#TestChan"} */
     {"NS_MODE_DONE", "Channel modes are now $b%s$b."}, /* {ARGS: "+xyz"} */
     {"NS_MODE_ENFOPS", "You may not op or deop users on $b%s$b."}, /* {ARGS: "#TestChan"} */
@@ -359,6 +359,8 @@ static const struct default_language_entry msgtab[] = {
     {"NS_NICKLIST_STATE", "State"},
     {"NS_NICKLIST_ACCESS", "Access"},
     {"NS_NICKLIST_SYNC", "use `nicklist sync` to fix all red and orange entrys in the list above (add opped users with %d and voiced with %d access)"},
+    {"NS_NICKLIST_ACCESS_BOT", "Bot"},
+    {"NS_NICKLIST_ACCESS_OPER", "Operator"},
     {"NS_SETBOT_UNKNOWN", "`%d` is an unknown botid."}, /* {ARGS: 50} */
     {"NS_SETBOT_HEADER", "$bSettings for botid `%d`:$b"}, /* {ARGS: 50} */
     {"NS_SETBOT_SETTING", "$b%s$b is an unknown bot setting."}, /* {ARGS: "strangeSetting"} */
@@ -404,7 +406,6 @@ cmd_neonserv_calc.c
 //EVENTS
 #include "event_neonserv_join.c"
 #include "event_neonserv_part.c"
-#include "event_neonserv_quit.c"
 #include "event_neonserv_kick.c"
 #include "event_neonserv_mode.c"
 #include "event_neonserv_ctcp.c"
@@ -418,6 +419,8 @@ struct ClientSocket *getBotForChannel(struct ChanNode *chan) {
 }
 
 static void neonserv_bot_ready(struct ClientSocket *client) {
+    if(client->botid != BOTID)
+        return;
     MYSQL_RES *res;
     MYSQL_ROW row;
     
@@ -464,14 +467,15 @@ static void start_bots(int type) {
     MYSQL_ROW row;
     
     if(type == MODSTATE_STARTSTOP) {
-        printf_mysql_query("SELECT `nick`, `ident`, `realname`, `server`, `port`, `pass`, `textbot`, `id`, `queue`, `ssl`, `bind` FROM `bots` WHERE `botclass` = '%d' AND `active` = '1'", BOTID);
+        printf_mysql_query("SELECT `nick`, `ident`, `realname`, `server`, `port`, `pass`, `textbot`, `id`, `queue`, `ssl`, `bind`, `secret` FROM `bots` WHERE `botclass` = '%d' AND `active` = '1'", BOTID);
         res = mysql_use();
         while ((row = mysql_fetch_row(res)) != NULL) {
             client = create_socket(row[3], atoi(row[4]), row[10], row[5], row[0], row[1], row[2]);
             client->flags |= (strcmp(row[6], "0") ? SOCKET_FLAG_PREFERRED : 0);
             client->flags |= (strcmp(row[8], "0") ? SOCKET_FLAG_USE_QUEUE : 0);
             client->flags |= (strcmp(row[9], "0") ? SOCKET_FLAG_SSL : 0);
-            client->flags |= SOCKET_FLAG_REQUEST_INVITE;
+            client->flags |= (strcmp(row[11], "0") ? SOCKET_FLAG_SECRET_BOT : 0);
+            client->flags |= SOCKET_FLAG_REQUEST_INVITE | SOCKET_FLAG_REQUEST_OP;
             client->botid = BOTID;
             client->clientid = atoi(row[7]);
             connect_socket(client);
@@ -508,7 +512,6 @@ void init_NeonServ(int type) {
     bind_bot_ready(neonserv_bot_ready, module_id);
     bind_join(neonserv_event_join, module_id);
     bind_part(neonserv_event_part, module_id);
-    bind_quit(neonserv_event_quit, module_id);
     bind_chanctcp(neonserv_event_chanctcp, module_id);
     bind_privctcp(general_event_privctcp, module_id);
     bind_channotice(neonserv_event_channotice, module_id);
@@ -522,10 +525,6 @@ void init_NeonServ(int type) {
     register_default_language_table(msgtab);
 }
 
-void loop_NeonServ() {
-    
-}
-
 void free_NeonServ(int type) {
     unbind_allcmd(BOTID);
     if(type == MODSTATE_STARTSTOP) {