summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/inspircd.h14
-rw-r--r--include/modules.h40
2 files changed, 52 insertions, 2 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 4a0762dbd..3d1872d01 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -19,11 +19,13 @@
#include <assert.h>
#include <sys/param.h>
#include <sys/types.h>
+
#ifndef _LINUX_C_LIB_VERSION
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#endif
+
#include <arpa/inet.h>
#include <string>
#include <deque>
@@ -34,23 +36,34 @@
#include "users.h"
#include "channels.h"
+// some misc defines
+
#define ERROR -1
#define TRUE 1
#define FALSE 0
#define IDENTMAX 9
#define MAXSOCKS 64
+// maximum lengths of items
+
#define MAXQUIT 255
#define MAXCOMMAND 32
#define MAXTOPIC 307
#define MAXKICK 255
+// flags for use with log()
+
#define DEBUG 10
#define VERBOSE 20
#define DEFAULT 30
#define SPARSE 40
#define NONE 50
+// flags for use with WriteMode
+
+#define WM_AND 1
+#define WM_OR 2
+
typedef std::deque<std::string> file_cache;
/* prototypes */
@@ -62,6 +75,7 @@ void ReadConfig(void);
void strlower(char *n);
void WriteOpers(char* text, ...);
+void WriteMode(const char* modes, int flags, const char* text, ...);
void log(int level, char *text, ...);
void Write(int sock,char *text, ...);
void WriteServ(int sock, char* text, ...);
diff --git a/include/modules.h b/include/modules.h
index 2e6fbf860..089ef0afc 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -184,8 +184,30 @@ class Module : public classbase
* processing on the actual channel record at this point, however the channel NAME will still be passed in
* char* cname, so that you could for example implement a channel blacklist or whitelist, etc.
*/
- virtual int Module::OnUserPreJoin(userrec* user, chanrec* chan, char* cname);
-
+ virtual int OnUserPreJoin(userrec* user, chanrec* chan, char* cname);
+
+
+ /** Called whenever a user opers locally.
+ * The userrec will contain the oper mode 'o' as this function is called after any modifications
+ * are made to the user's structure by the core.
+ */
+ virtual void OnOper(userrec* user);
+
+ /** Called whenever a user types /INFO.
+ * The userrec will contain the information of the user who typed the command. Modules may use this
+ * method to output their own credits in /INFO (which is the ircd's version of an about box).
+ * It is purposefully not possible to modify any info that has already been output, or halt the list.
+ * You must write a 371 numeric to the user, containing your info in the following format:
+ *
+ * <nick> :information here
+ */
+ virtual void OnInfo(userrec* user);
+
+ /** Called whenever a /WHOIS is performed on a local user.
+ * The source parameter contains the details of the user who issued the WHOIS command, and
+ * the dest parameter contains the information of the user they are whoising.
+ */
+ void Module::OnWhois(userrec* source, userrec* dest);
};
@@ -348,6 +370,20 @@ class Server : public classbase
*/
virtual void SendMode(char **parameters, int pcnt, userrec *user);
+
+ /** Sends to all users matching a mode mask
+ * You must specify one or more usermodes as the first parameter. These can be RFC specified modes such as +i,
+ * or module provided modes, including ones provided by your own module.
+ * In the second parameter you must place a flag value which indicates wether the modes you have given will be
+ * logically ANDed or OR'ed. You may use one of either WM_AND or WM_OR.
+ * for example, if you were to use:
+ *
+ * Serv->SendToModeMask("xi", WM_OR, "m00");
+ *
+ * Then the text 'm00' will be sent to all users with EITHER mode x or i. Conversely if you used WM_AND, the
+ * user must have both modes set to receive the message.
+ */
+ virtual void SendToModeMask(std::string modes, int flags, std::string text);
};
/** Allows reading of values from configuration files