diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/commands/os_dns.cpp | 6 | ||||
| -rw-r--r-- | modules/commands/os_news.cpp | 3 | ||||
| -rw-r--r-- | modules/extra/m_ldap.cpp | 4 | ||||
| -rw-r--r-- | modules/extra/m_xmlrpc.cpp | 44 | ||||
| -rw-r--r-- | modules/m_dns.cpp | 9 |
5 files changed, 35 insertions, 31 deletions
diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index 717cbf29b..ee651f702 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -663,9 +663,12 @@ class ModuleDNS : public Module bool remove_split_servers; bool readd_connected_servers; + time_t last_warn; + public: ModuleDNS(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), - zone_type("DNSZone", DNSZone::Unserialize), dns_type("DNSServer", DNSServer::Unserialize), commandosdns(this) + zone_type("DNSZone", DNSZone::Unserialize), dns_type("DNSServer", DNSServer::Unserialize), commandosdns(this), + last_warn(0) { @@ -840,7 +843,6 @@ class ModuleDNS : public Module if (packet->answers.size() == answer_size) { - static time_t last_warn = 0; if (last_warn + 60 < Anope::CurTime) { last_warn = Anope::CurTime; diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp index bdff3c5eb..487a45300 100644 --- a/modules/commands/os_news.cpp +++ b/modules/commands/os_news.cpp @@ -325,6 +325,8 @@ class CommandOSRandomNews : public NewsBase } }; +static unsigned cur_rand_news = 0; + class OSNews : public Module { Serialize::Type newsitem_type; @@ -356,7 +358,6 @@ class OSNews : public Module else if (Type == NEWS_RANDOM) msg = _("[\002Random News\002 - %s] %s"); - static unsigned cur_rand_news = 0; unsigned displayed = 0, news_count = Config->GetModule(this)->Get<unsigned>("newscount", "3"); for (unsigned i = 0, end = newsList.size(); i < end; ++i) { diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index 4bceb0a61..01e927633 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -80,7 +80,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition int i = ldap_initialize(&this->con, this->server.c_str()); if (i != LDAP_SUCCESS) throw LDAPException("Unable to connect to LDAP service " + this->name + ": " + ldap_err2string(i)); - static const int version = LDAP_VERSION3; + const int version = LDAP_VERSION3; i = ldap_set_option(this->con, LDAP_OPT_PROTOCOL_VERSION, &version); if (i != LDAP_OPT_SUCCESS) throw LDAPException("Unable to set protocol version for " + this->name + ": " + ldap_err2string(i)); @@ -269,7 +269,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition break; } - static struct timeval tv = { 1, 0 }; + struct timeval tv = { 1, 0 }; LDAPMessage *result; int rtype = ldap_result(this->con, LDAP_RES_ANY, 1, &tv, &result); if (rtype <= 0 || this->GetExitState()) diff --git a/modules/extra/m_xmlrpc.cpp b/modules/extra/m_xmlrpc.cpp index 3c16f997e..36401b800 100644 --- a/modules/extra/m_xmlrpc.cpp +++ b/modules/extra/m_xmlrpc.cpp @@ -3,6 +3,28 @@ #include "modules/xmlrpc.h" #include "modules/httpd.h" +static struct special_chars +{ + Anope::string character; + Anope::string replace; + + special_chars(const Anope::string &c, const Anope::string &r) : character(c), replace(r) { } +} +special[] = { + special_chars("&", "&"), + special_chars("\"", """), + special_chars("<", "<"), + special_chars(">", "&qt;"), + special_chars("'", "'"), + special_chars("\n", "
"), + special_chars("\002", ""), // bold + special_chars("\003", ""), // color + special_chars("\035", ""), // italics + special_chars("\037", ""), // underline + special_chars("\026", ""), // reverses + special_chars("", "") +}; + class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage { std::deque<XMLRPCEvent *> events; @@ -25,28 +47,6 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage Anope::string Sanitize(const Anope::string &string) anope_override { - static struct special_chars - { - Anope::string character; - Anope::string replace; - - special_chars(const Anope::string &c, const Anope::string &r) : character(c), replace(r) { } - } - special[] = { - special_chars("&", "&"), - special_chars("\"", """), - special_chars("<", "<"), - special_chars(">", "&qt;"), - special_chars("'", "'"), - special_chars("\n", "
"), - special_chars("\002", ""), // bold - special_chars("\003", ""), // color - special_chars("\035", ""), // italics - special_chars("\037", ""), // underline - special_chars("\026", ""), // reverses - special_chars("", "") - }; - Anope::string ret = string; for (int i = 0; special[i].character.empty() == false; ++i) ret = ret.replace_all_cs(special[i].character, special[i].replace); diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp index 214e97cf4..01524d1ca 100644 --- a/modules/m_dns.cpp +++ b/modules/m_dns.cpp @@ -281,7 +281,7 @@ class Packet : public Query if (q.name.find(':') != Anope::string::npos) { - static const char *const hex = "0123456789abcdef"; + const char *const hex = "0123456789abcdef"; char reverse_ip[128]; unsigned reverse_ip_count = 0; for (int j = 15; j >= 0; --j) @@ -662,7 +662,8 @@ class MyManager : public Manager, public Timer public: std::map<unsigned short, Request *> requests; - MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), tcpsock(NULL), udpsock(NULL), listen(false) + MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), tcpsock(NULL), udpsock(NULL), + listen(false), cur_id(rand()) { } @@ -717,13 +718,13 @@ class MyManager : public Manager, public Timer } private: + unsigned short cur_id; + unsigned short GetID() { if (this->udpsock->GetPackets().size() == 65535) throw SocketException("DNS queue full"); - static unsigned short cur_id = rand(); - do cur_id = (cur_id + 1) & 0xFFFF; while (!cur_id || this->requests.count(cur_id)); |
