]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Services speedups for stupid buffered i/o uplinks
[user/henk/code/inspircd.git] / src / users.cpp
index b523033ba926f20631b41d1d1d2c6b97a6982f09..a32b94cf71f7330f131ddc339b402b30726565e3 100644 (file)
@@ -1,15 +1,30 @@
-/*
-Manages userrec objects
-*/
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *                       E-mail:
+ *                <brain@chatspike.net>
+ *               <Craig@chatspike.net>
+ *     
+ * Written by Craig Edwards, Craig McLure, and others.
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
 
 #include "inspircd_config.h" 
 #include "channels.h"
 #include "users.h"
 #include "inspircd.h"
 #include <stdio.h>
+#include "inspstring.h"
 
 extern std::stringstream config_f;
 
+extern time_t TIME;
+
 userrec::userrec()
 {
        // the PROPER way to do it, AVOID bzero at *ALL* costs
@@ -24,9 +39,11 @@ userrec::userrec()
        strcpy(inbuf,"");
        strcpy(server,"");
        strcpy(awaymsg,"");
+       strcpy(oper,"");
        fd = lastping = signon = idle_lastmsg = nping = registered = 0;
        flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
        haspassed = false;
+       dns_done = false;
        strcpy(result,"");
        for (int i = 0; i < MAXCHANS; i++)
        {
@@ -40,14 +57,14 @@ userrec::userrec()
  
 char* userrec::GetFullHost()
 {
-       sprintf(result,"%s!%s@%s",nick,ident,dhost);
+       snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,dhost);
        return result;
 }
 
 
 char* userrec::GetFullRealHost()
 {
-       sprintf(result,"%s!%s@%s",nick,ident,host);
+       snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,host);
        return result;
 }
 
@@ -68,7 +85,7 @@ bool userrec::IsInvited(char* channel)
 void userrec::InviteTo(char* channel)
 {
        Invited i;
-       strcpy(i.channel,channel);
+       strlcpy(i.channel,channel,CHANMAX);
        invites.push_back(i);
 }
 
@@ -114,7 +131,6 @@ bool userrec::HasPermission(char* command)
                                log(DEBUG,"*** HasPermission: %s is an oper of type '%s'",this->nick,this->oper);
                                ConfValue("type","classes",j,Classes,&config_f);
                                char* myclass = strtok_r(Classes," ",&savept);
-                               //myclass = savept;
                                while (myclass)
                                {
                                        log(DEBUG,"*** HasPermission: checking classtype '%s'",myclass);
@@ -128,7 +144,6 @@ bool userrec::HasPermission(char* command)
                                                        
                                                        
                                                        mycmd = strtok_r(CommandList," ",&savept2);
-                                                       //mycmd = savept2;
                                                        while (mycmd)
                                                        {
                                                                if (!strcasecmp(mycmd,command))
@@ -137,12 +152,10 @@ bool userrec::HasPermission(char* command)
                                                                        return true;
                                                                }
                                                                mycmd = strtok_r(NULL," ",&savept2);
-                                                               //mycmd = savept2;
                                                        }
                                                }
                                        }
                                        myclass = strtok_r(NULL," ",&savept);
-                                       //myclass = savept;
                                }
                        }
                }