multiple fixes
[NeonServV5.git] / src / modules / NeonHelp.mod / bot_NeonHelp.c
index f3df2fc406c7c75511fe888a4582428bc9e2a8d5..ee02574fe2a1ee5838de4fabba162957bbf5f312 100644 (file)
  * You should have received a copy of the GNU General Public License 
  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
  */
+#include "../module.h"
 
 #include "bot_NeonHelp.h"
-#include "modcmd.h"
+#include "../../modcmd.h"
 #include "cmd_neonhelp.h"
-#include "lang.h"
-#include "mysqlConn.h"
-#include "ClientSocket.h"
-#include "UserNode.h"
-#include "ChanNode.h"
-#include "ChanUser.h"
-#include "IRCEvents.h"
-#include "IRCParser.h"
-#include "bots.h"
-#include "DBHelper.h"
-#include "WHOHandler.h"
+#include "../../lang.h"
+#include "../../mysqlConn.h"
+#include "../../ClientSocket.h"
+#include "../../UserNode.h"
+#include "../../ChanNode.h"
+#include "../../ChanUser.h"
+#include "../../IRCEvents.h"
+#include "../../IRCParser.h"
+#include "../../bots.h"
+#include "../../DBHelper.h"
+#include "../../WHOHandler.h"
 
 #define BOTID 4
 #define BOTALIAS "NeonHelp"
@@ -174,7 +175,7 @@ static void neonhelp_event_privmsg(struct UserNode *user, struct UserNode *targe
         cache->user = user;
         cache->target = target;
         cache->message = strdup(message);
-        get_userauth(user, neonhelp_event_privmsg_nick_lookup, cache);
+        get_userauth(user, module_id, neonhelp_event_privmsg_nick_lookup, cache);
     }
 }
 
@@ -265,7 +266,7 @@ static void neonhelp_event_privmsg_async(struct ClientSocket *client, struct Use
         if(!timeq_name_exists(nameBuf)) {
             int *cidptr = malloc(sizeof(int));
             *cidptr = client->clientid;
-            timeq_add_name(nameBuf, 300, neonhelp_remind_open_requests, cidptr);
+            timeq_add_name(nameBuf, 300, module_id, neonhelp_remind_open_requests, cidptr);
         }
     }
     printf_mysql_query("INSERT INTO `helpserv_requests` (`botid`, `host`, `hand`, `nick`, `status`, `supporter`, `time`, `text`) VALUES ('%d', '%s@%s', '%s', '%s', '0', '-1', UNIX_TIMESTAMP(), '%s')", client->clientid, escape_string(user->ident), escape_string(user->host), ((user->flags & USERFLAG_ISAUTHED) ? escape_string(user->auth) : "*"), escape_string(user->nick), escape_string(message));
@@ -338,7 +339,7 @@ static TIMEQ_CALLBACK(neonhelp_remind_open_requests) {
         char nameBuf[30];
         sprintf(nameBuf, "neonhelp_%d", client->clientid);
         if(!timeq_name_exists(nameBuf)) {
-            timeq_add_name(nameBuf, 300, neonhelp_remind_open_requests, data);
+            timeq_add_name(nameBuf, 300, module_id, neonhelp_remind_open_requests, data);
         }
         char replybuf[MAXLEN];
         build_language_string(NULL, replybuf, (requests == 1 ? "NH_REMIND_OPEN_REQUESTS_1" : "NH_REMIND_OPEN_REQUESTS_2"), requests);
@@ -512,19 +513,19 @@ static void neonhelp_event_quit(struct UserNode *target, char *reason) {
 
 void init_NeonHelp(int type) {
     set_bot_alias(BOTID, BOTALIAS);
-    start_bots();
+    start_bots(type);
     
     if(type == MODSTATE_REBIND) return;
     
     //register events
-    bind_bot_ready(neonhelp_bot_ready);
-    bind_privmsg(neonhelp_event_privmsg);
-    bind_chanmsg(neonhelp_event_chanmsg);
-    bind_part(neonhelp_event_part);
-    bind_kick(neonhelp_event_kick);
-    bind_quit(neonhelp_event_quit);
+    bind_bot_ready(neonhelp_bot_ready, module_id);
+    bind_privmsg(neonhelp_event_privmsg, module_id);
+    bind_chanmsg(neonhelp_event_chanmsg, module_id);
+    bind_part(neonhelp_event_part, module_id);
+    bind_kick(neonhelp_event_kick, module_id);
+    bind_quit(neonhelp_event_quit, module_id);
     
-    set_trigger_callback(BOTID, neonhelp_trigger_callback);
+    set_trigger_callback(BOTID, module_id, neonhelp_trigger_callback);
     
     register_default_language_table(msgtab);
 }