diff options
-rw-r--r-- | include/modes/cmode_i.h | 4 | ||||
-rw-r--r-- | include/modes/cmode_m.h | 3 | ||||
-rw-r--r-- | include/modes/cmode_n.h | 3 | ||||
-rw-r--r-- | include/modes/cmode_p.h | 3 | ||||
-rw-r--r-- | include/modes/cmode_s.h | 3 | ||||
-rw-r--r-- | include/modes/umode_i.h | 3 | ||||
-rw-r--r-- | include/modes/umode_s.h | 3 | ||||
-rw-r--r-- | include/modes/umode_w.h | 3 | ||||
-rw-r--r-- | src/modes/cmode_i.cpp | 14 | ||||
-rw-r--r-- | src/modes/cmode_m.cpp | 15 | ||||
-rw-r--r-- | src/modes/cmode_n.cpp | 15 | ||||
-rw-r--r-- | src/modes/cmode_p.cpp | 14 | ||||
-rw-r--r-- | src/modes/cmode_s.cpp | 14 | ||||
-rw-r--r-- | src/modes/umode_i.cpp | 19 | ||||
-rw-r--r-- | src/modes/umode_s.cpp | 19 | ||||
-rw-r--r-- | src/modes/umode_w.cpp | 19 |
16 files changed, 17 insertions, 137 deletions
diff --git a/include/modes/cmode_i.h b/include/modes/cmode_i.h index 5c83afb18..a59131ac5 100644 --- a/include/modes/cmode_i.h +++ b/include/modes/cmode_i.h @@ -17,9 +17,9 @@ class InspIRCd; /** Channel mode +i */ -class ModeChannelInviteOnly : public ModeHandler +class ModeChannelInviteOnly : public SimpleChannelModeHandler { public: ModeChannelInviteOnly(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); }; + diff --git a/include/modes/cmode_m.h b/include/modes/cmode_m.h index 69ec34703..6623014de 100644 --- a/include/modes/cmode_m.h +++ b/include/modes/cmode_m.h @@ -17,9 +17,8 @@ class InspIRCd; /** Channel mode +m */ -class ModeChannelModerated : public ModeHandler +class ModeChannelModerated : public SimpleChannelModeHandler { public: ModeChannelModerated(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); }; diff --git a/include/modes/cmode_n.h b/include/modes/cmode_n.h index ccc967ed2..b623904f7 100644 --- a/include/modes/cmode_n.h +++ b/include/modes/cmode_n.h @@ -17,9 +17,8 @@ class InspIRCd; /** Channel mode +n */ -class ModeChannelNoExternal : public ModeHandler +class ModeChannelNoExternal : public SimpleChannelModeHandler { public: ModeChannelNoExternal(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); }; diff --git a/include/modes/cmode_p.h b/include/modes/cmode_p.h index ac564d734..833ad6ef2 100644 --- a/include/modes/cmode_p.h +++ b/include/modes/cmode_p.h @@ -17,9 +17,8 @@ class InspIRCd; /** Channel mode +p */ -class ModeChannelPrivate : public ModeHandler +class ModeChannelPrivate : public SimpleChannelModeHandler { public: ModeChannelPrivate(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); }; diff --git a/include/modes/cmode_s.h b/include/modes/cmode_s.h index a6b2054c5..530394c99 100644 --- a/include/modes/cmode_s.h +++ b/include/modes/cmode_s.h @@ -17,9 +17,8 @@ class InspIRCd; /** Channel mode +s */ -class ModeChannelSecret : public ModeHandler +class ModeChannelSecret : public SimpleChannelModeHandler { public: ModeChannelSecret(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); }; diff --git a/include/modes/umode_i.h b/include/modes/umode_i.h index 83223b8fd..8a998973b 100644 --- a/include/modes/umode_i.h +++ b/include/modes/umode_i.h @@ -17,10 +17,9 @@ class InspIRCd; /** User mode +i */ -class ModeUserInvisible : public ModeHandler +class ModeUserInvisible : public SimpleUserModeHandler { public: ModeUserInvisible(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); unsigned int GetCount(); }; diff --git a/include/modes/umode_s.h b/include/modes/umode_s.h index 047defd87..4747b15d0 100644 --- a/include/modes/umode_s.h +++ b/include/modes/umode_s.h @@ -17,10 +17,9 @@ class InspIRCd; /** User mode +s */ -class ModeUserServerNotice : public ModeHandler +class ModeUserServerNotice : public SimpleUserModeHandler { public: ModeUserServerNotice(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); unsigned int GetCount(); }; diff --git a/include/modes/umode_w.h b/include/modes/umode_w.h index ac9adbc35..a45c64ef0 100644 --- a/include/modes/umode_w.h +++ b/include/modes/umode_w.h @@ -17,10 +17,9 @@ class InspIRCd; /** User mode +w */ -class ModeUserWallops : public ModeHandler +class ModeUserWallops : public SimpleUserModeHandler { public: ModeUserWallops(InspIRCd* Instance); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode); unsigned int GetCount(); }; diff --git a/src/modes/cmode_i.cpp b/src/modes/cmode_i.cpp index 57dbe75b2..17c89c24a 100644 --- a/src/modes/cmode_i.cpp +++ b/src/modes/cmode_i.cpp @@ -17,19 +17,7 @@ #include "users.h" #include "modes/cmode_i.h" -ModeChannelInviteOnly::ModeChannelInviteOnly(InspIRCd* Instance) : ModeHandler(Instance, 'i', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelInviteOnly::ModeChannelInviteOnly(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'i') { } -ModeAction ModeChannelInviteOnly::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode) -{ - if (channel->modes[CM_INVITEONLY] != adding) - { - channel->modes[CM_INVITEONLY] = adding; - return MODEACTION_ALLOW; - } - else - { - return MODEACTION_DENY; - } -} diff --git a/src/modes/cmode_m.cpp b/src/modes/cmode_m.cpp index ab8ed80a1..0714b4e01 100644 --- a/src/modes/cmode_m.cpp +++ b/src/modes/cmode_m.cpp @@ -17,20 +17,7 @@ #include "users.h" #include "modes/cmode_m.h" -ModeChannelModerated::ModeChannelModerated(InspIRCd* Instance) : ModeHandler(Instance, 'm', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelModerated::ModeChannelModerated(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'm') { } -ModeAction ModeChannelModerated::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode) -{ - if (channel->modes[CM_MODERATED] != adding) - { - channel->modes[CM_MODERATED] = adding; - return MODEACTION_ALLOW; - } - else - { - return MODEACTION_DENY; - } -} - diff --git a/src/modes/cmode_n.cpp b/src/modes/cmode_n.cpp index 0f3607566..e8ede5976 100644 --- a/src/modes/cmode_n.cpp +++ b/src/modes/cmode_n.cpp @@ -17,20 +17,7 @@ #include "users.h" #include "modes/cmode_n.h" -ModeChannelNoExternal::ModeChannelNoExternal(InspIRCd* Instance) : ModeHandler(Instance, 'n', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelNoExternal::ModeChannelNoExternal(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'n') { } -ModeAction ModeChannelNoExternal::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode) -{ - if (channel->modes[CM_NOEXTERNAL] != adding) - { - channel->modes[CM_NOEXTERNAL] = adding; - return MODEACTION_ALLOW; - } - else - { - return MODEACTION_DENY; - } -} - diff --git a/src/modes/cmode_p.cpp b/src/modes/cmode_p.cpp index b83980a11..c9efee2e0 100644 --- a/src/modes/cmode_p.cpp +++ b/src/modes/cmode_p.cpp @@ -17,19 +17,7 @@ #include "users.h" #include "modes/cmode_p.h" -ModeChannelPrivate::ModeChannelPrivate(InspIRCd* Instance) : ModeHandler(Instance, 'p', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelPrivate::ModeChannelPrivate(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'p') { } -ModeAction ModeChannelPrivate::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode) -{ - if (channel->modes[CM_PRIVATE] != adding) - { - channel->modes[CM_PRIVATE] = adding; - return MODEACTION_ALLOW; - } - else - { - return MODEACTION_DENY; - } -} diff --git a/src/modes/cmode_s.cpp b/src/modes/cmode_s.cpp index ab1365536..92fa4ea94 100644 --- a/src/modes/cmode_s.cpp +++ b/src/modes/cmode_s.cpp @@ -17,19 +17,7 @@ #include "users.h" #include "modes/cmode_s.h" -ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : ModeHandler(Instance, 's', 0, 0, false, MODETYPE_CHANNEL, false) +ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 's') { } -ModeAction ModeChannelSecret::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode) -{ - if (channel->modes[CM_SECRET] != adding) - { - channel->modes[CM_SECRET] = adding; - return MODEACTION_ALLOW; - } - else - { - return MODEACTION_DENY; - } -} diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp index 493687ea7..e7a4a8e11 100644 --- a/src/modes/umode_i.cpp +++ b/src/modes/umode_i.cpp @@ -17,27 +17,10 @@ #include "users.h" #include "modes/umode_i.h" -ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : ModeHandler(Instance, 'i', 0, 0, false, MODETYPE_USER, false) +ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'i') { } -ModeAction ModeUserInvisible::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding, bool servermode) -{ - /* Only opers can change other users modes */ - if ((source != dest) && (!*source->oper)) - return MODEACTION_DENY; - - /* Set the bitfields */ - if (dest->modes[UM_INVISIBLE] != adding) - { - dest->modes[UM_INVISIBLE] = adding; - return MODEACTION_ALLOW; - } - - /* Allow the change */ - return MODEACTION_DENY; -} - unsigned int ModeUserInvisible::GetCount() { return count; diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp index 4e5fba8e0..6b6e521eb 100644 --- a/src/modes/umode_s.cpp +++ b/src/modes/umode_s.cpp @@ -17,27 +17,10 @@ #include "users.h" #include "modes/umode_s.h" -ModeUserServerNotice::ModeUserServerNotice(InspIRCd* Instance) : ModeHandler(Instance, 's', 0, 0, false, MODETYPE_USER, false) +ModeUserServerNotice::ModeUserServerNotice(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 's') { } -ModeAction ModeUserServerNotice::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding, bool servermode) -{ - /* Only opers can change other users modes */ - if ((source != dest) && (!*source->oper)) - return MODEACTION_DENY; - - /* Set the bitfields */ - if (dest->modes[UM_SERVERNOTICE] != adding) - { - dest->modes[UM_SERVERNOTICE] = adding; - return MODEACTION_ALLOW; - } - - /* Allow the change */ - return MODEACTION_DENY; -} - unsigned int ModeUserServerNotice::GetCount() { return count; diff --git a/src/modes/umode_w.cpp b/src/modes/umode_w.cpp index 32fbe9e76..fe4ba8ccd 100644 --- a/src/modes/umode_w.cpp +++ b/src/modes/umode_w.cpp @@ -17,27 +17,10 @@ #include "users.h" #include "modes/umode_w.h" -ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : ModeHandler(Instance, 'w', 0, 0, false, MODETYPE_USER, false) +ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'w') { } -ModeAction ModeUserWallops::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding, bool servermode) -{ - /* Only opers can change other users modes */ - if ((source != dest) && (!*source->oper)) - return MODEACTION_DENY; - - /* Set the bitfields */ - if (dest->modes[UM_WALLOPS] != adding) - { - dest->modes[UM_WALLOPS] = adding; - return MODEACTION_ALLOW; - } - - /* Allow the change */ - return MODEACTION_DENY; -} - unsigned int ModeUserWallops::GetCount() { return count; |