summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-23 21:09:49 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-23 21:09:49 +0000
commit594d430ee457b621c731a6cc70d84c02c295d59c (patch)
treeafc623183cb5f239afcb2050087611b992ee0b87
parent1b87725fef508089024ffaf3d7dd0818c1c9a417 (diff)
More prefixchar stuff.
WARNING: 005 numeric is broken in this commit. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5000 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/mode.h7
-rw-r--r--src/channels.cpp2
-rw-r--r--src/cmd_who.cpp6
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/mode.cpp24
-rw-r--r--src/modules/m_remove.cpp8
-rw-r--r--src/modules/m_spanningtree.cpp16
-rw-r--r--src/modules/m_spy.cpp2
-rw-r--r--src/users.cpp2
9 files changed, 43 insertions, 26 deletions
diff --git a/include/mode.h b/include/mode.h
index b63c7f3b2..198ae0369 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -444,6 +444,13 @@ class ModeParser : public classbase
*/
std::string ParaModeList();
+ static bool ModeParser::PrefixComparison(const prefixtype one, const prefixtype two);
+
+ /**
+ * This returns the PREFIX=(ohv)@%+ section of the 005 numeric.
+ */
+ std::string BuildPrefixes();
+
/** Used to parse the CHANMODES= parameter of a 005 numeric.
*/
bool InsertMode(std::string &output, const char* mode, unsigned short section);
diff --git a/src/channels.cpp b/src/channels.cpp
index 048b77a1f..d417ab763 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -835,7 +835,7 @@ void chanrec::UserList(userrec *user)
continue;
}
- size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", this->GetStatusChar(i->second), i->second->nick);
+ size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", this->GetPrefixChar(i->second), i->second->nick);
curlen += ptrlen;
ptr += ptrlen;
diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp
index 745e5db15..6f52ebb63 100644
--- a/src/cmd_who.cpp
+++ b/src/cmd_who.cpp
@@ -150,7 +150,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
wholine.append("*");
}
- wholine = wholine + ch->GetStatusChar(i->second) + " :0 " + i->second->fullname;
+ wholine = wholine + ch->GetPrefixChar(i->second) + " :0 " + i->second->fullname;
whoresults.push_back(wholine);
}
}
@@ -188,7 +188,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
wholine.append("*");
}
- wholine = wholine + ch->GetStatusChar(oper) + " :0 " + oper->fullname;
+ wholine = wholine + ch->GetPrefixChar(oper) + " :0 " + oper->fullname;
whoresults.push_back(wholine);
}
}
@@ -220,7 +220,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
wholine.append("*");
}
- wholine = wholine + ch->GetStatusChar(i->second) + " :0 " + i->second->fullname;
+ wholine = wholine + ch->GetPrefixChar(i->second) + " :0 " + i->second->fullname;
whoresults.push_back(wholine);
}
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 5b2d5aac2..4679c8acd 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -471,7 +471,7 @@ void InspIRCd::BuildISupport()
{
// the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
std::stringstream v;
- v << "WALLCHOPS WALLVOICES MODES=" << MAXMODES << " CHANTYPES=# PREFIX=(ohv)@%+ MAP MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 VBANLIST NICKLEN=" << NICKMAX-1;
+ v << "WALLCHOPS WALLVOICES MODES=" << MAXMODES << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 VBANLIST NICKLEN=" << NICKMAX-1;
v << " CASEMAPPING=rfc1459 STATUSMSG=@%+ CHARSET=ascii TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=" << Config->MaxTargets << " AWAYLEN=";
v << MAXAWAY << " CHANMODES=b,k,l,psmnti FNC NETWORK=" << Config->Network << " MAXPARA=32";
Config->data005 = v.str();
diff --git a/src/mode.cpp b/src/mode.cpp
index 790720c6b..301fbc872 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -642,6 +642,30 @@ std::string ModeParser::ParaModeList()
return modestr;
}
+bool ModeParser::PrefixComparison(const prefixtype one, const prefixtype two)
+{
+ return (one.second) < (two.second);
+}
+
+std::string ModeParser::BuildPrefixes()
+{
+ std::string mletters = "";
+ std::string mprefixes = "";
+ pfxcontainer pfx;
+
+ for (unsigned char mode = 'A'; mode <= 'z'; mode++)
+ {
+ unsigned char pos = (mode-65) | MASK_CHANNEL;
+
+ if ((modehandlers[pos]) && (modehandlers[pos]->GetPrefix()))
+ pfx.push_back(std::make_pair<char,unsigned int>(modehandlers[pos]->GetPrefix(), modehandlers[pos]->GetPrefixRank()));
+ }
+
+ sort(pfx.begin(), pfx.end(), ModeParser::PrefixComparison);
+
+ return "";
+}
+
bool ModeParser::AddModeWatcher(ModeWatcher* mw)
{
unsigned char mask = 0;
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 1ee4742a3..0d66f0202 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -126,8 +126,8 @@ class RemoveBase
}
else
{
- ServerInstance->Log(DEBUG, "Setting ulevel to %s", channel->GetStatusChar(user));
- ulevel = chartolevel(channel->GetStatusChar(user));
+ ServerInstance->Log(DEBUG, "Setting ulevel to %s", channel->GetPrefixChar(user));
+ ulevel = chartolevel(channel->GetPrefixChar(user));
}
/* Now it's the same idea, except for the target. If they're ulined make sure they get a higher level than the sender can */
@@ -148,8 +148,8 @@ class RemoveBase
}
else
{
- ServerInstance->Log(DEBUG, "Setting tlevel to %s", channel->GetStatusChar(target));
- tlevel = chartolevel(channel->GetStatusChar(target));
+ ServerInstance->Log(DEBUG, "Setting tlevel to %s", channel->GetPrefixChar(target));
+ tlevel = chartolevel(channel->GetPrefixChar(target));
}
hasnokicks = (ServerInstance->FindModule("m_nokicks.so") && channel->IsModeSet('Q'));
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index abd07d170..4f3645026 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1613,22 +1613,8 @@ class TreeSocket : public InspSocket
specific_voice.push_back(i->second);
}
- const char* n = "";
- if (x & UCMODE_OP)
- {
- n = "@";
- }
- else if (x & UCMODE_HOP)
- {
- n = "%";
- }
- else if (x & UCMODE_VOICE)
- {
- n = "+";
- }
-
// The first parameter gets a : before it
- size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s%s", !numusers ? ":" : "", n, i->second->nick);
+ size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s%s", !numusers ? ":" : "", c->GetPrefixChar(i->second), i->second->nick);
curlen += ptrlen;
ptr += ptrlen;
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index 55b3a650c..410d9b732 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -57,7 +57,7 @@ void spy_userlist(userrec *user,chanrec *c)
CUList *ulist= c->GetUsers();
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- strlcat(list,c->GetStatusChar(i->second),MAXBUF);
+ strlcat(list,c->GetPrefixChar(i->second),MAXBUF);
strlcat(list,i->second->nick,MAXBUF);
strlcat(list," ",MAXBUF);
if (strlen(list)>(480-NICKMAX))
diff --git a/src/users.cpp b/src/users.cpp
index 3b02e82b9..f761c56f9 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1674,7 +1674,7 @@ std::string userrec::ChannelList(userrec* source)
*/
if ((source == this) || (*source->oper && ServerInstance->Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET])) || (rec->channel->HasUser(source))))
{
- list.append(rec->channel->GetStatusChar(this)).append(rec->channel->name).append(" ");
+ list.append(rec->channel->GetPrefixChar(this)).append(rec->channel->name).append(" ");
}
}
}