diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/config.h | 15 | ||||
| -rw-r--r-- | include/modules/os_session.h | 2 | ||||
| -rw-r--r-- | include/sockets.h | 5 | ||||
| -rw-r--r-- | include/users.h | 3 | ||||
| -rw-r--r-- | include/xline.h | 13 |
5 files changed, 20 insertions, 18 deletions
diff --git a/include/config.h b/include/config.h index 019564680..b132c5d2d 100644 --- a/include/config.h +++ b/include/config.h @@ -51,14 +51,13 @@ namespace Configuration template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const { const Anope::string &value = this->Get<const Anope::string>(tag, def); - try - { - return convertTo<T>(value); - } - catch (const ConvertException &) - { - return T(); - } + if (!value.empty()) + try + { + return convertTo<T>(value); + } + catch (const ConvertException &) { } + return T(); } bool Set(const Anope::string &tag, const Anope::string &value); diff --git a/include/modules/os_session.h b/include/modules/os_session.h index 65f1c6f75..957fe6043 100644 --- a/include/modules/os_session.h +++ b/include/modules/os_session.h @@ -7,7 +7,7 @@ struct Session unsigned count; /* Number of clients with this host */ unsigned hits; /* Number of subsequent kills for a host */ - Session(const Anope::string &ip, int len) : addr(ip, len), count(1), hits(0) { } + Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { } }; struct Exception : Serializable diff --git a/include/sockets.h b/include/sockets.h index 0dfa5d9d0..ca61f7efc 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -59,7 +59,7 @@ union CoreExport sockaddrs /** Check if this sockaddr has data in it */ - bool operator()() const; + bool valid() const; /** Compares with sockaddr with another. Compares address type, port, and address * @return true if they are the same @@ -82,8 +82,6 @@ union CoreExport sockaddrs * @throws A socket exception if given an invalid structure */ void ntop(int type, const void *src); - - bool valid() const; }; class CoreExport cidr @@ -94,6 +92,7 @@ class CoreExport cidr public: cidr(const Anope::string &ip); cidr(const Anope::string &ip, unsigned char len); + cidr(const sockaddrs &ip, unsigned char len); Anope::string mask() const; bool match(const sockaddrs &other); bool valid() const; diff --git a/include/users.h b/include/users.h index 73c373938..04d1606a4 100644 --- a/include/users.h +++ b/include/users.h @@ -20,6 +20,7 @@ #include "serialize.h" #include "commands.h" #include "account.h" +#include "sockets.h" typedef Anope::hash_map<User *> user_map; @@ -71,7 +72,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe /* SSL Fingerprint */ Anope::string fingerprint; /* User's IP */ - Anope::string ip; + sockaddrs ip; /* Server user is connected to */ Server *server; /* When the user signed on. Set on connect and never modified. */ diff --git a/include/xline.h b/include/xline.h index fa3f5ba6c..2eae08dc8 100644 --- a/include/xline.h +++ b/include/xline.h @@ -12,12 +12,15 @@ #include "serialize.h" #include "service.h" +#include "sockets.h" /* An Xline, eg, anything added with operserv/akill, or any of the operserv/sxline commands */ class CoreExport XLine : public Serializable { - void InitRegex(); + void Init(); + Anope::string nick, user, host, real; public: + cidr *c; Anope::string mask; Regex *regex; Anope::string by; @@ -32,10 +35,10 @@ class CoreExport XLine : public Serializable XLine(const Anope::string &mask, const Anope::string &by, const time_t expires, const Anope::string &reason, const Anope::string &uid = ""); ~XLine(); - Anope::string GetNick() const; - Anope::string GetUser() const; - Anope::string GetHost() const; - Anope::string GetReal() const; + const Anope::string &GetNick() const; + const Anope::string &GetUser() const; + const Anope::string &GetHost() const; + const Anope::string &GetReal() const; Anope::string GetReason() const; |
