summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-12 18:42:06 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-12 18:42:06 +0000
commit2cd3b57fe08b6cdae5d99021252898dedd3a0650 (patch)
tree77a8ebf2339d02c324aaa5d066913756c51d35b2 /include
parenta266dadd1351d10b56ec187c7b6f7af75350ed68 (diff)
Structure optimizations, changed a lot of bools into binary bitmasks
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1368 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/channels.h41
-rw-r--r--include/connection.h24
-rw-r--r--include/users.h14
3 files changed, 24 insertions, 55 deletions
diff --git a/include/channels.h b/include/channels.h
index 6080cda98..ac1ee0385 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -23,6 +23,13 @@
#ifndef __CHANNELS_H__
#define __CHANNELS_H__
+#define CM_TOPICLOCK 1
+#define CM_NOEXTERNAL 2
+#define CM_INVITEONLY 4
+#define CM_MODERATED 8
+#define CM_SECRET 16
+#define CM_PRIVATE 32
+
/** Holds an entry for a ban list, exemption list, or invite list.
* This class contains a single element in a channel list, such as a banlist.
*/
@@ -102,10 +109,6 @@ class chanrec : public Extensible
*/
char custom_modes[MAXMODES]; /* modes handled by modules */
- /** Count of users on the channel used for fast user counting
- */
- long users;
-
/** User list (casted to char*'s to stop forward declaration stuff)
* (chicken and egg scenario!)
*/
@@ -130,38 +133,16 @@ class chanrec : public Extensible
/** Contains the channel user limit.
* If this value is zero, there is no limit in place.
*/
- long limit;
+ short int limit;
/** Contains the channel key.
* If this value is an empty string, there is no channel key in place.
*/
char key[32];
- /** Nonzero if the mode +t is set.
- */
- short int topiclock;
-
- /** Nonzero if the mode +n is set.
- */
- short int noexternal;
-
- /** Nonzero if the mode +i is set.
- */
- short int inviteonly;
-
- /** Nonzero if the mode +m is set.
- */
- short int moderated;
-
- /** Nonzero if the mode +s is set.
- * This value cannot be set at the same time as chanrec::c_private
- */
- short int secret;
-
- /** Nonzero if the mode +p is set.
- * This value cannot be set at the same time as chanrec::secret
+ /** Contains a bitmask of the CM_* builtin (RFC) binary mode symbols
*/
- short int c_private;
+ char binarymodes;
/** The list of all bans set on the channel.
*/
@@ -260,7 +241,7 @@ class ucrec : public classbase
/** Contains a bitmask of the UCMODE_OP ... UCMODE_FOUNDER values.
* If this value is zero, the user has no privilages upon the channel.
*/
- long uc_modes;
+ char uc_modes;
/** Points to the channel record where the given modes apply.
* If the record is not in use, this value will be NULL.
diff --git a/include/connection.h b/include/connection.h
index 300a83d4a..b9be696fe 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -216,15 +216,11 @@ class connection : public Extensible
/** Hostname of connection. Not used if this is a serverrec
*/
- char host[256];
+ char host[160];
- /** IP of connection. Reserved for future use.
+ /** IP of connection.
*/
- char ip[32];
-
- /** Inbuf of connection. Only used for userrec
- */
- char inbuf[MAXBUF];
+ char ip[16];
/** Stats counter for bytes inbound
*/
@@ -254,11 +250,7 @@ class connection : public Extensible
/** Used by userrec to indicate the registration status of the connection
*/
- int registered;
-
- /** Reserved for future use
- */
- short int state;
+ short int registered;
/** Time the connection was last pinged
*/
@@ -276,13 +268,9 @@ class connection : public Extensible
*/
time_t nping;
- /** Unused, will be removed in a future alpha/beta
- */
- char internal_addr[MAXBUF];
+ //char internal_addr[MAXBUF];
- /** Unused, will be removed in a future alpha/beta
- */
- int internal_port;
+ //int internal_port;
/** With a serverrec, this is a list of all established server connections.
* With a userrec this is unused.
diff --git a/include/users.h b/include/users.h
index fa7ea0cfb..2241a6e28 100644
--- a/include/users.h
+++ b/include/users.h
@@ -47,7 +47,7 @@ class ConnectClass : public classbase
public:
/** Type of line, either CC_ALLOW or CC_DENY
*/
- int type;
+ char type;
/** Max time to register the connection in seconds
*/
int registration_timeout;
@@ -66,7 +66,7 @@ class ConnectClass : public classbase
/** Threshold value for flood disconnect
*/
- long threshold;
+ int threshold;
/** Maximum size of sendq for users in this class (bytes)
*/
@@ -122,12 +122,12 @@ class userrec : public connection
/** The users ident reply.
*/
- char ident[64];
+ char ident[16];
/** The host displayed to non-opers (used for cloaking etc).
* This usually matches the value of userrec::host.
*/
- char dhost[256];
+ char dhost[160];
/** The users full name.
*/
@@ -165,7 +165,7 @@ class userrec : public connection
* If they do not send their details in this time limit they
* will be disconnected
*/
- unsigned long timeout;
+ unsigned int timeout;
/** The oper type they logged in as, if they are an oper.
* This is used to check permissions in operclasses, so that
@@ -180,7 +180,7 @@ class userrec : public connection
/** Number of seconds between PINGs for this user (set from &lt;connect:allow&gt; tag
*/
- unsigned long pingmax;
+ unsigned int pingmax;
/** Password specified by the user when they registered.
* This is stored even if the <connect> block doesnt need a password, so that
@@ -201,7 +201,7 @@ class userrec : public connection
/** Flood counters
*/
- long lines_in;
+ int lines_in;
time_t reset_due;
long threshold;