summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-24 03:29:58 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-24 03:29:58 +0000
commitb868bb52c55fc902e0acab3c4a43576826817e85 (patch)
treeee67ec4b764846b9f43b064c9c4667ca70192e57 /src
parentb16e16ac1bae4ac5494778b4b8a7009febb58137 (diff)
Get rid of ModePair
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11963 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp4
-rw-r--r--src/listensocket.cpp16
-rw-r--r--src/mode.cpp46
-rw-r--r--src/modes/cmode_b.cpp12
-rw-r--r--src/modes/cmode_h.cpp18
-rw-r--r--src/modes/cmode_k.cpp13
-rw-r--r--src/modes/cmode_l.cpp13
-rw-r--r--src/modes/cmode_o.cpp19
-rw-r--r--src/modes/cmode_v.cpp18
-rw-r--r--src/modules/m_chanprotect.cpp35
-rw-r--r--src/modules/m_delayjoin.cpp9
-rw-r--r--src/modules/m_delaymsg.cpp13
-rw-r--r--src/modules/m_invisible.cpp10
-rw-r--r--src/modules/m_joinflood.cpp9
-rw-r--r--src/modules/m_kicknorejoin.cpp8
-rw-r--r--src/modules/m_messageflood.cpp9
-rw-r--r--src/modules/m_nickflood.cpp9
-rw-r--r--src/modules/m_ojoin.cpp25
-rw-r--r--src/modules/m_operprefix.cpp21
-rw-r--r--src/modules/m_redirect.cpp8
-rw-r--r--src/modules/m_servprotect.cpp3
-rw-r--r--src/modules/m_spanningtree/netburst.cpp2
-rw-r--r--src/users.cpp5
23 files changed, 31 insertions, 294 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index fd9861279..500791ea3 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -377,7 +377,9 @@ Channel* Channel::ForceChan(Channel* Ptr, User* user, const std::string &privs,
Ptr->WriteAllExcept(user, false, 0, except_list, "JOIN :%s", Ptr->name.c_str());
/* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */
- std::string ms = ServerInstance->Modes->ModeString(user, Ptr);
+ std::string ms = memb->modes;
+ for(unsigned int i=0; i < memb->modes.length(); i++)
+ ms.append(" ").append(user->nick);
if ((Ptr->GetUserCounter() > 1) && (ms.length()))
Ptr->WriteAllExceptSender(user, true, 0, "MODE %s +%s", Ptr->name.c_str(), ms.c_str());
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index 038c665be..43584eae1 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -71,16 +71,12 @@ void ListenSocket::AcceptInternal()
irc::sockets::sockaddrs client;
irc::sockets::sockaddrs server;
- ServerInstance->Logs->Log("SOCKET",DEBUG,"HandleEvent for Listensoket");
- int incomingSockfd;
-
socklen_t length = sizeof(client);
- incomingSockfd = ServerInstance->SE->Accept(this, &client.sa, &length);
+ int incomingSockfd = ServerInstance->SE->Accept(this, &client.sa, &length);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"HandleEvent for Listensoket %s nfd=%d", bind_desc.c_str(), incomingSockfd);
if (incomingSockfd < 0)
{
- ServerInstance->SE->Shutdown(incomingSockfd, 2);
- ServerInstance->SE->Close(incomingSockfd);
ServerInstance->stats->statsRefused++;
return;
}
@@ -141,7 +137,6 @@ void ListenSocket::AcceptInternal()
}
ServerInstance->SE->NonBlocking(incomingSockfd);
- ServerInstance->stats->statsAccept++;
ModResult res;
FIRST_MOD_RESULT(OnAcceptConnection, res, (incomingSockfd, this, &client, &server));
@@ -154,8 +149,13 @@ void ListenSocket::AcceptInternal()
res = MOD_RES_ALLOW;
}
}
- if (res != MOD_RES_ALLOW)
+ if (res == MOD_RES_ALLOW)
{
+ ServerInstance->stats->statsAccept++;
+ }
+ else
+ {
+ ServerInstance->stats->statsRefused++;
ServerInstance->Logs->Log("SOCKET",DEFAULT,"Refusing connection on %s - %s",
bind_desc.c_str(), res == MOD_RES_DENY ? "Connection refused by module" : "Module for this port not found");
ServerInstance->SE->Close(incomingSockfd);
diff --git a/src/mode.cpp b/src/mode.cpp
index d19647cae..d12469aef 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -121,18 +121,6 @@ ModeAction ModeHandler::OnModeChange(User*, User*, Channel*, std::string&, bool)
return MODEACTION_DENY;
}
-ModePair ModeHandler::ModeSet(User*, User* dest, Channel* channel, const std::string&)
-{
- if (dest)
- {
- return std::make_pair(dest->IsModeSet(this->mode), "");
- }
- else
- {
- return std::make_pair(channel->IsModeSet(this->mode), "");
- }
-}
-
void ModeHandler::DisplayList(User*, Channel*)
{
}
@@ -768,40 +756,6 @@ ModeHandler* ModeParser::FindPrefix(unsigned const char pfxletter)
return NULL;
}
-std::string ModeParser::ModeString(User* user, Channel* channel, bool nick_suffix)
-{
- std::string types;
- std::string pars;
-
- if (!channel || !user)
- return "";
-
- for (unsigned char mode = 'A'; mode <= 'z'; mode++)
- {
- unsigned char pos = (mode-65) | MASK_CHANNEL;
- ModeHandler* mh = modehandlers[pos];
- if ((mh) && (mh->GetNumParams(true)) && (mh->GetNumParams(false)))
- {
- ModePair ret;
- ret = mh->ModeSet(NULL, user, channel, user->nick);
- if ((ret.first) && (ret.second == user->nick))
- {
- if (nick_suffix)
- {
- pars.append(" ");
- pars.append(user->nick);
- }
- types.push_back(mh->GetModeChar());
- }
- }
- }
-
- if (nick_suffix)
- return types+pars;
- else
- return types;
-}
-
std::string ModeParser::GiveModeList(ModeMasks m)
{
std::string type1; /* Listmodes EXCEPT those with a prefix */
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index 477d87544..b2b3f3c6f 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -141,18 +141,6 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan
return dest;
}
-ModePair ModeChannelBan::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
-{
- for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++)
- {
- if (!strcasecmp(i->data.c_str(), parameter.c_str()))
- {
- return std::make_pair(true, i->data);
- }
- }
- return std::make_pair(false, parameter);
-}
-
std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan, int)
{
if ((!user) || (!chan))
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 9ca050de2..0b0f0b700 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -32,24 +32,6 @@ unsigned int ModeChannelHalfOp::GetPrefixRank()
return HALFOP_VALUE;
}
-ModePair ModeChannelHalfOp::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
-{
- User* x = ServerInstance->FindNick(parameter);
- if (x)
- {
- Membership* memb = channel->GetUser(x);
- if (memb && memb->hasMode('h'))
- {
- return std::make_pair(true, x->nick);
- }
- else
- {
- return std::make_pair(false, x->nick);
- }
- }
- return std::make_pair(false, parameter);
-}
-
void ModeChannelHalfOp::RemoveMode(Channel* channel, irc::modestacker* stack)
{
const UserMembList* clist = channel->GetUsers();
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index 5b273cdd1..d8b04b576 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -21,19 +21,6 @@ ModeChannelKey::ModeChannelKey() : ModeHandler(NULL, "key", 'k', PARAM_ALWAYS, M
{
}
-ModePair ModeChannelKey::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
-{
- if (channel->modes[CM_KEY])
- {
- std::string ckey = channel->GetModeParameter('k');
- return std::make_pair(true, ckey);
- }
- else
- {
- return std::make_pair(false, parameter);
- }
-}
-
void ModeChannelKey::RemoveMode(Channel* channel, irc::modestacker* stack)
{
/** +k needs a parameter when being removed,
diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp
index 0fddf2af0..fce195200 100644
--- a/src/modes/cmode_l.cpp
+++ b/src/modes/cmode_l.cpp
@@ -21,19 +21,6 @@ ModeChannelLimit::ModeChannelLimit() : ModeHandler(NULL, "limit", 'l', PARAM_SET
{
}
-ModePair ModeChannelLimit::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
-{
- std::string climit = channel->GetModeParameter('l');
- if (!climit.empty())
- {
- return std::make_pair(true, climit);
- }
- else
- {
- return std::make_pair(false, parameter);
- }
-}
-
bool ModeChannelLimit::ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel*)
{
/* When TS is equal, the higher channel limit wins */
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index 1bab9db26..e706302dc 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -32,25 +32,6 @@ unsigned int ModeChannelOp::GetPrefixRank()
return OP_VALUE;
}
-ModePair ModeChannelOp::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
-{
- User* x = ServerInstance->FindNick(parameter);
- if (x)
- {
- Membership* memb = channel->GetUser(x);
- if (memb && memb->hasMode('o'))
- {
- return std::make_pair(true, x->nick);
- }
- else
- {
- return std::make_pair(false, parameter);
- }
- }
- return std::make_pair(false, parameter);
-}
-
-
void ModeChannelOp::RemoveMode(Channel* channel, irc::modestacker* stack)
{
const UserMembList* clist = channel->GetUsers();
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index b791f5574..6e5ebd0a9 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -33,24 +33,6 @@ unsigned int ModeChannelVoice::GetPrefixRank()
return VOICE_VALUE;
}
-ModePair ModeChannelVoice::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
-{
- User* x = ServerInstance->FindNick(parameter);
- if (x)
- {
- Membership* memb = channel->GetUser(x);
- if (memb && memb->hasMode('v'))
- {
- return std::make_pair(true, x->nick);
- }
- else
- {
- return std::make_pair(false, parameter);
- }
- }
- return std::make_pair(false, parameter);
-}
-
void ModeChannelVoice::RemoveMode(Channel* channel, irc::modestacker* stack)
{
const UserMembList* clist = channel->GetUsers();
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 9164d9992..369703d2c 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -44,31 +44,6 @@ class FounderProtectBase
{
}
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- User* x = ServerInstance->FindNick(parameter);
- if (x)
- {
- Membership* memb = channel->GetUser(x);
- if (!memb)
- {
- return std::make_pair(false, parameter);
- }
- else
- {
- if (memb->hasMode(mode))
- {
- return std::make_pair(true, x->nick);
- }
- else
- {
- return std::make_pair(false, parameter);
- }
- }
- }
- return std::make_pair(false, parameter);
- }
-
void RemoveMode(Channel* channel, irc::modestacker* stack)
{
const UserMembList* cl = channel->GetUsers();
@@ -143,11 +118,6 @@ class ChanFounder : public ModeHandler, public FounderProtectBase
return FOUNDER_VALUE;
}
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- return FounderProtectBase::ModeSet(source, dest, channel, parameter);
- }
-
void RemoveMode(Channel* channel, irc::modestacker* stack)
{
FounderProtectBase::RemoveMode(channel, stack);
@@ -215,11 +185,6 @@ class ChanProtect : public ModeHandler, public FounderProtectBase
return PROTECT_VALUE;
}
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- return FounderProtectBase::ModeSet(source, dest, channel, parameter);
- }
-
void RemoveMode(Channel* channel, irc::modestacker* stack)
{
FounderProtectBase::RemoveMode(channel, stack);
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index 5c545c2f6..cde9ed047 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -154,9 +154,12 @@ void ModuleDelayJoin::OnText(User* user, void* dest, int target_type, const std:
/* Display the join to everyone else (the user who joined got it earlier) */
channel->WriteAllExceptSender(user, false, 0, "JOIN %s", channel->name.c_str());
- std::string n = ServerInstance->Modes->ModeString(user, channel);
- if (n.length() > 0)
- channel->WriteAllExceptSender(user, false, 0, "MODE %s +%s", channel->name.c_str(), n.c_str());
+ std::string ms = memb->modes;
+ for(unsigned int i=0; i < memb->modes.length(); i++)
+ ms.append(" ").append(user->nick);
+
+ if (ms.length() > 0)
+ channel->WriteAllExceptSender(user, false, 0, "MODE %s +%s", channel->name.c_str(), ms.c_str());
}
MODULE_INIT(ModuleDelayJoin)
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index 0432bce5b..192bca15f 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -28,19 +28,6 @@ class DelayMsgMode : public ModeHandler
levelrequired = OP_VALUE;
}
- ModePair ModeSet(User*, User*, Channel* channel, const std::string &parameter)
- {
- std::string climit = channel->GetModeParameter('d');
- if (!climit.empty())
- {
- return std::make_pair(true, climit);
- }
- else
- {
- return std::make_pair(false, parameter);
- }
- }
-
bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel*)
{
return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index 0c7cc4dc7..cc2080f7f 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -49,7 +49,11 @@ class InvisibleMode : public ModeHandler
snprintf(tb,MAXBUF,":%s %s %s", dest->GetFullHost().c_str(), adding ? "PART" : "JOIN", (*f)->name.c_str());
std::string out = tb;
- std::string n = ServerInstance->Modes->ModeString(dest, (*f));
+ Membership* memb = (**f).GetUser(dest);
+ std::string ms = memb->modes;
+ for(unsigned int i=0; i < memb->modes.length(); i++)
+ ms.append(" ").append(dest->nick);
+
for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++)
{
@@ -57,8 +61,8 @@ class InvisibleMode : public ModeHandler
if (IS_LOCAL(i->first) && !IS_OPER(i->first))
{
i->first->Write(out);
- if (!n.empty() && !adding)
- i->first->WriteServ("MODE %s +%s", (*f)->name.c_str(), n.c_str());
+ if (!ms.empty() && !adding)
+ i->first->WriteServ("MODE %s +%s", (**f).name.c_str(), ms.c_str());
}
}
}
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index e0555b37f..77d02a288 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -88,15 +88,6 @@ class JoinFlood : public ModeHandler
JoinFlood(Module* Creator) : ModeHandler(Creator, "joinflood", 'j', PARAM_SETONLY, MODETYPE_CHANNEL),
ext("joinflood", Creator) { }
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- joinfloodsettings* x = ext.get(channel);
- if (x)
- return std::make_pair(true, ConvToStr(x->joins)+":"+ConvToStr(x->secs));
- else
- return std::make_pair(false, parameter);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
{
if (adding)
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 9d5fe3b62..aee4bf869 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -34,14 +34,6 @@ class KickRejoin : public ModeHandler
KickRejoin(Module* Creator) : ModeHandler(Creator, "kicknorejoin", 'J', PARAM_SETONLY, MODETYPE_CHANNEL),
ext("norejoinusers", Creator) { }
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- if (channel->IsModeSet('J'))
- return std::make_pair(true, channel->GetModeParameter('J'));
- else
- return std::make_pair(false, parameter);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
{
if (!adding)
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index c39bc9807..5fceee19c 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -78,15 +78,6 @@ class MsgFlood : public ModeHandler
MsgFlood(Module* Creator) : ModeHandler(Creator, "flood", 'f', PARAM_SETONLY, MODETYPE_CHANNEL),
ext("messageflood", Creator) { }
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- floodsettings* x = ext.get(channel);
- if (x)
- return std::make_pair(true, (x->ban ? "*" : "")+ConvToStr(x->lines)+":"+ConvToStr(x->secs));
- else
- return std::make_pair(false, parameter);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
{
floodsettings *f = ext.get(channel);
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index a267cd404..f34cc81e4 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -92,15 +92,6 @@ class NickFlood : public ModeHandler
NickFlood(Module* Creator) : ModeHandler(Creator, "nickflood", 'F', PARAM_SETONLY, MODETYPE_CHANNEL),
ext("nickflood", Creator) { }
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- nickfloodsettings* x = ext.get(channel);
- if (x)
- return std::make_pair(true, ConvToStr(x->nicks)+":"+ConvToStr(x->secs));
- else
- return std::make_pair(false, parameter);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
{
nickfloodsettings *f = ext.get(channel);
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index d5f7b9443..775dea204 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -103,31 +103,6 @@ class NetworkPrefix : public ModeHandler
m_paramtype = TR_NICK;
}
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- User* x = ServerInstance->FindNick(parameter);
- if (x)
- {
- Membership* m = channel->GetUser(x);
- if (!m)
- {
- return std::make_pair(false, parameter);
- }
- else
- {
- if (m->hasMode('Y'))
- {
- return std::make_pair(true, x->nick);
- }
- else
- {
- return std::make_pair(false, parameter);
- }
- }
- }
- return std::make_pair(false, parameter);
- }
-
void RemoveMode(Channel* channel, irc::modestacker* stack)
{
const UserMembList* cl = channel->GetUsers();
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index da1e4d242..e40f6b050 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -49,27 +49,6 @@ class OperPrefixMode : public ModeHandler
}
}
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- User* x = ServerInstance->FindNick(parameter);
- Membership* m = channel->GetUser(x);
- if (x)
- {
- if (!m)
- {
- return std::make_pair(false, parameter);
- }
- else
- {
- if (m->hasMode('y'))
- return std::make_pair(true, x->nick);
- else
- return std::make_pair(false, parameter);
- }
- }
- return std::make_pair(false, parameter);
- }
-
bool NeedsOper() { return true; }
};
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 9a138b7fc..50d2e929f 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -22,14 +22,6 @@ class Redirect : public ModeHandler
public:
Redirect(Module* Creator) : ModeHandler(Creator, "redirect", 'L', PARAM_SETONLY, MODETYPE_CHANNEL) { }
- ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string &parameter)
- {
- if (channel->IsModeSet('L'))
- return std::make_pair(true, channel->GetModeParameter('L'));
- else
- return std::make_pair(false, parameter);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
{
if (adding)
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index 7fd867e9b..dcb0cd7d5 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -79,11 +79,12 @@ class ModuleServProtectMode : public Module
User *u = ServerInstance->FindNick(param);
if (u)
{
+ Membership* memb = chan->GetUser(u);
/* The target user has +k set on themselves, and you are trying to remove a privilege mode the user has set on themselves.
* This includes any prefix permission mode, even those registered in other modules, e.g. +qaohv. Using ::ModeString()
* here means that the number of modes is restricted to only modes the user has, limiting it to as short a loop as possible.
*/
- if (u->IsModeSet('k') && ServerInstance->Modes->ModeString(u, chan, false).find(mode) != std::string::npos)
+ if (u->IsModeSet('k') && memb && memb->modes.find(mode) != std::string::npos)
{
/* BZZZT, Denied! */
user->WriteNumeric(482, "%s %s :You are not permitted to remove privileges from %s services", user->nick.c_str(), chan->name.c_str(), ServerInstance->Config->Network.c_str());
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index 82b6c2b68..981c903a1 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -103,7 +103,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++)
{
size_t ptrlen = 0;
- std::string modestr = ServerInstance->Modes->ModeString(i->first, c, false);
+ std::string modestr = i->second->modes;
if ((curlen + modestr.length() + i->first->uuid.length() + 4) > 480)
{
diff --git a/src/users.cpp b/src/users.cpp
index 36b41fb18..424484b8c 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1376,9 +1376,12 @@ void User::DoHostCycle(const std::string &quitline)
Channel* c = *v;
snprintf(buffer, MAXBUF, ":%s JOIN %s", GetFullHost().c_str(), c->name.c_str());
std::string joinline(buffer);
- std::string modeline = ServerInstance->Modes->ModeString(this, c);
+ Membership* memb = c->GetUser(this);
+ std::string modeline = memb->modes;
if (modeline.length() > 0)
{
+ for(unsigned int i=0; i < memb->modes.length(); i++)
+ modeline.append(" ").append(nick);
snprintf(buffer, MAXBUF, ":%s MODE %s +%s", GetFullHost().c_str(), c->name.c_str(), modeline.c_str());
modeline = buffer;
}