summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@anope.org>2011-08-11 22:21:40 +0200
committerDukePyrolator <DukePyrolator@anope.org>2011-08-11 22:21:40 +0200
commitc2780e1de47b4aead8ca5e2c7a7675ea987a9bb4 (patch)
tree30a58f896a582cbf0278c486a8f1b200ef35bb32
parent4e1f54ff9c9da71b657e024e67fc0966e7a82825 (diff)
Added a separate field for last seen realhost to ns_info, shown to services admins only
-rw-r--r--data/tables.sql1
-rw-r--r--docs/TODO3
-rw-r--r--include/account.h1
-rw-r--r--modules/commands/ns_info.cpp5
-rw-r--r--modules/database/db_mysql.cpp4
-rw-r--r--modules/database/db_mysql_live.cpp1
-rw-r--r--modules/database/db_plain.cpp4
-rw-r--r--src/users.cpp4
8 files changed, 21 insertions, 2 deletions
diff --git a/data/tables.sql b/data/tables.sql
index 888edef35..69e694a32 100644
--- a/data/tables.sql
+++ b/data/tables.sql
@@ -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,
diff --git a/docs/TODO b/docs/TODO
index 4914ffbc0..49a7dbacb 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -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
diff --git a/include/account.h b/include/account.h
index 2a812529b..fc7b3e428 100644
--- a/include/account.h
+++ b/include/account.h
@@ -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 */
diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp
index 5a6d9dc0c..15dc22546 100644
--- a/modules/commands/ns_info.cpp
+++ b/modules/commands/ns_info.cpp
@@ -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());
diff --git a/modules/database/db_mysql.cpp b/modules/database/db_mysql.cpp
index 6d138c0b9..12972aad5 100644
--- a/modules/database/db_mysql.cpp
+++ b/modules/database/db_mysql.cpp
@@ -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()));
diff --git a/modules/database/db_mysql_live.cpp b/modules/database/db_mysql_live.cpp
index ecfdc70d1..07b9b037c 100644
--- a/modules/database/db_mysql_live.cpp
+++ b/modules/database/db_mysql_live.cpp
@@ -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();
diff --git a/modules/database/db_plain.cpp b/modules/database/db_plain.cpp
index 75b327223..c113688ee 100644
--- a/modules/database/db_plain.cpp
+++ b/modules/database/db_plain.cpp
@@ -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())
diff --git a/src/users.cpp b/src/users.cpp
index 50e84dce3..d1b9945b9 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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;
}
}