diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/channels.h | 22 | ||||
| -rw-r--r-- | include/extern.h | 7 | ||||
| -rw-r--r-- | include/modes.h | 6 | ||||
| -rw-r--r-- | include/services.h | 9 | ||||
| -rw-r--r-- | include/users.h | 12 |
5 files changed, 33 insertions, 23 deletions
diff --git a/include/channels.h b/include/channels.h index 3baae9f1b..e543370b4 100644 --- a/include/channels.h +++ b/include/channels.h @@ -35,6 +35,7 @@ struct UserContainer { User *user; UserData *ud; + Flags<ChannelModeName> *Status; UserContainer(User *u) : user(u) { ud = new UserData; } virtual ~UserContainer() { delete ud; } @@ -109,6 +110,27 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> */ void DeleteUser(User *u); + /** Check if the user is on the channel + * @param u The user + * @return A user container if found, else NULL + */ + UserContainer *FindUser(User *u); + + /** Check if a user has a status on a channel + * @param u The user + * @param cms The status mode, or NULL to represent no status + * @return true or false + */ + bool HasUserStatus(User *u, ChannelModeStatus *cms); + + /** Check if a user has a status on a channel + * Use the overloaded function for ChannelModeStatus* to check for no status + * @param u The user + * @param Name The Mode name, eg CMODE_OP, CMODE_VOICE + * @return true or false + */ + bool HasUserStatus(User *u, ChannelModeName Name); + /** See if the channel has any modes at all * @return true or false */ diff --git a/include/extern.h b/include/extern.h index 37fc40144..2e610f1fa 100644 --- a/include/extern.h +++ b/include/extern.h @@ -75,16 +75,10 @@ E Channel *nextchan(); E void ChanSetInternalModes(Channel *c, int ac, const char **av); -E int is_on_chan(Channel * c, User * u); E User *nc_on_chan(Channel * c, NickCore * nc); E char *chan_get_modes(Channel * chan, int complete, int plus); -E int chan_get_user_status(Channel * chan, User * user); -E int chan_has_user_status(Channel * chan, User * user, int16 status); -E void chan_remove_user_status(Channel * chan, User * user, int16 status); -E void chan_set_user_status(Channel * chan, User * user, int16 status); - E int get_access_level(ChannelInfo * ci, NickAlias * na); E const char *get_xop_level(int level); @@ -385,7 +379,6 @@ E void change_core_display(NickCore * nc); E void change_core_display(NickCore * nc, const char *newdisplay); E void release(NickAlias * na, int from_timeout); E int do_setmodes(User * u); -E int should_mode_change(int16 status, int16 mode); E void ns_init(); E void nickserv(User * u, char *buf); diff --git a/include/modes.h b/include/modes.h index 64532bb6d..66f5f85b8 100644 --- a/include/modes.h +++ b/include/modes.h @@ -198,19 +198,15 @@ class CoreExport ChannelModeParam : public ChannelMode class CoreExport ChannelModeStatus : public ChannelMode { public: - /** CUS_ values, see below - */ - int16 Status; /* The symbol, eg @ % + */ char Symbol; /** Default constructor * @param mName The mode name - * @param mStatus A CUS_ value * @param mSymbol The symbol for the mode, eg @ % + * @param mProtectBotServ Should botserv clients reset this on themself if it gets unset? */ - ChannelModeStatus(ChannelModeName mName, int16 mStatus, char mSymbol, bool mProtectBotServ = false); + ChannelModeStatus(ChannelModeName mName, char mSymbol, bool mProtectBotServ = false); /** Default destructor */ diff --git a/include/services.h b/include/services.h index 6a2c748c4..eb9fdc34d 100644 --- a/include/services.h +++ b/include/services.h @@ -778,15 +778,6 @@ class Server : public Flags<ServerFlag> /*************************************************************************/ -#define CUS_OP 0x0001 -#define CUS_VOICE 0x0002 -#define CUS_HALFOP 0x0004 /* Halfop (+h) */ -#define CUS_OWNER 0x0008 /* Owner/Founder (+q) */ -#define CUS_PROTECT 0x0010 /* Protected users (+a) */ -/* #define CUS_DEOPPED 0x0080 */ /* Removed due to IRCd checking it */ - -/*************************************************************************/ - #include "users.h" /* This structure stocks ban data since it must not be removed when diff --git a/include/users.h b/include/users.h index 03dad2e55..c5b67ab4c 100644 --- a/include/users.h +++ b/include/users.h @@ -12,9 +12,9 @@ struct ChannelContainer { Channel *chan; - int16 status; + Flags<ChannelModeName> *Status; - ChannelContainer(Channel *c) : chan(c) { status = 0; } + ChannelContainer(Channel *c) : chan(c) { } virtual ~ChannelContainer() { } }; @@ -222,5 +222,13 @@ class CoreExport User : public Extensible * @param modes The modes */ void SetModes(BotInfo *bi, const char *modes, ...); + + /** Find the channel container for Channel c that the user is on + * This is preferred over using FindUser in Channel, as there are usually more users in a channel + * than channels a user is in + * @param c The channel + * @return The channel container, or NULL + */ + ChannelContainer *FindChannel(Channel *c); }; |
