summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp8
-rw-r--r--src/users.cpp11
2 files changed, 8 insertions, 11 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 448764e1c..99c25fbfc 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -48,7 +48,7 @@ Channel::Channel(const std::string &cname, time_t ts)
void Channel::SetMode(ModeHandler* mh, bool on)
{
- modes[mh->GetModeChar() - 65] = on;
+ modes[mh->GetId()] = on;
}
void Channel::SetTopic(User* u, const std::string& ntopic)
@@ -598,12 +598,10 @@ const char* Channel::ChanModes(bool showkey)
/* This was still iterating up to 190, Channel::modes is only 64 elements -- Om */
for(int n = 0; n < 64; n++)
{
- if(this->modes[n])
+ ModeHandler* mh = ServerInstance->Modes->FindMode(n + 65, MODETYPE_CHANNEL);
+ if (mh && IsModeSet(mh))
{
scratch.push_back(n + 65);
- ModeHandler* mh = ServerInstance->Modes->FindMode(n+'A', MODETYPE_CHANNEL);
- if (!mh)
- continue;
ParamModeBase* pm = mh->IsParameterMode();
if (!pm)
diff --git a/src/users.cpp b/src/users.cpp
index eb91a9cb5..6545e3b7a 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -40,9 +40,8 @@ bool User::IsNoticeMaskSet(unsigned char sm)
bool User::IsModeSet(unsigned char m)
{
- if (!isalpha(m))
- return false;
- return (modes[m-65]);
+ ModeHandler* mh = ServerInstance->Modes->FindMode(m, MODETYPE_USER);
+ return (mh && modes[mh->GetId()]);
}
const char* User::FormatModes(bool showparameters)
@@ -53,11 +52,11 @@ const char* User::FormatModes(bool showparameters)
for (unsigned char n = 0; n < 64; n++)
{
- if (modes[n])
+ ModeHandler* mh = ServerInstance->Modes->FindMode(n + 65, MODETYPE_USER);
+ if (mh && IsModeSet(mh))
{
data.push_back(n + 65);
- ModeHandler* mh = ServerInstance->Modes->FindMode(n + 65, MODETYPE_USER);
- if (showparameters && mh && mh->GetNumParams(true))
+ if (showparameters && mh->GetNumParams(true))
{
std::string p = mh->GetUserParameter(this);
if (p.length())