X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fusers.h;h=a12282ac92050b3e1a61556150348d5039432f32;hb=743c10e4ca5acd45e670b335a07b5bf3ab754ab6;hp=a7b6f56290449880468cba6010a12addae2d982e;hpb=18154f4d229cf8ebdcec0dac671ad6e2e0049fee;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/users.h b/include/users.h index a7b6f5629..a12282ac9 100644 --- a/include/users.h +++ b/include/users.h @@ -18,6 +18,8 @@ #include "connection.h" #include "dns.h" +#include "mode.h" + /** Channel status for a user */ enum ChanStatus { @@ -207,7 +209,7 @@ public: */ void Update(unsigned int timeout, unsigned int fld, const std::string &hst, unsigned int ping, const std::string &pas, unsigned int thres, unsigned long sendq, unsigned long recvq, - unsigned long maxl, unsigned long maxg, unsigned int maxc, int p, unsigned long limit) + unsigned long maxl, unsigned long maxg, unsigned int maxc, int p, unsigned long llimit) { if (timeout) registration_timeout = timeout; @@ -234,7 +236,7 @@ public: if (p) port = p; - this->limit = limit; + this->limit = llimit; } /** Reference counter. Contains an int as to how many users are connected to this class. :) @@ -455,6 +457,12 @@ class CoreExport User : public connection std::map* AllowedOperCommands; + /** Allowed user modes from oper classes. */ + bool AllowedUserModes[64]; + + /** Allowed channel modes from oper classes. */ + bool AllowedChanModes[64]; + public: /** 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 +763,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 +940,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 @@ -1033,7 +1054,7 @@ class CoreExport User : public connection * @param text The text format string to send * @param ... Format arguments */ - void SendAll(const char* command, char* text, ...); + void SendAll(const char* command, const char* text, ...); /** Compile a channel list for this user, and send it to the user 'source' * Used internally by WHOIS