added new multi log system
[NeonServV5.git] / src / modules / NeonServ.mod / cmd_neonserv_invite.c
index 307cccd4b3c55fb4304ee4eda611703d180249e0..b9bce2855b8c626af6fa90f9b8f72d95944ea595 100644 (file)
@@ -1,4 +1,4 @@
-/* cmd_neonserv_invite.c - NeonServ v5.4
+/* cmd_neonserv_invite.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -47,19 +47,19 @@ static struct neonserv_cmd_invite_timeout *first_timeout = NULL, *last_timeout =
 
 CMD_BIND(neonserv_cmd_invite) {
     if(neonserv_cmd_invite_is_timeout(argv[0], chan->name)) {
-        reply(getTextBot(), user, "NS_INVITE_TIMEOUT", argv[0], chan->name);
+        reply(textclient, user, "NS_INVITE_TIMEOUT", argv[0], chan->name);
         return;
     }
     struct UserNode *cuser = getUserByNick(argv[0]);
     if(!cuser) {
         cuser = createTempUser(argv[0]);
                if(!cuser) {
-            reply(getTextBot(), user, "NS_USER_UNKNOWN", argv[0]);
+            reply(textclient, user, "NS_USER_UNKNOWN", argv[0]);
             return;
         }
         cuser->flags |= USERFLAG_ISTMPUSER;
     } else if(getChanUser(cuser, chan)) {
-        reply(getTextBot(), user, "NS_INVITE_ON_CHAN", cuser->nick, chan->name);
+        reply(textclient, user, "NS_INVITE_ON_CHAN", cuser->nick, chan->name);
         /* BUG
          This check does not work if the user is invisible (CHMODE +D/+d)
          to fix this we'd need to request the full userlist...
@@ -68,15 +68,15 @@ CMD_BIND(neonserv_cmd_invite) {
         return;
     }
     if(cuser->flags & USERFLAG_ISAUTHED) {
-        neonserv_cmd_invite_async1(client, getTextBot(), user, chan, event, argv[0], cuser->auth);
+        neonserv_cmd_invite_async1(client, textclient, user, chan, event, argv[0], cuser->auth);
     } else {
         struct neonserv_cmd_invite_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->chan = chan;
         cache->event = event;
@@ -139,7 +139,7 @@ static TIMEQ_CALLBACK(neonserv_cmd_invite_timeout_timeout) {
 static struct neonserv_cmd_invite_timeout* neonserv_cmd_invite_add_timeout(char *nick, char *chan) {
     struct neonserv_cmd_invite_timeout *entry = malloc(sizeof(*entry));
     if (!entry) {
-        perror("malloc() failed");
+        printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
         return NULL;
     }
     entry->next = NULL;