1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 09:43:13 +02:00

Allowing adding hostmasks to channel access lists

This commit is contained in:
Adam
2010-11-30 03:02:33 -05:00
parent 2a4d57a1ca
commit 0ba566491e
24 changed files with 343 additions and 338 deletions
+1 -4
View File
@@ -63,8 +63,6 @@ E Channel *findchan(const Anope::string &chan);
E User *nc_on_chan(Channel *c, const NickCore *nc);
E int get_access_level(ChannelInfo *ci, NickAlias *na);
E int get_access_level(ChannelInfo *ci, NickCore *nc);
E Anope::string get_xop_level(int level);
E void do_cmode(const Anope::string &source, const Anope::string &channel, const Anope::string &modes, const Anope::string &ts);
@@ -91,7 +89,7 @@ E void get_chanserv_stats(long *nrec, long *memuse);
E void reset_levels(ChannelInfo *ci);
E void cs_init();
E void expire_chans();
E void cs_remove_nick(const NickCore *nc);
E void cs_remove_nick(NickCore *nc);
E void check_modes(Channel *c);
E int check_valid_admin(User *user, Channel *chan, int servermode);
@@ -100,7 +98,6 @@ E int check_valid_op(User *user, Channel *chan, int servermode);
E ChannelInfo *cs_findchan(const Anope::string &chan);
E int check_access(User *user, ChannelInfo *ci, int what);
E bool IsFounder(User *user, ChannelInfo *ci);
E int get_access(User *user, ChannelInfo *ci);
E void update_cs_lastseen(User *user, ChannelInfo *ci);
E int get_idealban(ChannelInfo *ci, User *u, Anope::string &ret);
-6
View File
@@ -392,7 +392,6 @@ enum LanguageString
CHAN_XOP_NOT_AVAILABLE,
CHAN_QOP_SYNTAX,
CHAN_QOP_DISABLED,
CHAN_QOP_NICKS_ONLY,
CHAN_QOP_ADDED,
CHAN_QOP_MOVED,
CHAN_QOP_NO_SUCH_ENTRY,
@@ -406,7 +405,6 @@ enum LanguageString
CHAN_QOP_CLEAR,
CHAN_AOP_SYNTAX,
CHAN_AOP_DISABLED,
CHAN_AOP_NICKS_ONLY,
CHAN_AOP_ADDED,
CHAN_AOP_MOVED,
CHAN_AOP_NO_SUCH_ENTRY,
@@ -420,7 +418,6 @@ enum LanguageString
CHAN_AOP_CLEAR,
CHAN_HOP_SYNTAX,
CHAN_HOP_DISABLED,
CHAN_HOP_NICKS_ONLY,
CHAN_HOP_ADDED,
CHAN_HOP_MOVED,
CHAN_HOP_NO_SUCH_ENTRY,
@@ -434,7 +431,6 @@ enum LanguageString
CHAN_HOP_CLEAR,
CHAN_SOP_SYNTAX,
CHAN_SOP_DISABLED,
CHAN_SOP_NICKS_ONLY,
CHAN_SOP_ADDED,
CHAN_SOP_MOVED,
CHAN_SOP_NO_SUCH_ENTRY,
@@ -448,7 +444,6 @@ enum LanguageString
CHAN_SOP_CLEAR,
CHAN_VOP_SYNTAX,
CHAN_VOP_DISABLED,
CHAN_VOP_NICKS_ONLY,
CHAN_VOP_ADDED,
CHAN_VOP_MOVED,
CHAN_VOP_NO_SUCH_ENTRY,
@@ -466,7 +461,6 @@ enum LanguageString
CHAN_ACCESS_DISABLED,
CHAN_ACCESS_LEVEL_NONZERO,
CHAN_ACCESS_LEVEL_RANGE,
CHAN_ACCESS_NICKS_ONLY,
CHAN_ACCESS_REACHED_LIMIT,
CHAN_ACCESS_LEVEL_UNCHANGED,
CHAN_ACCESS_LEVEL_CHANGED,
+6 -8
View File
@@ -723,25 +723,23 @@ class CoreExport Module : public Extensible
/** Called when access is deleted from a channel
* @param ci The channel
* @param u The user who removed the access
* @param nc The user who was deleted
* @param access The access entry being removed
*/
virtual void OnAccessDel(ChannelInfo *ci, User *u, NickCore *nc) { }
virtual void OnAccessDel(ChannelInfo *ci, User *u, ChanAccess *access) { }
/** Called when access is changed
* @param ci The channel
* @param u The user who changed the access
* @param nc The nick whos access was changed
* @param level The level of the new access
* @param u access The access changed
*/
virtual void OnAccessChange(ChannelInfo *ci, User *u, NickCore *nc, int level) { }
virtual void OnAccessChange(ChannelInfo *ci, User *u, ChanAccess *access) { }
/** Called when access is added
* @param ci The channel
* @param u The user who added the access
* @para nc The nick who was added to access
* @param level The level they were added at
* @param access The access changed
*/
virtual void OnAccessAdd(ChannelInfo *ci, User *u, NickCore *nc, int level) { }
virtual void OnAccessAdd(ChannelInfo *ci, User *u, ChanAccess *access) { }
/** Called when the access list is cleared
* @param ci The channel
+33 -4
View File
@@ -132,14 +132,15 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Add an entry to the channel access list
*
* @param nc The NickCore of the user that the access entry should be tied to
* @param mask The mask of the access entry
* @param level The channel access level the user has on the channel
* @param creator The user who added the access
* @param last_seen When the user was last seen within the channel
* @return The new access class
*
* Creates a new access list entry and inserts it into the access list.
*/
void AddAccess(NickCore *nc, int16 level, const Anope::string &creator, int32 last_seen = 0);
ChanAccess *AddAccess(const Anope::string &mask, int16 level, const Anope::string &creator, int32 last_seen = 0);
/** Get an entry from the channel access list by index
*
@@ -150,15 +151,35 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*/
ChanAccess *GetAccess(unsigned index);
/** Get an entry from the channel access list by User
*
* @param u The User to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @return A ChanAccess struct corresponding to the User, or NULL if not found
*
* Retrieves an entry from the access list that matches the given User, optionally also matching a certain level.
*/
ChanAccess *GetAccess(User *u, int16 level = 0);
/** Get an entry from the channel access list by NickCore
*
* @param nc The NickCore to find within the access list vector
* @param u The NickCore to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @return A ChanAccess struct corresponding to the NickCore, or NULL if not found
*
* Retrieves an entry from the access list that matches the given NickCore, optionally also matching a certain level.
*/
ChanAccess *GetAccess(const NickCore *nc, int16 level = 0);
ChanAccess *GetAccess(NickCore *nc, int16 level = 0);
/** Get an entry from the channel access list by mask
*
* @param u The mask to find within the access list vector
* @param level Optional channel access level to compare the access entries to
* @return A ChanAccess struct corresponding to the mask, or NULL if not found
*
* Retrieves an entry from the access list that matches the given mask, optionally also matching a certain level.
*/
ChanAccess *GetAccess(const Anope::string &mask, int16 level = 0);
/** Get the size of the accss vector for this channel
* @return The access vector size
@@ -173,6 +194,14 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*/
void EraseAccess(unsigned index);
/** Erase an entry from the channel access list
*
* @param access The access to remove
*
* Clears the memory used by the given access entry and removes it from the vector.
*/
void EraseAccess(ChanAccess *access);
/** Clear the entire channel access list
*
* Clears the entire access list by deleting every item and then clearing the vector.
+2 -1
View File
@@ -571,7 +571,8 @@ enum AccessLevel
struct ChanAccess
{
int16 level;
NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */
Anope::string mask; /* Mask of the access entry */
NickCore *nc; /* NC of the entry, if the entry is a valid nickcore */
time_t last_seen;
Anope::string creator;
};