diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-18 17:07:13 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-18 17:07:13 +0000 |
commit | a068c47d71e9a922b145b7552b3a64d638c92171 (patch) | |
tree | b78e21ea491683cd2238c49f02aced889f488260 /src | |
parent | 792d6d6725c7d80d223f5cccd9ee0c5b07229e9a (diff) |
Separate spy channels [jackmcbarn]
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11747 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_check.cpp | 7 | ||||
-rw-r--r-- | src/users.cpp | 11 | ||||
-rw-r--r-- | src/whois.cpp | 18 |
3 files changed, 27 insertions, 9 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index a84bd4dc6..cf07e3644 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -115,7 +115,12 @@ class CommandCheck : public Command else ServerInstance->DumpText(user, checkstr + " onip " + targuser->GetIPString()); - chliststr = targuser->ChannelList(targuser); + for (UCListIter i = targuser->chans.begin(); i != targuser->chans.end(); i++) + { + Channel* c = *i; + chliststr.append(c->GetPrefixChar(targuser)).append(c->name).append(" "); + } + std::stringstream dump(chliststr); ServerInstance->DumpText(user,checkstr + " onchans", dump); diff --git a/src/users.cpp b/src/users.cpp index b361205da..fd0c168d9 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1661,21 +1661,18 @@ void User::SendAll(const char* command, const char* text, ...) } -std::string User::ChannelList(User* source) +std::string User::ChannelList(User* source, bool spy) { std::string list; for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++) { Channel* c = *i; - /* If the target is the same as the sender, let them see all their channels. - * If the channel is NOT private/secret OR the user shares a common channel - * If the user is an oper, and the <options:operspywhois> option is set. + /* If the target is the sender, neither +p nor +s is set, or + * the channel contains the user, it is not a spy channel */ - if ((source == this) || (IS_OPER(source) && ServerInstance->Config->OperSpyWhois) || (((!c->IsModeSet('p')) && (!c->IsModeSet('s'))) || (c->HasUser(source)))) - { + if (spy != (source == this || !(c->IsModeSet('p') || c->IsModeSet('s')) || c->HasUser(source))) list.append(c->GetPrefixChar(this)).append(c->name).append(" "); - } } return list; diff --git a/src/whois.cpp b/src/whois.cpp index 341c8389f..b967fac25 100644 --- a/src/whois.cpp +++ b/src/whois.cpp @@ -21,7 +21,7 @@ void InspIRCd::DoWhois(User* user, User* dest,unsigned long signon, unsigned lon this->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->host.c_str(), dest->GetIPString()); } - std::string cl = dest->ChannelList(user); + std::string cl = dest->ChannelList(user, false); if (cl.length()) { @@ -34,6 +34,22 @@ void InspIRCd::DoWhois(User* user, User* dest,unsigned long signon, unsigned lon this->SendWhoisLine(user, dest, 319, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), cl.c_str()); } } + if (IS_OPER(user) && ServerInstance->Config->OperSpyWhois) + { + std::string scl = dest->ChannelList(user, true); + if (scl.length()) + { + this->SendWhoisLine(user, dest, 336, "%s %s :is on private/secret channels:",user->nick.c_str(), dest->nick.c_str()); + if (scl.length() > 400) + { + user->SplitChanList(dest,scl); + } + else + { + this->SendWhoisLine(user, dest, 319, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), scl.c_str()); + } + } + } if (user != dest && *this->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex")) { this->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), this->Config->HideWhoisServer, this->Config->Network); |