]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
Fixed some flood checking
[user/henk/code/inspircd.git] / include / users.h
index c1a6aa3afae4ab0277d7b3bad3c70b61ee9fdd23..0dfbc222367ee41f84de20559edc0b8421e606c5 100644 (file)
@@ -1,12 +1,23 @@
-/*
-
-
-*/
+/*       +------------------------------------+
+ *       | 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 "connection.h"
-
+#include "inspstring.h"
 #include <string>
  
 #ifndef __USERS_H__ 
@@ -46,16 +57,25 @@ class ConnectClass : public classbase
        /** Host mask for this line
         */
        char host[MAXBUF];
+       /** Number of seconds between pings for this line
+        */
+       int pingtime;
        /** (Optional) Password for this line
         */
        char pass[MAXBUF];
+
+       /** Threshold value for flood disconnect
+        */
+       long threshold;
        
        ConnectClass()
        {
                registration_timeout = 0;
                flood = 0;
-               strcpy(host,"");
-               strcpy(pass,"");
+               pingtime = 0;
+               threshold = 0;
+               strlcpy(host,"",MAXBUF);
+               strlcpy(pass,"",MAXBUF);
        }
 };
 
@@ -136,6 +156,39 @@ class userrec : public connection
         * will be disconnected
         */
        unsigned long timeout;
+       
+       /** The oper type they logged in as, if they are an oper.
+        * This is used to check permissions in operclasses, so that
+        * we can say 'yay' or 'nay' to any commands they issue.
+        * The value of this is the value of a valid 'type name=' tag.
+        */
+       char oper[NICKMAX];
+
+        /** True when DNS lookups are completed.
+         */
+        bool dns_done;
+
+       /** Number of seconds between PINGs for this user (set from &lt;connect:allow&gt; tag
+        */
+       unsigned long pingmax;
+
+       /** Password specified by the user when they registered.
+        * This is stored even if the <connect> block doesnt need a password, so that
+        * modules may check it.
+        */
+       char password[MAXBUF];
+
+       /** User's receive queue.
+        * Lines from the IRCd awaiting processing are stored here.
+        * Upgraded april 2005, old system a bit hairy.
+        */
+       std::string recvq;
+
+       /** Flood counters
+        */
+       long lines_in;
+       time_t reset_due;
+       long threshold;
 
        userrec();
        
@@ -168,6 +221,17 @@ class userrec : public connection
         */
        virtual void RemoveInvite(char* channel);
        
+       /** Returns true or false for if a user can execute a privilaged oper command.
+        * This is done by looking up their oper type from userrec::oper, then referencing
+        * this to their oper classes and checking the commands they can execute.
+        */
+       bool HasPermission(char* command);
+
+       bool userrec::AddBuffer(std::string a);
+       bool userrec::BufferIsReady();
+       void userrec::ClearBuffer();
+       std::string userrec::GetBuffer();
+       
 };