1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 09:36:38 +02:00

Added a separate field for last seen realhost to ns_info, shown to services admins only

This commit is contained in:
DukePyrolator
2011-08-11 22:21:40 +02:00
parent 4e1f54ff9c
commit c2780e1de4
8 changed files with 21 additions and 2 deletions
+1
View File
@@ -250,6 +250,7 @@ CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
`last_quit` text NOT NULL,
`last_realname` text NOT NULL,
`last_usermask` text NOT NULL,
`last_realhost` text NOT NULL,
`time_registered` int(10) unsigned NOT NULL DEFAULT '0',
`last_seen` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
+2 -1
View File
@@ -10,15 +10,16 @@ Legend:
[x] Fix the modules language system to work without needing its own functions..
[x] Rewrite commands system
[x] Rewrite access system
[x] NS INFO: separate field for last seen realhost, shown to SRA only
[ ] Customize email messages
[ ] Configurable bot usermodes
Future
------
[ ] NS IDENTIFY changes
[?] Last failed identify? Maybe more useful for sopers only, so users don't get unnecessarily worried
[?] Last successful login time/ip? perhaps both of these should be a new nick setting
[ ] NS INFO: seperate field for last seen realhost, shown to SRA only
[ ] NS SUSPEND: show suspender and reason, probably to sopers only (see CS SUSPEND)
[ ] Allow channel founders to change the fantasy trigger for their channel.
[+] CIDR Akills, session exceptions, etc
+1
View File
@@ -112,6 +112,7 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_EN
Anope::string last_quit; /* Last quit message */
Anope::string last_realname; /* Last realname */
Anope::string last_usermask; /* Last usermask */
Anope::string last_realhost; /* Last uncloaked usermask, requires nickserv/auspex to see */
time_t time_registered; /* When the nick was registered */
time_t last_seen; /* When it was seen online for the last time */
NickCore *nc; /* I'm an alias of this */
+5
View File
@@ -73,11 +73,16 @@ class CommandNSInfo : public Command
source.Reply(_(" Is online from: %s"), na->last_usermask.c_str());
else
source.Reply(_("%s is currently online."), na->nick.c_str());
if (has_auspex && !na->last_realhost.empty())
source.Reply(_(" Is online from: %s"), na->last_realhost.c_str());
}
else
{
if (show_hidden || !na->nc->HasFlag(NI_HIDE_MASK))
source.Reply(_("Last seen address: %s"), na->last_usermask.c_str());
if (has_auspex && !na->last_realhost.empty())
source.Reply(_("Last seen address: %s"), na->last_realhost.c_str());
}
source.Reply(_(" Time registered: %s"), do_strftime(na->time_registered).c_str());
+3 -1
View File
@@ -244,6 +244,7 @@ class DBMySQL : public Module
na->last_quit = r.Get(i, "last_quit");
na->last_realname = r.Get(i, "last_realname");
na->last_usermask = r.Get(i, "last_usermask");
na->last_realhost = r.Get(i, "last_realhost");
na->time_registered = r.Get(i, "time_registered").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "time_registered")) : Anope::CurTime;
na->last_seen = r.Get(i, "last_seen").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "last_seen")) : Anope::CurTime;
@@ -943,11 +944,12 @@ class DBMySQL : public Module
void InsertAlias(NickAlias *na)
{
SQLQuery query("INSERT INTO `anope_ns_alias` (nick, last_quit, last_realname, last_usermask, time_registered, last_seen, flags, display) VALUES(@nick, @last_quit, @last_realname, @last_usermask, @time_registered, @last_seen, @flags, @display) ON DUPLICATE KEY UPDATE last_quit=VALUES(last_quit), last_realname=VALUES(last_realname), last_usermask=VALUES(last_usermask), time_registered=VALUES(time_registered), last_seen=VALUES(last_seen), flags=VALUES(flags), display=VALUES(display)");
SQLQuery query("INSERT INTO `anope_ns_alias` (nick, last_quit, last_realname, last_usermask, last_realhost, time_registered, last_seen, flags, display) VALUES(@nick, @last_quit, @last_realname, @last_usermask, @last_realhost, @time_registered, @last_seen, @flags, @display) ON DUPLICATE KEY UPDATE last_quit=VALUES(last_quit), last_realname=VALUES(last_realname), last_usermask=VALUES(last_usermask), last_realhost=VALUES(last_realhost), time_registered=VALUES(time_registered), last_seen=VALUES(last_seen), flags=VALUES(flags), display=VALUES(display)");
query.setValue("nick", na->nick);
query.setValue("last_quit", na->last_quit);
query.setValue("last_realname", na->last_realname);
query.setValue("last_usermask", na->last_usermask);
query.setValue("last_realhost", na->last_realhost);
query.setValue("time_registered", na->time_registered);
query.setValue("last_seen", na->last_seen);
query.setValue("flags", ToString(na->ToString()));
+1
View File
@@ -88,6 +88,7 @@ static void NickInfoUpdate(const SQLResult &res)
na->last_quit = res.Get(0, "last_quit");
na->last_realname = res.Get(0, "last_realname");
na->last_usermask = res.Get(0, "last_usermask");
na->last_realhost = res.Get(0, "last_realhost");
na->time_registered = convertTo<time_t>(res.Get(0, "time_registered"));
na->last_seen = convertTo<time_t>(res.Get(0, "last_seen"));
na->ClearFlags();
+4
View File
@@ -495,6 +495,8 @@ class DBPlain : public Module
{
if (key.equals_ci("LAST_USERMASK"))
na->last_usermask = params[0];
else if (key.equals_ci("LAST_REALHOST"))
na->last_realhost = params[0];
else if (key.equals_ci("LAST_REALNAME"))
na->last_realname = params[0];
else if (key.equals_ci("LAST_QUIT"))
@@ -751,6 +753,8 @@ class DBPlain : public Module
db_buffer << "NA " << na->nc->display << " " << na->nick << " " << na->time_registered << " " << na->last_seen << endl;
if (!na->last_usermask.empty())
db_buffer << "MD LAST_USERMASK " << na->last_usermask << endl;
if (!na->last_realhost.empty())
db_buffer << "MD LAST_REALHOST " << na->last_realhost << endl;
if (!na->last_realname.empty())
db_buffer << "MD LAST_REALNAME :" << na->last_realname << endl;
if (!na->last_quit.empty())
+4
View File
@@ -352,7 +352,9 @@ void User::Identify(NickAlias *na)
if (this->nick.equals_ci(na->nick))
{
Anope::string last_usermask = this->GetIdent() + "@" + this->GetDisplayedHost();
Anope::string last_realhost = this->GetIdent() + "@" + this->host;
na->last_usermask = last_usermask;
na->last_realhost = last_realhost;
na->last_realname = this->realname;
na->last_seen = Anope::CurTime;
}
@@ -501,7 +503,9 @@ void User::UpdateHost()
if (na && (this->IsIdentified(true) || this->IsRecognized(true)))
{
Anope::string last_usermask = this->GetIdent() + "@" + this->GetDisplayedHost();
Anope::string last_realhost = this->GetIdent() + "@" + this->host;
na->last_usermask = last_usermask;
na->last_realhost = last_realhost;
}
}