Commit 20fdaa50 authored by Romain Bignon's avatar Romain Bignon

implement '/STATS o' command to display opers accounts (refs #232)

parent 61387a6d
......@@ -74,12 +74,16 @@ irc {
# oper {
# login = romain
# password = pupuce
# email = romain@minbif.im
# }
#
# oper {
# login = pankkake
# password = littledick
# email = pankkake@blowjob.org
# }
#
# Note that the email address is displayed in /stats o.
}
# Authentication, Authorization and Accounting
......
......@@ -70,6 +70,7 @@ Minbif::Minbif()
sub = section->AddSection("oper", "Define an IRC operator", MyConfig::MULTIPLE);
sub->AddItem(new ConfigItem_string("login", "Nickname of IRC operator"), true);
sub->AddItem(new ConfigItem_string("password", "IRC operator password"));
sub->AddItem(new ConfigItem_string("email", "IRC operator email address", "*@*"));
section = conf.AddSection("aaa", "Authentication, Authorization and Accounting", MyConfig::OPTIONAL);
section->AddItem(new ConfigItem_bool("use_local", "Use local database to authenticate users", "true"));
......
......@@ -967,6 +967,22 @@ void IRC::m_stats(Message message)
.addArg(t2s(commands[i].count))
.addArg("0"));
break;
case 'o':
{
vector<ConfigSection*> opers = conf.GetSection("irc")->GetSectionClones("oper");
for(vector<ConfigSection*>::iterator it = opers.begin(); it != opers.end(); ++it)
{
ConfigSection* oper = *it;
user->send(Message(RPL_STATSOLINE).setSender(this)
.setReceiver(user)
.addArg("O")
.addArg(oper->GetItem("email")->String())
.addArg("*")
.addArg(oper->GetItem("login")->String()));
}
break;
}
case 'p':
{
map<string, im::Protocol> m = im->getProtocolsList();
......@@ -993,6 +1009,7 @@ void IRC::m_stats(Message message)
notice(user, "a (aways) - List all away messages availables");
notice(user, "c (chat params) - List all chat parameters for a specific account");
notice(user, "m (commands) - List all IRC commands");
notice(user, "o (opers) - List all opers accounts");
notice(user, "p (protocols) - List all protocols");
notice(user, "u (uptime) - Display the server uptime");
break;
......
......@@ -30,6 +30,7 @@
#define RPL_ENDOFSTATS "219"
#define RPL_UMODEIS "221"
#define RPL_STATSUPTIME "242"
#define RPL_STATSOLINE "243"
#define RPL_LUSERCLIENT "251"
#define RPL_LUSEROP "252"
#define RPL_LUSERUNKNOWN "253"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment