summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-10-18 16:52:53 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-10-18 16:52:53 +0000
commit3c055715a27fead89fab680e446f166e2da7a68a (patch)
tree8db973f43635b0b6d19dfc4d609c2132939a9eeb /src/modules
parentdd54c42f5f27dcee1cad7fe8a606be5cf8442c7c (diff)
Implement channels/auspex priv for /names and /list.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10666 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_safelist.cpp40
-rw-r--r--src/modules/m_spy.cpp4
2 files changed, 27 insertions, 17 deletions
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index 1f73a7bf2..b75390a42 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -170,7 +170,7 @@ class ModuleSafeList : public Module
do
{
chan = ServerInstance->GetChannelIndex(ld->list_position);
- bool has_user = (chan && chan->HasUser(user));
+ bool is_special = (chan && (chan->HasUser(user) || user->HasPrivPermission("channels/auspex")));
long users = chan ? chan->GetUserCounter() : 0;
bool too_few = (ld->minusers && (users <= ld->minusers));
@@ -182,37 +182,47 @@ class ModuleSafeList : public Module
continue;
}
- if ((chan) && (chan->modes[CM_PRIVATE]) && (!IS_OPER(user)))
+ if (chan)
{
bool display = (InspIRCd::Match(chan->name, ld->glob) || (!chan->topic.empty() && InspIRCd::Match(chan->topic, ld->glob)));
- if ((users) && (display))
+
+ if (!users || !display)
+ {
+ ld->list_position++;
+ continue;
+ }
+
+ /* +s, not in chan / not got channels/auspex */
+ if (chan->IsModeSet('s') && !is_special)
{
+ ld->list_position++;
+ continue;
+ }
+
+ if (chan->IsModeSet('p') && !is_special)
+ {
+ /* Channel is +p and user is outside/not privileged */
int counter = snprintf(buffer, MAXBUF, "322 %s * %ld :", user->nick.c_str(), users);
amount_sent += counter + ServerNameSize;
user->WriteServ(std::string(buffer));
}
- }
- else if ((chan) && ((((!(chan->IsModeSet('p'))) && (!(chan->IsModeSet('s'))))) || (has_user) || IS_OPER(user)))
- {
- bool display = (InspIRCd::Match(chan->name, ld->glob) || (!chan->topic.empty() && InspIRCd::Match(chan->topic, ld->glob)));
- if ((users) && (display))
+ else
{
- int counter = snprintf(buffer, MAXBUF, "322 %s %s %ld :[+%s] %s", user->nick.c_str(), chan->name.c_str(), users, chan->ChanModes(has_user || IS_OPER(user)), chan->topic.c_str());
+ /* User is in the channel/privileged, channel is not +s */
+ int counter = snprintf(buffer, MAXBUF, "322 %s %s %ld :[+%s] %s", user->nick.c_str(), chan->name.c_str(), users, chan->ChanModes(is_special), chan->topic.c_str());
amount_sent += counter + ServerNameSize;
user->WriteServ(std::string(buffer));
}
}
else
{
- if (!chan)
+ if (!ld->list_ended)
{
- if (!ld->list_ended)
- {
- ld->list_ended = true;
- user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str());
- }
+ ld->list_ended = true;
+ user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str());
}
}
+
ld->list_position++;
}
while ((chan != NULL) && (amount_sent < (user->MyClass->GetSendqMax() / 4)));
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index 54d2983b0..75fe2b367 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -25,8 +25,8 @@ class ModuleSpy : public Module
virtual int OnUserList(User* user, Channel* Ptr, CUList* &nameslist)
{
- /* User is an oper and is NOT on the channel */
- if (IS_OPER(user) && !Ptr->HasUser(user))
+ /* User has priv and is NOT on the channel */
+ if (user->HasPrivPermission("channels/auspex") && !Ptr->HasUser(user))
return -1;
return 0;