]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
The bug we fixed for bug #506 may still occur in trunk if a module adjusts the nick...
[user/henk/code/inspircd.git] / include / users.h
index a63dd7cc67a95b882eb29a5e985cc9f3eaea19ff..74b55202d5db4375a67119711245e07923bb1b94 100644 (file)
@@ -18,6 +18,8 @@
 #include "connection.h"
 #include "dns.h"
 
+#include "mode.h"
+
 /** Channel status for a user
  */
 enum ChanStatus {
@@ -455,7 +457,17 @@ class CoreExport User : public connection
 
        std::map<std::string, bool>* AllowedOperCommands;
 
+       /** Allowed user modes from oper classes. */
+       bool* AllowedUserModes;
+
+       /** Allowed channel modes from oper classes. */
+       bool* AllowedChanModes;
+
  public:
+       /** Module responsible for raw i/o
+        */
+       Module* io;
+
        /** Contains a pointer to the connect class a user is on from - this will be NULL for remote connections.
         * The pointer is guarenteed to *always* be valid. :)
         */
@@ -755,6 +767,15 @@ class CoreExport User : public connection
         */
        bool HasPermission(const std::string &command);
 
+       /** Returns true or false if a user can set a privileged user or channel mode.
+        * This is done by looking up their oper type from User::oper, then referencing
+        * this to their oper classes, and checking the modes they can set.
+        * @param mode The mode the check
+        * @param type ModeType (MODETYPE_CHANNEL or MODETYPE_USER).
+        * @return True if the user can set or unset this mode.
+        */
+       bool HasModePermission(unsigned char mode, ModeType type);
+
        /** Calls read() to read some data for this user using their fd.
         * @param buffer The buffer to read into
         * @param size The size of data to read
@@ -923,6 +944,10 @@ class CoreExport User : public connection
         */
        void WriteServ(const char* text, ...);
 
+       void WriteNumeric(unsigned int numeric, const char* text, ...);
+
+       void WriteNumeric(unsigned int numeric, const std::string &text);
+
        /** Write text to this user, appending CR/LF and prepending :nick!user@host of the user provided in the first parameter.
         * @param user The user to prepend the :nick!user@host of
         * @param text A std::string to send to the user