added new multi log system
[NeonServV5.git] / src / modules / NeonServ.mod / cmd_neonserv_up.c
index 597f02336b532a664bb932ff916766cf9c06b237..a5d4d8527506a2249a147c4b86062110969cb7c9 100644 (file)
@@ -1,4 +1,4 @@
-/* cmd_neonserv_up.c - NeonServ v5.4
+/* cmd_neonserv_up.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -35,16 +35,16 @@ CMD_BIND(neonserv_cmd_up) {
     if(isModeSet(chan->modes, 'd') || isModeSet(chan->modes, 'D')) {
         struct neonserv_cmd_up_cache *cache = malloc(sizeof(*cache));
         if (!cache) {
-            perror("malloc() failed");
+            printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
             return;
         }
         cache->client = client;
-        cache->textclient = getTextBot();
+        cache->textclient = textclient;
         cache->user = user;
         cache->event = event;
         get_userlist_if_invisible(chan, module_id, neonserv_cmd_up_userlist_lookup, cache);
     } else {
-        neonserv_cmd_up_async1(client, getTextBot(), user, chan, event);
+        neonserv_cmd_up_async1(client, textclient, user, chan, event);
     }
 }
 
@@ -57,7 +57,7 @@ static USERLIST_CALLBACK(neonserv_cmd_up_userlist_lookup) {
 static void neonserv_cmd_up_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event) {
     struct ChanUser *chanuser = getChanUser(user, chan);
     if(!chanuser) {
-        reply(getTextBot(), user, "NS_NOT_ON_CHANNEL_YOU", chan->name);
+        reply(textclient, user, "NS_NOT_ON_CHANNEL_YOU", chan->name);
         return;
     }
     loadChannelSettings(chan);
@@ -83,13 +83,13 @@ static void neonserv_cmd_up_async1(struct ClientSocket *client, struct ClientSoc
             putsock(client, "MODE %s +o %s", chan->name, user->nick);
             logEvent(event);
         } else
-            reply(getTextBot(), user, "NS_UP_ALREADY_OP", chan->name);
+            reply(textclient, user, "NS_UP_ALREADY_OP", chan->name);
     } else if(caccess >= chan_getvoice) {
         if(!(chanuser->flags & CHANUSERFLAG_VOICED)) {
             putsock(client, "MODE %s +v %s", chan->name, user->nick);
             logEvent(event);
         } else
-            reply(getTextBot(), user, "NS_UP_ALREADY_VOICE", chan->name);
+            reply(textclient, user, "NS_UP_ALREADY_VOICE", chan->name);
     } else
-        reply(getTextBot(), user, "NS_NOT_ON_USERLIST_YOU", chan->name);
+        reply(textclient, user, "NS_NOT_ON_USERLIST_YOU", chan->name);
 }