summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-23 21:34:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-23 21:34:04 +0000
commitea3ba4bfd1b072b4f14fb588286eedd0ea8c1d22 (patch)
tree6f31e715d182c4045f61fd69658c5ca092ae264a /src
parent9f9e49509ea6d4c4ab0b70e15356d50e1376fdba (diff)
Multi-prefix FJOIN, and allowing module-defined prefixes across the network
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5002 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp20
-rw-r--r--src/mode.cpp14
-rw-r--r--src/modules/m_spanningtree.cpp60
3 files changed, 45 insertions, 49 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index d417ab763..e7564c3ea 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -906,6 +906,26 @@ const char* chanrec::GetPrefixChar(userrec *user)
return px;
}
+const char* chanrec::GetAllPrefixChars(userrec* user)
+{
+ static char prefix[MAXBUF];
+ int ctr = 0;
+ *prefix = 0;
+
+ prefixlist::iterator n = prefixes.find(user);
+ if (n != prefixes.end())
+ {
+ for (std::vector<prefixtype>::iterator x = n->second.begin(); x != n->second.end(); x++)
+ {
+ prefix[ctr++] = x->first;
+ }
+ }
+
+ prefix[ctr] = 0;
+
+ return prefix;
+}
+
unsigned int chanrec::GetPrefixValue(userrec* user)
{
unsigned int mx = 0;
diff --git a/src/mode.cpp b/src/mode.cpp
index 3a0937d91..281fb6ac8 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -642,6 +642,20 @@ std::string ModeParser::ParaModeList()
return modestr;
}
+ModeHandler* ModeParser::FindPrefix(unsigned const char pfxletter)
+{
+ for (unsigned char mode = 'A'; mode <= 'z'; mode++)
+ {
+ unsigned char pos = (mode-65) | MASK_CHANNEL;
+
+ if ((modehandlers[pos]) && (modehandlers[pos]->GetPrefix() == pfxletter))
+ {
+ return modehandlers[pos];
+ }
+ }
+ return NULL;
+}
+
bool ModeParser::PrefixComparison(const prefixtype one, const prefixtype two)
{
return one.second > two.second;
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 4f3645026..1485c709a 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1392,24 +1392,17 @@ class TreeSocket : public InspSocket
* (is this even possible?) */
if (usr && *usr)
{
- char permissions = *usr;
- switch (permissions)
+ char* permissions = usr;
+ while (*permissions != ',')
{
- case '@':
- usr++;
- mode_users[modectr++] = usr;
- strlcat(modestring,"o",MAXBUF);
- break;
- case '%':
- usr++;
- mode_users[modectr++] = usr;
- strlcat(modestring,"h",MAXBUF);
- break;
- case '+':
- usr++;
+ ModeHandler* mh = ServerInstance->Modes->FindPrefix(*permissions);
+ if (mh)
+ {
mode_users[modectr++] = usr;
- strlcat(modestring,"v",MAXBUF);
- break;
+ charlcat(modestring,mh->GetModeChar(),MAXBUF);
+ }
+ usr++;
+ permissions++;
}
who = this->Instance->FindNick(usr);
if (who)
@@ -1603,18 +1596,8 @@ class TreeSocket : public InspSocket
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- int x = c->GetStatusFlags(i->second);
- if ((x & UCMODE_HOP) && (x & UCMODE_OP))
- {
- specific_halfop.push_back(i->second);
- }
- if (((x & UCMODE_HOP) || (x & UCMODE_OP)) && (x & UCMODE_VOICE))
- {
- specific_voice.push_back(i->second);
- }
-
// The first parameter gets a : before it
- size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s%s", !numusers ? ":" : "", c->GetPrefixChar(i->second), i->second->nick);
+ size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", c->GetAllPrefixChars(i->second), i->second->nick);
curlen += ptrlen;
ptr += ptrlen;
@@ -1628,32 +1611,11 @@ class TreeSocket : public InspSocket
ptr = list + dlen;
ptrlen = 0;
numusers = 0;
- for (unsigned int y = 0; y < specific_voice.size(); y++)
- {
- modes.append("v");
- params.append(specific_voice[y]->nick).append(" ");
- }
- for (unsigned int y = 0; y < specific_halfop.size(); y++)
- {
- modes.append("h");
- params.append(specific_halfop[y]->nick).append(" ");
- }
}
}
+
if (numusers)
- {
this->WriteLine(list);
- for (unsigned int y = 0; y < specific_voice.size(); y++)
- {
- modes.append("v");
- params.append(specific_voice[y]->nick).append(" ");
- }
- for (unsigned int y = 0; y < specific_halfop.size(); y++)
- {
- modes.append("h");
- params.append(specific_halfop[y]->nick).append(" ");
- }
- }
for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++)
{