X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_check.cpp;h=cd336c865af2e6bfc9e5223273eb275433b909dd;hb=c9ea418dd7f913ba1c2fbae49a82cf39d22e282f;hp=39f0d190a61fa3f9cda8fd974832bcdc1b14a09f;hpb=4690bbdee8b5a91938e3e2ac86f606951cccf2e8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 39f0d190a..cd336c865 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -1,10 +1,14 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2013-2016 Attila Molnar + * Copyright (C) 2013, 2017-2020 Sadie Powell + * Copyright (C) 2012, 2019 Robby + * Copyright (C) 2010 Craig Edwards * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2007 Dennis Friis - * Copyright (C) 2006-2007 Robin Burchell - * Copyright (C) 2006 Craig Edwards + * Copyright (C) 2006-2008 Robin Burchell * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -67,16 +71,21 @@ class CheckContext User* GetUser() const { return user; } - void DumpListMode(const ListModeBase::ModeList* list) + void DumpListMode(ListModeBase* mode, Channel* chan) { + const ListModeBase::ModeList* list = mode->GetList(chan); if (!list) return; - CheckContext::List modelist(*this, "modelist"); for (ListModeBase::ModeList::const_iterator i = list->begin(); i != list->end(); ++i) - modelist.Add(i->mask); - - modelist.Flush(); + { + CheckContext::List listmode(*this, "listmode"); + listmode.Add(ConvToStr(mode->GetModeChar())); + listmode.Add(i->mask); + listmode.Add(i->setter); + listmode.Add(FormatTime(i->time)); + listmode.Flush(); + } } void DumpExt(Extensible* ext) @@ -85,7 +94,7 @@ class CheckContext for(Extensible::ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); ++i) { ExtensionItem* item = i->first; - std::string value = item->serialize(FORMAT_USER, ext, i->second); + std::string value = item->ToHuman(ext, i->second); if (!value.empty()) Write("meta:" + item->name, value); else if (!item->name.empty()) @@ -141,7 +150,8 @@ class CommandCheck : public Command : Command(parent,"CHECK", 1) , snomaskmode(parent, "snomask") { - flags_needed = 'o'; syntax = "||| "; + flags_needed = 'o'; + syntax = "||| []"; } CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE @@ -235,7 +245,7 @@ class CommandCheck : public Command else if (targchan) { /* /check on a channel */ - context.Write("timestamp", targchan->age); + context.Write("createdat", targchan->age); if (!targchan->topic.empty()) { @@ -256,17 +266,17 @@ class CommandCheck : public Command for (Channel::MemberMap::const_iterator i = ulist.begin(); i != ulist.end(); ++i) { /* - * Unlike Asuka, I define a clone as coming from the same host. --w00t - */ + * Unlike Asuka, I define a clone as coming from the same host. --w00t + */ const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first); - context.Write("member", InspIRCd::Format("%-3u %s%s (%s@%s) %s ", clonecount.global, - i->second->GetAllPrefixChars().c_str(), i->first->nick.c_str(), - i->first->ident.c_str(), i->first->GetDisplayedHost().c_str(), i->first->GetRealName().c_str())); + context.Write("member", InspIRCd::Format("%u %s%s (%s)", clonecount.global, + i->second->GetAllPrefixChars().c_str(), i->first->GetFullHost().c_str(), + i->first->GetRealName().c_str())); } const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes(); for (ModeParser::ListModeList::const_iterator i = listmodes.begin(); i != listmodes.end(); ++i) - context.DumpListMode((*i)->GetList(targchan)); + context.DumpListMode(*i, targchan); context.DumpExt(targchan); } @@ -317,7 +327,7 @@ class ModuleCheck : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("CHECK command, view user, channel, IP address or hostname information", VF_VENDOR|VF_OPTCOMMON); + return Version("Adds the /CHECK command which allows server operators to look up details about a channel, user, IP address, or hostname.", VF_VENDOR|VF_OPTCOMMON); } };