diff options
Diffstat (limited to 'modules/extra')
29 files changed, 169 insertions, 163 deletions
diff --git a/modules/extra/bs_autoassign.cpp b/modules/extra/bs_autoassign.cpp index f290a3856..c84e18964 100644 --- a/modules/extra/bs_autoassign.cpp +++ b/modules/extra/bs_autoassign.cpp @@ -31,7 +31,7 @@ class BSAutoAssign : public Module if (this->bot.empty()) return; - BotInfo *bi = findbot(this->bot); + BotInfo *bi = BotInfo::Find(this->bot); if (bi == NULL) { Log(this) << "bs_autoassign is configured to assign bot " << this->bot << ", but it does not exist?"; diff --git a/modules/extra/httpd.h b/modules/extra/httpd.h index 490bf72bb..bf6a9838d 100644 --- a/modules/extra/httpd.h +++ b/modules/extra/httpd.h @@ -130,7 +130,7 @@ class HTTPClient : public ClientSocket, public BufferedSocket, public BinarySock bool ProcessWrite() anope_override { - return !BinarySocket::ProcessWrite() || BinarySocket::WriteBuffer.empty() ? false : true; + return !BinarySocket::ProcessWrite() || BinarySocket::write_buffer.empty() ? false : true; } void Write(const char *buffer, size_t l) anope_override diff --git a/modules/extra/m_chanstats.cpp b/modules/extra/m_chanstats.cpp index 1c37aa8ec..b50592b0f 100644 --- a/modules/extra/m_chanstats.cpp +++ b/modules/extra/m_chanstats.cpp @@ -21,7 +21,7 @@ class MySQLInterface : public SQLInterface class MChanstats : public Module { - service_reference<SQLProvider> sql; + ServiceReference<SQLProvider> sql; MySQLInterface sqlinterface; SQLQuery query; Anope::string SmileysHappy, SmileysSad, SmileysOther, prefix; @@ -359,7 +359,7 @@ class MChanstats : public Module SmileysOther = config.ReadValue("chanstats", "SmileysOther", ":/", 0); Anope::string engine = config.ReadValue("chanstats", "engine", "", 0); - this->sql = service_reference<SQLProvider>("SQLProvider", engine); + this->sql = ServiceReference<SQLProvider>("SQLProvider", engine); if (sql) this->CheckTables(); else @@ -367,7 +367,7 @@ class MChanstats : public Module } void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) anope_override { - User *u = finduser(user); + User *u = User::Find(user); if (!u || !u->Account() || !c->ci || !c->ci->HasFlag(CI_STATS)) return; query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);"; diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp index b860bd64c..54c802cd4 100644 --- a/modules/extra/m_dnsbl.cpp +++ b/modules/extra/m_dnsbl.cpp @@ -7,7 +7,7 @@ #include "module.h" -static service_reference<XLineManager> akills("XLineManager", "xlinemanager/sgline"); +static ServiceReference<XLineManager> akills("XLineManager", "xlinemanager/sgline"); struct Blacklist { @@ -19,21 +19,21 @@ struct Blacklist Blacklist(const Anope::string &n, time_t b, const Anope::string &r, const std::map<int, Anope::string> &re) : name(n), bantime(b), reason(r), replies(re) { } }; -class DNSBLResolver : public DNSRequest +class DNSBLResolver : public DNS::Request { - dynamic_reference<User> user; + Reference<User> user; Blacklist blacklist; bool add_to_akill; public: - DNSBLResolver(Module *c, User *u, const Blacklist &b, const Anope::string &host, bool add_akill) : DNSRequest(host, DNS_QUERY_A, true, c), user(u), blacklist(b), add_to_akill(add_akill) { } + DNSBLResolver(Module *c, User *u, const Blacklist &b, const Anope::string &host, bool add_akill) : DNS::Request(host, DNS::QUERY_A, true, c), user(u), blacklist(b), add_to_akill(add_akill) { } - void OnLookupComplete(const DNSQuery *record) anope_override + void OnLookupComplete(const DNS::Query *record) anope_override { if (!user || user->HasExt("m_dnsbl_akilled")) return; - const ResourceRecord &ans_record = record->answers[0]; + const DNS::ResourceRecord &ans_record = record->answers[0]; // Replies should be in 127.0.0.0/24 if (ans_record.rdata.find("127.0.0.") != 0) return; @@ -61,8 +61,7 @@ class DNSBLResolver : public DNSRequest reason = reason.replace_all_cs("%r", record_reason); reason = reason.replace_all_cs("%N", Config->NetworkName); - const BotInfo *operserv = findbot(Config->OperServ); - Log(operserv) << "DNSBL: " << user->GetMask() << " (" << user->ip << ") appears in " << this->blacklist.name; + Log(OperServ) << "DNSBL: " << user->GetMask() << " (" << user->ip << ") appears in " << this->blacklist.name; XLine *x = new XLine("*@" + user->ip, Config->OperServ, Anope::CurTime + this->blacklist.bantime, reason, XLineManager::GenerateUID()); if (this->add_to_akill && akills) { @@ -71,8 +70,8 @@ class DNSBLResolver : public DNSRequest } else { - ircdproto->SendAkill(NULL, x); - x->destroy(); + IRCD->SendAkill(NULL, x); + x->Destroy(); } } }; @@ -110,7 +109,7 @@ class ModuleDNSBL : public Module if (bname.empty()) continue; Anope::string sbantime = config.ReadValue("blacklist", "time", "4h", i); - time_t bantime = dotime(sbantime); + time_t bantime = Anope::DoTime(sbantime); if (bantime < 0) bantime = 9000; Anope::string reason = config.ReadValue("blacklist", "reason", "", i); @@ -126,7 +125,7 @@ class ModuleDNSBL : public Module } } - void OnUserConnect(dynamic_reference<User> &user, bool &exempt) anope_override + void OnUserConnect(Reference<User> &user, bool &exempt) anope_override { if (exempt || !user || (!this->check_on_connect && !Me->IsSynced())) return; diff --git a/modules/extra/m_helpchan.cpp b/modules/extra/m_helpchan.cpp index 08f90b644..6b450e581 100644 --- a/modules/extra/m_helpchan.cpp +++ b/modules/extra/m_helpchan.cpp @@ -26,10 +26,10 @@ class HelpChannel : public Module { if (Name == CMODE_OP && c && c->ci && c->name.equals_ci(this->HelpChan)) { - User *u = finduser(param); + User *u = User::Find(param); if (u && c->ci->AccessFor(u).HasPriv("OPDEOPME")) - u->SetMode(findbot(Config->OperServ), UMODE_HELPOP); + u->SetMode(OperServ, UMODE_HELPOP); } return EVENT_CONTINUE; diff --git a/modules/extra/m_httpd.cpp b/modules/extra/m_httpd.cpp index f2704d77c..0176b955a 100644 --- a/modules/extra/m_httpd.cpp +++ b/modules/extra/m_httpd.cpp @@ -42,7 +42,7 @@ class MyHTTPClient : public HTTPClient HTTPMessage header; bool header_done, served; Anope::string page_name; - dynamic_reference<HTTPPage> page; + Reference<HTTPPage> page; Anope::string ip; enum @@ -114,7 +114,8 @@ class MyHTTPClient : public HTTPClient { if (this->action == ACTION_NONE) { - std::vector<Anope::string> params = BuildStringVector(buf); + std::vector<Anope::string> params; + spacesepstream(buf).GetTokens(params); if (params.empty() || (params[0] != "GET" && params[0] != "POST")) { @@ -189,11 +190,11 @@ class MyHTTPClient : public HTTPClient } catch (const ConvertException &) { } - if (this->extrabuf.length() == content_length) + if (this->extra_buf.length() == content_length) { - Log(LOG_DEBUG_2) << "HTTP POST from " << this->clientaddr.addr() << ": " << this->extrabuf; + Log(LOG_DEBUG_2) << "HTTP POST from " << this->clientaddr.addr() << ": " << this->extra_buf; - sepstream sep(this->extrabuf, '&'); + sepstream sep(this->extra_buf, '&'); Anope::string token; while (sep.GetToken(token)) @@ -204,7 +205,7 @@ class MyHTTPClient : public HTTPClient this->header.post_data[token.substr(0, sz)] = HTTPUtils::URLDecode(token.substr(sz + 1)); } - this->header.content = this->extrabuf; + this->header.content = this->extra_buf; this->Serve(); } } @@ -281,7 +282,7 @@ class MyHTTPProvider : public HTTPProvider, public CallBack { int timeout; std::map<Anope::string, HTTPPage *> pages; - std::list<dynamic_reference<MyHTTPClient> > clients; + std::list<Reference<MyHTTPClient> > clients; public: MyHTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, const int t) : Socket(-1, i.find(':') != Anope::string::npos), HTTPProvider(c, n, i, p), CallBack(c, 10, Anope::CurTime, true), timeout(t) { } @@ -290,7 +291,7 @@ class MyHTTPProvider : public HTTPProvider, public CallBack { while (!this->clients.empty()) { - dynamic_reference<MyHTTPClient>& c = this->clients.front(); + Reference<MyHTTPClient>& c = this->clients.front(); if (c && c->created + this->timeout >= Anope::CurTime) break; @@ -326,7 +327,7 @@ class MyHTTPProvider : public HTTPProvider, public CallBack class HTTPD : public Module { - service_reference<SSLService> sslref; + ServiceReference<SSLService> sslref; std::map<Anope::string, HTTPProvider *> providers; public: HTTPD(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), sslref("SSLService", "ssl") @@ -432,7 +433,7 @@ class HTTPD : public Module p->ext_ip = ext_ip; - p->ext_headers = BuildStringVector(ext_header); + spacesepstream(ext_header).GetTokens(p->ext_headers); } for (std::map<Anope::string, HTTPProvider *>::iterator it = this->providers.begin(), it_end = this->providers.end(); it != it_end;) diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index f2140eb71..233a43dde 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -12,13 +12,13 @@ static Anope::string username_attribute; struct IdentifyInfo { - dynamic_reference<User> user; + Reference<User> user; IdentifyRequest *req; - service_reference<LDAPProvider> lprov; + ServiceReference<LDAPProvider> lprov; bool admin_bind; Anope::string dn; - IdentifyInfo(User *u, IdentifyRequest *r, service_reference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true) + IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true) { req->Hold(me); } @@ -100,18 +100,17 @@ class IdentifyInterface : public LDAPInterface } else { - NickAlias *na = findnick(ii->req->GetAccount()); + NickAlias *na = NickAlias::Find(ii->req->GetAccount()); if (na == NULL) { na = new NickAlias(ii->req->GetAccount(), new NickCore(ii->req->GetAccount())); if (ii->user) { if (Config->NSAddAccessOnReg) - na->nc->AddAccess(create_mask(ii->user)); + na->nc->AddAccess(ii->user->Mask()); - const BotInfo *bi = findbot(Config->NickServ); - if (bi) - ii->user->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str()); + if (NickServ) + ii->user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str()); } } na->nc->Extend("m_ldap_authentication_dn", new ExtensibleItemClass<Anope::string>(ii->dn)); @@ -155,7 +154,7 @@ class OnIdentifyInterface : public LDAPInterface std::map<LDAPQuery, Anope::string>::iterator it = this->requests.find(r.id); if (it == this->requests.end()) return; - User *u = finduser(it->second); + User *u = User::Find(it->second); this->requests.erase(it); if (!u || !u->Account() || r.empty()) @@ -169,9 +168,8 @@ class OnIdentifyInterface : public LDAPInterface if (!email.equals_ci(u->Account()->email)) { u->Account()->email = email; - BotInfo *bi = findbot(Config->NickServ); - if (bi) - u->SendMessage(bi, _("Your email has been updated to \002%s\002"), email.c_str()); + if (NickServ) + u->SendMessage(NickServ, _("Your email has been updated to \002%s\002"), email.c_str()); Log(this->owner) << "m_ldap_authentication: Updated email address for " << u->nick << " (" << u->Account()->display << ") to " << email; } } @@ -206,7 +204,7 @@ class OnRegisterInterface : public LDAPInterface class NSIdentifyLDAP : public Module { - service_reference<LDAPProvider> ldap; + ServiceReference<LDAPProvider> ldap; IdentifyInterface iinterface; OnIdentifyInterface oninterface; OnRegisterInterface orinterface; diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index 53b3d4d43..ed2f5900a 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -23,7 +23,7 @@ class IdentifyInterface : public LDAPInterface std::map<LDAPQuery, Anope::string>::iterator it = this->requests.find(r.id); if (it == this->requests.end()) return; - User *u = finduser(it->second); + User *u = User::Find(it->second); this->requests.erase(it); @@ -77,7 +77,7 @@ class IdentifyInterface : public LDAPInterface class LDAPOper : public Module { - service_reference<LDAPProvider> ldap; + ServiceReference<LDAPProvider> ldap; IdentifyInterface iinterface; Anope::string binddn; diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index 7f1f965cd..47f6f41de 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -376,10 +376,10 @@ std::vector<SQLQuery> MySQLService::CreateTable(const Anope::string &table, cons known_cols.insert(it->first); query_text += ", `" + it->first + "` "; - if (it->second.getType() == Serialize::DT_INT) + if (it->second.GetType() == Serialize::DT_INT) query_text += "int(11)"; - else if (it->second.getMax() > 0) - query_text += "varchar(" + stringify(it->second.getMax()) + ")"; + else if (it->second.GetMax() > 0) + query_text += "varchar(" + stringify(it->second.GetMax()) + ")"; else query_text += "text"; } @@ -395,10 +395,10 @@ std::vector<SQLQuery> MySQLService::CreateTable(const Anope::string &table, cons known_cols.insert(it->first); Anope::string query_text = "ALTER TABLE `" + table + "` ADD `" + it->first + "` "; - if (it->second.getType() == Serialize::DT_INT) + if (it->second.GetType() == Serialize::DT_INT) query_text += "int(11)"; - else if (it->second.getMax() > 0) - query_text += "varchar(" + stringify(it->second.getMax()) + ")"; + else if (it->second.GetMax() > 0) + query_text += "varchar(" + stringify(it->second.GetMax()) + ")"; else query_text += "text"; diff --git a/modules/extra/m_proxyscan.cpp b/modules/extra/m_proxyscan.cpp index 00519c57f..6d2a6b7b0 100644 --- a/modules/extra/m_proxyscan.cpp +++ b/modules/extra/m_proxyscan.cpp @@ -36,7 +36,7 @@ class ProxyCallbackListener : public ListenSocket bool ProcessWrite() anope_override { - return !BufferedSocket::ProcessWrite() || this->WriteBuffer.empty() ? false : true; + return !BufferedSocket::ProcessWrite() || this->write_buffer.empty() ? false : true; } }; @@ -53,7 +53,7 @@ class ProxyCallbackListener : public ListenSocket class ProxyConnect : public ConnectionSocket { - static service_reference<XLineManager> akills; + static ServiceReference<XLineManager> akills; public: static std::set<ProxyConnect *> proxies; @@ -85,7 +85,7 @@ class ProxyConnect : public ConnectionSocket reason = reason.replace_all_cs("%i", this->conaddr.addr()); reason = reason.replace_all_cs("%p", stringify(this->conaddr.port())); - Log(findbot(Config->OperServ)) << "PROXYSCAN: Open " << this->GetType() << " proxy found on " << this->conaddr.addr() << ":" << this->conaddr.port() << " (" << reason << ")"; + Log(OperServ) << "PROXYSCAN: Open " << this->GetType() << " proxy found on " << this->conaddr.addr() << ":" << this->conaddr.port() << " (" << reason << ")"; XLine *x = new XLine("*@" + this->conaddr.addr(), Config->OperServ, Anope::CurTime + this->proxy.duration, reason, XLineManager::GenerateUID()); if (add_to_akill && akills) { @@ -94,15 +94,15 @@ class ProxyConnect : public ConnectionSocket } else { - if (ircdproto->CanSZLine) - ircdproto->SendSZLine(NULL, x); + if (IRCD->CanSZLine) + IRCD->SendSZLine(NULL, x); else - ircdproto->SendAkill(NULL, x); - x->destroy(); + IRCD->SendAkill(NULL, x); + x->Destroy(); } } }; -service_reference<XLineManager> ProxyConnect::akills("XLineManager", "xlinemanager/sgline"); +ServiceReference<XLineManager> ProxyConnect::akills("XLineManager", "xlinemanager/sgline"); std::set<ProxyConnect *> ProxyConnect::proxies; class HTTPProxyConnect : public ProxyConnect, public BufferedSocket @@ -255,7 +255,7 @@ class ModuleProxyScan : public Module ++it; ClientSocket *cs = dynamic_cast<ClientSocket *>(s); - if (cs != NULL && cs->LS == this->listener) + if (cs != NULL && cs->ls == this->listener) delete s; } @@ -332,7 +332,7 @@ class ModuleProxyScan : public Module if (p.ports.empty()) continue; - p.duration = dotime(config.ReadValue("proxyscan", "time", "4h", i)); + p.duration = Anope::DoTime(config.ReadValue("proxyscan", "time", "4h", i)); p.reason = config.ReadValue("proxyscan", "reason", "", i); if (p.reason.empty()) continue; @@ -341,7 +341,7 @@ class ModuleProxyScan : public Module } } - void OnUserConnect(dynamic_reference<User> &user, bool &exempt) anope_override + void OnUserConnect(Reference<User> &user, bool &exempt) anope_override { if (exempt || !user || !Me->IsSynced() || !user->server->IsSynced()) return; @@ -360,7 +360,7 @@ class ModuleProxyScan : public Module if (!this->con_notice.empty() && !this->con_source.empty()) { - const BotInfo *bi = findbot(this->con_source); + const BotInfo *bi = BotInfo::Find(this->con_source); if (bi) user->SendMessage(bi, this->con_notice); } diff --git a/modules/extra/m_rewrite.cpp b/modules/extra/m_rewrite.cpp index 6d8690960..70710bd8a 100644 --- a/modules/extra/m_rewrite.cpp +++ b/modules/extra/m_rewrite.cpp @@ -13,7 +13,8 @@ struct Rewrite bool Matches(const std::vector<Anope::string> &message) { - std::vector<Anope::string> sm = BuildStringVector(this->source_message); + std::vector<Anope::string> sm; + spacesepstream(this->source_message).GetTokens(sm); for (unsigned i = 0; i < sm.size(); ++i) if (sm[i] != "$" && !sm[i].equals_ci(message[i])) @@ -106,7 +107,8 @@ class ModuleRewrite : public Module EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override { - std::vector<Anope::string> tokens = BuildStringVector(message); + std::vector<Anope::string> tokens; + spacesepstream(message).GetTokens(tokens); for (unsigned i = 0; i < this->rewrites.size(); ++i) { Rewrite &rw = this->rewrites[i]; diff --git a/modules/extra/m_sql_authentication.cpp b/modules/extra/m_sql_authentication.cpp index 9412edc50..ce7a275b3 100644 --- a/modules/extra/m_sql_authentication.cpp +++ b/modules/extra/m_sql_authentication.cpp @@ -5,7 +5,7 @@ static Module *me; class SQLAuthenticationResult : public SQLInterface { - dynamic_reference<User> user; + Reference<User> user; IdentifyRequest *req; public: @@ -37,26 +37,25 @@ class SQLAuthenticationResult : public SQLInterface } catch (const SQLException &) { } - const BotInfo *bi = findbot(Config->NickServ); - NickAlias *na = findnick(req->GetAccount()); + NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) { na = new NickAlias(req->GetAccount(), new NickCore(req->GetAccount())); if (user) { if (Config->NSAddAccessOnReg) - na->nc->AddAccess(create_mask(user)); + na->nc->AddAccess(user->Mask()); - if (bi) - user->SendMessage(bi, _("Your account \002%s\002 has been successfully created."), na->nick.c_str()); + if (NickServ) + user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str()); } } if (!email.empty() && email != na->nc->email) { na->nc->email = email; - if (user && bi) - user->SendMessage(bi, _("Your email has been updated to \002%s\002."), email.c_str()); + if (user && NickServ) + user->SendMessage(NickServ, _("Your email has been updated to \002%s\002."), email.c_str()); } req->Success(me); @@ -77,7 +76,7 @@ class ModuleSQLAuthentication : public Module bool disable_register; Anope::string disable_reason; - service_reference<SQLProvider> SQL; + ServiceReference<SQLProvider> SQL; public: ModuleSQLAuthentication(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) @@ -101,7 +100,7 @@ class ModuleSQLAuthentication : public Module this->disable_register = config.ReadFlag("m_sql_authentication", "disable_ns_register", "false", 0); this->disable_reason = config.ReadValue("m_sql_authentication", "disable_reason", "", 0); - this->SQL = service_reference<SQLProvider>("SQLProvider", this->engine); + this->SQL = ServiceReference<SQLProvider>("SQLProvider", this->engine); } EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp index 22218a646..523272a49 100644 --- a/modules/extra/m_sql_oper.cpp +++ b/modules/extra/m_sql_oper.cpp @@ -3,7 +3,7 @@ class SQLOperResult : public SQLInterface { - dynamic_reference<User> user; + Reference<User> user; struct SQLOperResultDeleter { @@ -51,7 +51,7 @@ class SQLOperResult : public SQLInterface delete user->Account()->o; user->Account()->o = NULL; Log(this->owner) << "m_sql_oper: Removed services operator from " << user->nick << " (" << user->Account()->display << ")"; - user->RemoveMode(findbot(Config->OperServ), UMODE_OPER); // Probably not set, just incase + user->RemoveMode(OperServ, UMODE_OPER); // Probably not set, just incase } return; } @@ -72,10 +72,10 @@ class SQLOperResult : public SQLInterface if (!user->HasMode(UMODE_OPER)) { - ircdproto->SendOper(user); + IRCD->SendOper(user); if (!modes.empty()) - user->SetModes(findbot(Config->OperServ), "%s", modes.c_str()); + user->SetModes(OperServ, "%s", modes.c_str()); } } @@ -91,7 +91,7 @@ class ModuleSQLOper : public Module Anope::string engine; Anope::string query; - service_reference<SQLProvider> SQL; + ServiceReference<SQLProvider> SQL; public: ModuleSQLOper(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) @@ -111,7 +111,7 @@ class ModuleSQLOper : public Module this->engine = config.ReadValue("m_sql_oper", "engine", "", 0); this->query = config.ReadValue("m_sql_oper", "query", "", 0); - this->SQL = service_reference<SQLProvider>("SQLProvider", this->engine); + this->SQL = ServiceReference<SQLProvider>("SQLProvider", this->engine); } void OnNickIdentify(User *u) anope_override diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index f0db04c66..971345475 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -107,7 +107,7 @@ class ModuleSQLite : public Module if (this->SQLiteServices.find(connname) == this->SQLiteServices.end()) { - Anope::string database = db_dir + "/" + config.ReadValue("sqlite", "database", "anope", i); + Anope::string database = Anope::DataDir + "/" + config.ReadValue("sqlite", "database", "anope", i); try { @@ -214,7 +214,7 @@ std::vector<SQLQuery> SQLiteService::CreateTable(const Anope::string &table, con known_cols.insert(it->first); query_text += ", `" + it->first + "` "; - if (it->second.getType() == Serialize::DT_INT) + if (it->second.GetType() == Serialize::DT_INT) query_text += "int(11)"; else query_text += "text"; @@ -242,7 +242,7 @@ std::vector<SQLQuery> SQLiteService::CreateTable(const Anope::string &table, con known_cols.insert(it->first); Anope::string query_text = "ALTER TABLE `" + table + "` ADD `" + it->first + "` "; - if (it->second.getType() == Serialize::DT_INT) + if (it->second.GetType() == Serialize::DT_INT) query_text += "int(11)"; else query_text += "text"; diff --git a/modules/extra/m_ssl.cpp b/modules/extra/m_ssl.cpp index 2f72744c7..fdde28919 100644 --- a/modules/extra/m_ssl.cpp +++ b/modules/extra/m_ssl.cpp @@ -110,7 +110,7 @@ class SSLModule : public Module this->OnReload(); - if (IsFile(this->certfile.c_str())) + if (Anope::IsFile(this->certfile.c_str())) { if (!SSL_CTX_use_certificate_file(client_ctx, this->certfile.c_str(), SSL_FILETYPE_PEM) || !SSL_CTX_use_certificate_file(server_ctx, this->certfile.c_str(), SSL_FILETYPE_PEM)) { @@ -124,7 +124,7 @@ class SSLModule : public Module else Log() << "Unable to open certificate " << this->certfile; - if (IsFile(this->keyfile.c_str())) + if (Anope::IsFile(this->keyfile.c_str())) { if (!SSL_CTX_use_PrivateKey_file(client_ctx, this->keyfile.c_str(), SSL_FILETYPE_PEM) || !SSL_CTX_use_PrivateKey_file(server_ctx, this->keyfile.c_str(), SSL_FILETYPE_PEM)) { @@ -137,7 +137,7 @@ class SSLModule : public Module } else { - if (IsFile(this->certfile.c_str())) + if (Anope::IsFile(this->certfile.c_str())) { SSL_CTX_free(client_ctx); SSL_CTX_free(server_ctx); @@ -168,7 +168,7 @@ class SSLModule : public Module Socket *s = it->second; ++it; - if (dynamic_cast<SSLSocketIO *>(s->IO)) + if (dynamic_cast<SSLSocketIO *>(s->io)) delete s; } @@ -188,7 +188,7 @@ class SSLModule : public Module { ConfigReader config; - if (config.ReadFlag("uplink", "ssl", "no", CurrentUplink)) + if (config.ReadFlag("uplink", "ssl", "no", Anope::CurrentUplink)) { this->service.Init(UplinkSock); } @@ -201,10 +201,10 @@ MySSLService::MySSLService(Module *o, const Anope::string &n) : SSLService(o, n) void MySSLService::Init(Socket *s) { - if (s->IO != &normalSocketIO) + if (s->io != &NormalSocketIO) throw CoreException("Socket initializing SSL twice"); - s->IO = new SSLSocketIO(); + s->io = new SSLSocketIO(); } SSLSocketIO::SSLSocketIO() @@ -228,7 +228,7 @@ int SSLSocketIO::Send(Socket *s, const char *buf, size_t sz) ClientSocket *SSLSocketIO::Accept(ListenSocket *s) { - if (s->IO == &normalSocketIO) + if (s->io == &NormalSocketIO) throw SocketException("Attempting to accept on uninitialized socket with SSL"); sockaddrs conaddr; @@ -245,15 +245,15 @@ ClientSocket *SSLSocketIO::Accept(ListenSocket *s) ClientSocket *newsocket = s->OnAccept(newsock, conaddr); me->service.Init(newsocket); - SSLSocketIO *IO = anope_dynamic_static_cast<SSLSocketIO *>(newsocket->IO); + SSLSocketIO *io = anope_dynamic_static_cast<SSLSocketIO *>(newsocket->io); - IO->sslsock = SSL_new(server_ctx); - if (!IO->sslsock) + io->sslsock = SSL_new(server_ctx); + if (!io->sslsock) throw SocketException("Unable to initialize SSL socket"); - SSL_set_accept_state(IO->sslsock); + SSL_set_accept_state(io->sslsock); - if (!SSL_set_fd(IO->sslsock, newsocket->GetFD())) + if (!SSL_set_fd(io->sslsock, newsocket->GetFD())) throw SocketException("Unable to set SSL fd"); newsocket->SetFlag(SF_ACCEPTING); @@ -264,19 +264,19 @@ ClientSocket *SSLSocketIO::Accept(ListenSocket *s) SocketFlag SSLSocketIO::FinishAccept(ClientSocket *cs) { - if (cs->IO == &normalSocketIO) + if (cs->io == &NormalSocketIO) throw SocketException("Attempting to finish connect uninitialized socket with SSL"); else if (cs->HasFlag(SF_ACCEPTED)) return SF_ACCEPTED; else if (!cs->HasFlag(SF_ACCEPTING)) throw SocketException("SSLSocketIO::FinishAccept called for a socket not accepted nor accepting?"); |
