summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-02-14 15:13:27 -0500
committerAdam <Adam@anope.org>2012-02-14 15:13:27 -0500
commita9772cde21407c89abd161d51aff45267f87b1fb (patch)
tree9e57ba6c121d3843888917d968dd4f5d030b57cf /modules/commands
parent086790d6331357022f4da17c76b26b9fc6e2ad90 (diff)
Clean up and reorganize our header files
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/hs_del.cpp4
-rw-r--r--modules/commands/hs_group.cpp12
-rw-r--r--modules/commands/hs_list.cpp24
-rw-r--r--modules/commands/hs_off.cpp2
-rw-r--r--modules/commands/hs_on.cpp18
-rw-r--r--modules/commands/hs_request.cpp2
-rw-r--r--modules/commands/hs_set.cpp8
-rw-r--r--modules/commands/ms_ignore.cpp1
-rw-r--r--modules/commands/ns_info.cpp8
-rw-r--r--modules/commands/os_forbid.cpp2
-rw-r--r--modules/commands/os_list.cpp2
-rw-r--r--modules/commands/os_session.cpp2
-rw-r--r--modules/commands/os_session.h8
13 files changed, 50 insertions, 43 deletions
diff --git a/modules/commands/hs_del.cpp b/modules/commands/hs_del.cpp
index b8362cdda..44b2bf5e6 100644
--- a/modules/commands/hs_del.cpp
+++ b/modules/commands/hs_del.cpp
@@ -31,7 +31,7 @@ class CommandHSDel : public Command
{
Log(LOG_ADMIN, u, this) << "for user " << na->nick;
FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na));
- na->hostinfo.RemoveVhost();
+ na->RemoveVhost();
source.Reply(_("Vhost for \002%s\002 removed."), nick.c_str());
}
else
@@ -69,7 +69,7 @@ class CommandHSDelAll : public Command
for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it)
{
na = *it;
- na->hostinfo.RemoveVhost();
+ na->RemoveVhost();
}
Log(LOG_ADMIN, u, this) << "for all nicks in group " << nc->display;
source.Reply(_("vhosts for group \002%s\002 have been removed."), nc->display.c_str());
diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp
index 53efd3094..78c863a51 100644
--- a/modules/commands/hs_group.cpp
+++ b/modules/commands/hs_group.cpp
@@ -17,13 +17,13 @@ class CommandHSGroup : public Command
{
void Sync(NickAlias *na)
{
- if (!na || !na->hostinfo.HasVhost())
+ if (!na || !na->HasVhost())
return;
for (std::list<NickAlias *>::iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end; ++it)
{
NickAlias *nick = *it;
- nick->hostinfo.SetVhost(na->hostinfo.GetIdent(), na->hostinfo.GetHost(), na->hostinfo.GetCreator());
+ nick->SetVhost(na->GetVhostIdent(), na->GetVhostHost(), na->GetVhostCreator());
}
}
@@ -38,13 +38,13 @@ class CommandHSGroup : public Command
{
User *u = source.u;
NickAlias *na = findnick(u->nick);
- if (na && u->Account() == na->nc && na->hostinfo.HasVhost())
+ if (na && u->Account() == na->nc && na->HasVhost())
{
this->Sync(na);
- if (!na->hostinfo.GetIdent().empty())
- source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002@\002%s\002"), u->Account()->display.c_str(), na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str());
+ if (!na->GetVhostIdent().empty())
+ source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002@\002%s\002"), u->Account()->display.c_str(), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str());
else
- source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002"), u->Account()->display.c_str(), na->hostinfo.GetHost().c_str());
+ source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002"), u->Account()->display.c_str(), na->GetVhostHost().c_str());
}
else
source.Reply(HOST_NOT_ASSIGNED);
diff --git a/modules/commands/hs_list.cpp b/modules/commands/hs_list.cpp
index 54295f52f..acba0528f 100644
--- a/modules/commands/hs_list.cpp
+++ b/modules/commands/hs_list.cpp
@@ -63,24 +63,24 @@ class CommandHSList : public Command
{
NickAlias *na = it->second;
- if (!na->hostinfo.HasVhost())
+ if (!na->HasVhost())
continue;
if (!key.empty() && key[0] != '#')
{
- if ((Anope::Match(na->nick, key) || Anope::Match(na->hostinfo.GetHost(), key)) && display_counter < Config->NSListMax)
+ if ((Anope::Match(na->nick, key) || Anope::Match(na->GetVhostHost(), key)) && display_counter < Config->NSListMax)
{
++display_counter;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(display_counter);
entry["Nick"] = na->nick;
- if (!na->hostinfo.GetIdent().empty())
- entry["Vhost"] = na->hostinfo.GetIdent() + "@" + na->hostinfo.GetHost();
+ if (!na->GetVhostIdent().empty())
+ entry["Vhost"] = na->GetVhostIdent() + "@" + na->GetVhostHost();
else
- entry["Vhost"] = na->hostinfo.GetHost();
- entry["Creator"] = na->hostinfo.GetCreator();
- entry["Created"] = do_strftime(na->hostinfo.GetTime());
+ entry["Vhost"] = na->GetVhostHost();
+ entry["Creator"] = na->GetVhostCreator();
+ entry["Created"] = do_strftime(na->GetVhostCreated());
list.addEntry(entry);
}
}
@@ -96,12 +96,12 @@ class CommandHSList : public Command
ListFormatter::ListEntry entry;
entry["Number"] = stringify(display_counter);
entry["Nick"] = na->nick;
- if (!na->hostinfo.GetIdent().empty())
- entry["Vhost"] = na->hostinfo.GetIdent() + "@" + na->hostinfo.GetHost();
+ if (!na->GetVhostIdent().empty())
+ entry["Vhost"] = na->GetVhostIdent() + "@" + na->GetVhostHost();
else
- entry["Vhost"] = na->hostinfo.GetHost();
- entry["Creator"] = na->hostinfo.GetCreator();
- entry["Created"] = do_strftime(na->hostinfo.GetTime());
+ entry["Vhost"] = na->GetVhostHost();
+ entry["Creator"] = na->GetVhostCreator();
+ entry["Created"] = do_strftime(na->GetVhostCreated());
list.addEntry(entry);
}
}
diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp
index 46a83a4e5..45a8befd3 100644
--- a/modules/commands/hs_off.cpp
+++ b/modules/commands/hs_off.cpp
@@ -27,7 +27,7 @@ class CommandHSOff : public Command
User *u = source.u;
NickAlias *na = findnick(u->nick);
- if (!na || !na->hostinfo.HasVhost())
+ if (!na || !na->HasVhost())
source.Reply(HOST_NOT_ASSIGNED);
else
{
diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp
index 788808e7c..2c7d12f41 100644
--- a/modules/commands/hs_on.cpp
+++ b/modules/commands/hs_on.cpp
@@ -26,20 +26,20 @@ class CommandHSOn : public Command
{
User *u = source.u;
NickAlias *na = findnick(u->nick);
- if (na && u->Account() == na->nc && na->hostinfo.HasVhost())
+ if (na && u->Account() == na->nc && na->HasVhost())
{
- if (!na->hostinfo.GetIdent().empty())
- source.Reply(_("Your vhost of \002%s\002@\002%s\002 is now activated."), na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str());
+ if (!na->GetVhostIdent().empty())
+ source.Reply(_("Your vhost of \002%s\002@\002%s\002 is now activated."), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str());
else
- source.Reply(_("Your vhost of \002%s\002 is now activated."), na->hostinfo.GetHost().c_str());
- Log(LOG_COMMAND, u, this) << "to enable their vhost of " << (!na->hostinfo.GetIdent().empty() ? na->hostinfo.GetIdent() + "@" : "") << na->hostinfo.GetHost();
- ircdproto->SendVhost(u, na->hostinfo.GetIdent(), na->hostinfo.GetHost());
+ source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str());
+ Log(LOG_COMMAND, u, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost();
+ ircdproto->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost());
if (ircd->vhost)
- u->vhost = na->hostinfo.GetHost();
+ u->vhost = na->GetVhostHost();
if (ircd->vident)
{
- if (!na->hostinfo.GetIdent().empty())
- u->SetVIdent(na->hostinfo.GetIdent());
+ if (!na->GetVhostIdent().empty())
+ u->SetVIdent(na->GetVhostIdent());
}
u->UpdateHost();
}
diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp
index 634dec06c..d5f63d175 100644
--- a/modules/commands/hs_request.cpp
+++ b/modules/commands/hs_request.cpp
@@ -192,7 +192,7 @@ class CommandHSActivate : public Command
HostRequest *req = na ? na->GetExt<HostRequest *>("hs_request") : NULL;
if (req)
{
- na->hostinfo.SetVhost(req->ident, req->host, u->nick, req->time);
+ na->SetVhost(req->ident, req->host, u->nick, req->time);
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (HSRequestMemoUser && memoserv)
diff --git a/modules/commands/hs_set.cpp b/modules/commands/hs_set.cpp
index e305c3b33..d648952f7 100644
--- a/modules/commands/hs_set.cpp
+++ b/modules/commands/hs_set.cpp
@@ -82,7 +82,7 @@ class CommandHSSet : public Command
Log(LOG_ADMIN, u, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
- na->hostinfo.SetVhost(user, host, u->nick);
+ na->SetVhost(user, host, u->nick);
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (!user.empty())
source.Reply(_("VHost for \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str());
@@ -106,13 +106,13 @@ class CommandHSSetAll : public Command
{
void Sync(NickAlias *na)
{
- if (!na || !na->hostinfo.HasVhost())
+ if (!na || !na->HasVhost())
return;
for (std::list<NickAlias *>::iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end; ++it)
{
NickAlias *nick = *it;
- nick->hostinfo.SetVhost(na->hostinfo.GetIdent(), na->hostinfo.GetHost(), na->hostinfo.GetCreator());
+ nick->SetVhost(na->GetVhostIdent(), na->GetVhostHost(), na->GetVhostCreator());
}
}
@@ -183,7 +183,7 @@ class CommandHSSetAll : public Command
Log(LOG_ADMIN, u, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
- na->hostinfo.SetVhost(user, host, u->nick);
+ na->SetVhost(user, host, u->nick);
this->Sync(na);
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (!user.empty())
diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp
index 2acbcb91f..a58cb5248 100644
--- a/modules/commands/ms_ignore.cpp
+++ b/modules/commands/ms_ignore.cpp
@@ -11,6 +11,7 @@
/*************************************************************************/
+
#include "module.h"
#include "memoserv.h"
diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp
index 065762f8b..514757037 100644
--- a/modules/commands/ns_info.cpp
+++ b/modules/commands/ns_info.cpp
@@ -101,12 +101,12 @@ class CommandNSInfo : public Command
if (show_hidden)
{
- if (na->hostinfo.HasVhost())
+ if (na->HasVhost())
{
- if (ircd->vident && !na->hostinfo.GetIdent().empty())
- info[_("VHost")] = na->hostinfo.GetIdent() + "@" + na->hostinfo.GetHost();
+ if (ircd->vident && !na->GetVhostIdent().empty())
+ info[_("VHost")] = na->GetVhostIdent() + "@" + na->GetVhostHost();
else
- info[_("VHost")] = na->hostinfo.GetHost();
+ info[_("VHost")] = na->GetVhostHost();
}
if (!na->nc->greet.empty())
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index 7d20c5539..b5b184740 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -277,7 +277,7 @@ class OSForbid : public Module
if (!c->HasFlag(CH_INHABIT))
{
/* Join ChanServ and set a timer for this channel to part ChanServ later */
- new ChanServTimer(c);
+ c->Hold();
/* Set +si to prevent rejoin */
c->SetMode(NULL, CMODE_NOEXTERNAL);
diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp
index 2e7573674..26d11c047 100644
--- a/modules/commands/os_list.cpp
+++ b/modules/commands/os_list.cpp
@@ -157,7 +157,7 @@ class CommandOSUserList : public Command
if (!pattern.empty())
{
- Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + (u2->ip() ? u2->ip.addr() : u2->host);
+ Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + (!u2->ip.empty() ? u2->ip : u2->host);
if (!Anope::Match(mask, pattern) && !Anope::Match(mask2, pattern) && !Anope::Match(mask3, pattern))
continue;
if (!Modes.empty())
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index 12267b651..d89fbe1a6 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -38,7 +38,7 @@ class MySessionService : public SessionService
for (std::vector<Exception *>::const_iterator it = this->Exceptions.begin(), it_end = this->Exceptions.end(); it != it_end; ++it)
{
Exception *e = *it;
- if (Anope::Match(u->host, e->mask) || (u->ip() && Anope::Match(u->ip.addr(), e->mask)))
+ if (Anope::Match(u->host, e->mask) || Anope::Match(u->ip, e->mask))
return e;
}
return NULL;
diff --git a/modules/commands/os_session.h b/modules/commands/os_session.h
index 67927410d..0d2cee9ad 100644
--- a/modules/commands/os_session.h
+++ b/modules/commands/os_session.h
@@ -1,6 +1,13 @@
#ifndef OS_SESSION_H
#define OS_SESSION_H
+struct Session
+{
+ Anope::string host; /* Host of the session */
+ unsigned count; /* Number of clients with this host */
+ unsigned hits; /* Number of subsequent kills for a host */
+};
+
struct Exception : Serializable
{
Anope::string mask; /* Hosts to which this exception applies */
@@ -15,7 +22,6 @@ struct Exception : Serializable
static void unserialize(serialized_data &data);
};
-
class SessionService : public Service
{
public: