summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-29 15:23:20 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-29 15:23:20 +0000
commit71247cc2f120b67302271937b887de95c8bcc623 (patch)
treedb20427b07c3c7caa310887c5ab00aaf99409f1d
parent71e6de4b88c3d51bfa59fed44049a4d1ea6d26a1 (diff)
Added 'Extensible' class which allows modules to store custom data in objects
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@750 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/base.h26
-rw-r--r--include/channels.h2
-rw-r--r--include/connection.h2
-rw-r--r--src/InspIRCd.layout40
4 files changed, 43 insertions, 27 deletions
diff --git a/include/base.h b/include/base.h
index b0e264bac..dbe4588e9 100644
--- a/include/base.h
+++ b/include/base.h
@@ -1,15 +1,17 @@
/*
-
-
+Defines the base classes used by InspIRCd
*/
-#include "inspircd_config.h"
-#include <time.h>
-
#ifndef __BASE_H__
#define __BASE_H__
+#include "inspircd_config.h"
+#include <time.h>
+#include <map>
+#include <string>
+typedef void* VoidPointer;
+
/** The base class for all inspircd classes
*/
class classbase
@@ -26,5 +28,19 @@ class classbase
~classbase() { }
};
+/** class Extensible is the parent class of many classes such as userrec and chanrec.
+ * class Extensible implements a system which allows modules to 'extend' the class by attaching data within
+ * a map associated with the object. In this way modules can store their own custom information within user
+ * objects, channel objects and server objects, without breaking other modules (this is more sensible than using
+ * a flags variable, and each module defining bits within the flag as 'theirs' as it is less prone to conflict and
+ * supports arbitary data storage).
+ */
+class Extensible : public classbase
+{
+ /** Private data store
+ */
+ std::map<std::string,VoidPointer> Extension_Items;
+};
+
#endif
diff --git a/include/channels.h b/include/channels.h
index de629c399..c0df69513 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -80,7 +80,7 @@ typedef std::vector<InviteItem> InviteList;
* This class represents a channel, and contains its name, modes, time created, topic, topic set time,
* etc, and an instance of the BanList type.
*/
-class chanrec : public classbase
+class chanrec : public Extensible
{
public:
/** The channels name.
diff --git a/include/connection.h b/include/connection.h
index bb402b5d2..eaa995f89 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -158,7 +158,7 @@ class packet : public classbase
/** Please note: classes serverrec and userrec both inherit from class connection.
*/
-class connection : public classbase
+class connection : public Extensible
{
public:
/** File descriptor of the connection
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 1c776b80e..77a6e15e3 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -1,5 +1,5 @@
[Editors]
-Focused=42
+Focused=-1
Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0
[Editor_0]
@@ -13,9 +13,9 @@ LeftChar=1
[Editor_1]
Open=1
Top=0
-CursorCol=1
-CursorRow=91
-TopLine=53
+CursorCol=26
+CursorRow=90
+TopLine=131
LeftChar=1
[Editor_2]
@@ -101,21 +101,21 @@ LeftChar=1
[Editor_12]
Open=1
Top=0
-CursorCol=12
-CursorRow=104
-TopLine=104
+CursorCol=34
+CursorRow=83
+TopLine=130
LeftChar=1
[Editor_13]
Open=1
Top=0
-CursorCol=12
-CursorRow=174
-TopLine=12
+CursorCol=37
+CursorRow=161
+TopLine=120
LeftChar=1
[Editor_14]
-Open=0
+Open=1
Top=0
CursorCol=1
CursorRow=23
@@ -123,7 +123,7 @@ TopLine=1
LeftChar=1
[Editor_15]
-Open=0
+Open=1
Top=0
CursorCol=1
CursorRow=81
@@ -181,16 +181,16 @@ LeftChar=1
[Editor_22]
Open=1
Top=0
-CursorCol=15
-CursorRow=121
-TopLine=119
+CursorCol=34
+CursorRow=78
+TopLine=51
LeftChar=1
[Editor_23]
-Open=0
+Open=1
Top=0
-CursorCol=1
-CursorRow=1
+CursorCol=2
+CursorRow=30
TopLine=1
LeftChar=1
@@ -322,7 +322,7 @@ TopLine=1
LeftChar=1
[Editor_42]
Open=1
-Top=1
+Top=0
CursorCol=10
CursorRow=538
TopLine=510
@@ -336,7 +336,7 @@ TopLine=1498
LeftChar=1
[Editor_44]
Open=1
-Top=0
+Top=1
CursorCol=63
CursorRow=63
TopLine=16