diff options
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index 8351ab2e0..5ae457b68 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -666,6 +666,31 @@ ModeHandler* ModeParser::FindPrefix(unsigned const char pfxletter) return NULL; } +std::string ModeParser::ModeString(userrec* user, chanrec* channel) +{ + std::string types; + std::string pars; + + 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) + { + pars.append(" "); + pars.append(user->nick); + types.push_back(mh->GetModeChar()); + } + } + } + + return types+pars; +} + std::string ModeParser::ChanModes() { std::string type1; /* Listmodes EXCEPT those with a prefix */ |