diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-23 20:20:41 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-23 20:20:41 +0000 |
commit | 8b864c8a828d6ca97b5ec15fa7bf8fcc35027294 (patch) | |
tree | 2aad4b5f18e3746bebd062496d906d44741d067f /src/channels.cpp | |
parent | 985169b6ee6d6af8c24f4e2aee95d15b38f2401d (diff) |
Mode handlers handling listmodes where a listmode item is a nickname can now specify prefixes!!!!!!
This isnt documented yet.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4997 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index a89b9b2c4..4d68af99c 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -430,6 +430,7 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr,ucrec *a,userrec* u /* first user in is given ops */ a->uc_modes = UCMODE_OP; Ptr->AddOppedUser(user); + Ptr->SetPrefix(user, '@', OP_VALUE, true); } else { @@ -880,26 +881,26 @@ long chanrec::GetMaxBans() const char* chanrec::GetStatusChar(userrec *user) { - for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++) + static char px[2]; + unsigned int mx = 0; + + *px = 0; + *(px+1) = 0; + + prefixlist::iterator n = prefixes.find(user); + if (n != prefixes.end()) { - if ((*i)->channel == this) + for (std::vector<prefixtype>::iterator x = n->second.begin(); x != n->second.end(); x++) { - if (((*i)->uc_modes & UCMODE_OP) > 0) - { - return "@"; - } - if (((*i)->uc_modes & UCMODE_HOP) > 0) - { - return "%"; - } - if (((*i)->uc_modes & UCMODE_VOICE) > 0) + if (x->second > mx) { - return "+"; + *px = x->first; + mx = x->second; } - return ""; } } - return ""; + + return px; } @@ -944,4 +945,34 @@ int chanrec::GetStatus(userrec *user) return STATUS_NORMAL; } +void chanrec::SetPrefix(userrec* user, char prefix, unsigned int prefix_value, bool adding) +{ + prefixlist::iterator n = prefixes.find(user); + prefixtype pfx = std::make_pair(prefix,prefix_value); + if (adding) + { + if (n != prefixes.end()) + { + if (std::find(n->second.begin(), n->second.end(), pfx) == n->second.end()) + { + n->second.push_back(pfx); + } + } + else + { + pfxcontainer one; + one.push_back(pfx); + prefixes.insert(std::make_pair<userrec*,pfxcontainer>(user, one)); + } + } + else + { + if (n != prefixes.end()) + { + pfxcontainer::iterator x = std::find(n->second.begin(), n->second.end(), pfx); + if (x != n->second.end()) + n->second.erase(x); + } + } +} |