mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Move GetAllPrefixChars() from Channel to Membership
This commit is contained in:
parent
74ccc28da3
commit
8bdc2313a6
@ -304,14 +304,6 @@ class CoreExport Channel : public Extensible, public InviteBase<Channel>
|
||||
*/
|
||||
void UserList(User *user);
|
||||
|
||||
/** Return all of a users mode prefixes into a char* string.
|
||||
* @param user The user to look up
|
||||
* @return A list of all prefix characters. The prefixes will always
|
||||
* be in rank order, greatest first, as certain IRC clients require
|
||||
* this when multiple prefixes are used names lists.
|
||||
*/
|
||||
const char* GetAllPrefixChars(User* user);
|
||||
|
||||
/** Get the value of a users prefix on this channel.
|
||||
* @param user The user to look up
|
||||
* @return The module or core-defined value of the users prefix.
|
||||
|
@ -52,6 +52,13 @@ class CoreExport Membership : public Extensible, public intrusive_list_node<Memb
|
||||
* prefixes, using GetPrefixValue().
|
||||
*/
|
||||
char GetPrefixChar() const;
|
||||
|
||||
/** Return all prefix chars this member has.
|
||||
* @return A list of all prefix characters. The prefixes will always
|
||||
* be in rank order, greatest first, as certain IRC clients require
|
||||
* this when multiple prefixes are used names lists.
|
||||
*/
|
||||
const char* GetAllPrefixChars() const;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -756,20 +756,16 @@ unsigned int Membership::getRank()
|
||||
return rv;
|
||||
}
|
||||
|
||||
const char* Channel::GetAllPrefixChars(User* user)
|
||||
const char* Membership::GetAllPrefixChars() const
|
||||
{
|
||||
static char prefix[64];
|
||||
int ctr = 0;
|
||||
|
||||
UserMembIter m = userlist.find(user);
|
||||
if (m != userlist.end())
|
||||
for (std::string::const_iterator i = modes.begin(); i != modes.end(); ++i)
|
||||
{
|
||||
for(unsigned int i=0; i < m->second->modes.length(); i++)
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(m->second->modes[i]);
|
||||
if (mh && mh->GetPrefix())
|
||||
prefix[ctr++] = mh->GetPrefix();
|
||||
}
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i);
|
||||
if (mh && mh->GetPrefix())
|
||||
prefix[ctr++] = mh->GetPrefix();
|
||||
}
|
||||
prefix[ctr] = 0;
|
||||
|
||||
|
@ -232,7 +232,7 @@ class CommandCheck : public Command
|
||||
*/
|
||||
user->SendText("%s member %-3lu %s%s (%s@%s) %s ",
|
||||
checkstr.c_str(), ServerInstance->Users->GlobalCloneCount(i->first),
|
||||
targchan->GetAllPrefixChars(i->first), i->first->nick.c_str(),
|
||||
i->second->GetAllPrefixChars(), i->first->nick.c_str(),
|
||||
i->first->ident.c_str(), i->first->dhost.c_str(), i->first->fullname.c_str());
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class ModuleDeaf : public Module
|
||||
if (is_bypasschar && !is_a_uline)
|
||||
continue; /* deliver message */
|
||||
|
||||
if (status && !strchr(chan->GetAllPrefixChars(i->first), status))
|
||||
if (status && !strchr(i->second->GetAllPrefixChars(), status))
|
||||
continue;
|
||||
|
||||
/* don't deliver message! */
|
||||
|
@ -168,7 +168,7 @@ class ModuleHttpStats : public Module
|
||||
{
|
||||
Membership* memb = x->second;
|
||||
data << "<channelmember><uid>" << memb->user->uuid << "</uid><privs>"
|
||||
<< Sanitize(c->GetAllPrefixChars(x->first)) << "</privs><modes>"
|
||||
<< Sanitize(memb->GetAllPrefixChars()) << "</privs><modes>"
|
||||
<< memb->modes << "</modes>";
|
||||
DumpMeta(data, memb);
|
||||
data << "</channelmember>";
|
||||
|
@ -68,7 +68,7 @@ class ModuleNamesX : public Module
|
||||
if (nick.empty())
|
||||
return;
|
||||
|
||||
prefixes = memb->chan->GetAllPrefixChars(memb->user);
|
||||
prefixes = memb->GetAllPrefixChars();
|
||||
}
|
||||
|
||||
void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Membership* memb, std::string& line) CXX11_OVERRIDE
|
||||
@ -91,7 +91,7 @@ class ModuleNamesX : public Module
|
||||
// pos
|
||||
|
||||
// Don't do anything if the user has only one prefix
|
||||
std::string prefixes = memb->chan->GetAllPrefixChars(memb->user);
|
||||
std::string prefixes = memb->GetAllPrefixChars();
|
||||
if (prefixes.length() <= 1)
|
||||
return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user