diff --git a/data/example.conf b/data/example.conf index 647e1eee4a..56e7e44665 100644 --- a/data/example.conf +++ b/data/example.conf @@ -1184,9 +1184,10 @@ module /* Whether or not to import data from another database module in to SQL on startup. * If you enable this, be sure that the database services is configured to use is - * empty and that another database module to import from is loaded before db_sql. - * After you enable this and do a database import you should disable it for - * subsequent restarts. + * empty and that another database module to import from is loaded BEFORE db_sql. + * After you enable this and do a database import you MUST disable it for + * subsequent restarts. If you want to keep writing a flatfile database after the + * SQL import is done you should load db_flatfile AFTER this module. * * Note that you can not import databases using db_sql_live. If you want to import * databases and use db_sql_live you should import them using db_sql, then shut down diff --git a/docs/Changes b/docs/Changes index 730c5f43c0..6ac23ce646 100644 --- a/docs/Changes +++ b/docs/Changes @@ -1,9 +1,22 @@ -Anope Version 2.0.17-git +Anope Version 2.0.18-git ------------------------ No significant changes. -Anope Version 2.0.16-git ------------------------- +Anope Version 2.0.17 +-------------------- +Fixed importing large flatfile databases into SQL. +Fixed marking channels as permanent. +Fixed serialising unset boolean extension items. +Fixed the documentation about how to import SQL databases. +Fixed the documentation of options:usemail. +Fixed the location of the geoipupdate CSV files. +Fixed translating memo emails. +Fixed unnecessary SQL updates caused by dereferencing user accounts. +Increased the size of the chanstats letter and word count columns. +Updated the location of the Anope IRC channels. + +Anope Version 2.0.16 +-------------------- Added a workaround for users matching expired sqlines. Fixed a copy/paste error in webcpanel. Fixed a crash in db_flatfile caused by trying to serialize data without a type. diff --git a/docs/Changes.conf b/docs/Changes.conf index 1ceaaef767..14574cc883 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -1,7 +1,11 @@ -Anope Version 2.0.17-git +Anope Version 2.0.18-git ------------------------ No significant changes. +Anope Version 2.0.17 +-------------------- +No significant changes. + Anope Version 2.0.16 -------------------- No significant changes. diff --git a/include/extensible.h b/include/extensible.h index 0b3b1f1f43..5ac5f6816f 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -191,7 +191,7 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override { data.SetType(this->name, Serialize::Data::DT_INT); - data[this->name] << true; + data[this->name] << this->HasExt(e); } void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override diff --git a/modules/commands/greet.cpp b/modules/commands/greet.cpp index 7e1b5ce758..963a28ffdd 100644 --- a/modules/commands/greet.cpp +++ b/modules/commands/greet.cpp @@ -188,7 +188,7 @@ class Greet : public Module * to has synced, or we'll get greet-floods when the net * recovers from a netsplit. -GD */ - if (!c->ci || !c->ci->bi || !user->server->IsSynced() || !user->Account()) + if (!c->ci || !c->ci->bi || !user->server->IsSynced() || !user->IsIdentified()) return; Anope::string *greet = ns_greet.Get(user->Account()); diff --git a/modules/commands/ns_identify.cpp b/modules/commands/ns_identify.cpp index e0d0f601a1..5450016021 100644 --- a/modules/commands/ns_identify.cpp +++ b/modules/commands/ns_identify.cpp @@ -82,7 +82,7 @@ class CommandNSIdentify : public Command return; } - if (u->Account() && na && u->Account() == na->nc) + if (u->IsIdentified() && na && u->Account() == na->nc) { source.Reply(_("You are already identified.")); return; diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index a3bfb3630d..5ec1614213 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -1286,7 +1286,7 @@ class NSSet : public Module if (chan->ci) { /* Only give modes if autoop is set */ - give_modes &= !user->Account() || autoop.HasExt(user->Account()); + give_modes &= !user->IsIdentified() || autoop.HasExt(user->Account()); } } @@ -1321,13 +1321,13 @@ class NSSet : public Module void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override { - if (u->Account() && setter.GetUser() == u) + if (u->IsIdentified() && setter.GetUser() == u) u->Account()->last_modes = u->GetModeList(); } void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override { - if (u->Account() && setter.GetUser() == u) + if (u->IsIdentified() && setter.GetUser() == u) u->Account()->last_modes = u->GetModeList(); } diff --git a/modules/commands/ns_status.cpp b/modules/commands/ns_status.cpp index d0e15cc924..04a43ef643 100644 --- a/modules/commands/ns_status.cpp +++ b/modules/commands/ns_status.cpp @@ -36,7 +36,7 @@ class CommandNSStatus : public Command else if (u2->IsIdentified() && na && na->nc == u2->Account()) /* Nick is identified */ source.Reply("STATUS %s %d %s", nickbuf.c_str(), 3, u2->Account()->display.c_str()); else if (u2->IsRecognized()) /* Nick is recognised, but NOT identified */ - source.Reply("STATUS %s %d %s", nickbuf.c_str(), 2, u2->Account() ? u2->Account()->display.c_str() : ""); + source.Reply("STATUS %s %d %s", nickbuf.c_str(), 2, u2->IsIdentified() ? u2->Account()->display.c_str() : ""); else if (!na) /* Nick is online, but NOT a registered */ source.Reply("STATUS %s %d %s", nickbuf.c_str(), 0, ""); else diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index c02edd8aa6..1964d136fd 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -159,6 +159,14 @@ class DBSQL : public Module, public Pipe this->import = block->Get("import"); } + void OnPostInit() anope_override + { + // If we are importing from flatfile we need to force a socket engine + // flush to ensure it actually gets written to the database before we + // connect to the uplink. + SocketEngine::Process(); + } + void OnShutdown() anope_override { this->shutting_down = true; diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index 5340038dd6..1d44c807f9 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -143,7 +143,7 @@ class OnIdentifyInterface : public LDAPInterface { User *u = User::Find(uid); - if (!u || !u->Account() || r.empty()) + if (!u || !u->IsIdentified() || r.empty()) return; try diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index 469b3dd845..de6af45c1f 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -23,7 +23,7 @@ class IdentifyInterface : public LDAPInterface void OnResult(const LDAPResult &r) anope_override { - if (!u || !u->Account()) + if (!u || !u->IsIdentified()) return; NickCore *nc = u->Account(); diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp index 4bc75ac7b0..d0cb48ff5d 100644 --- a/modules/extra/m_sql_oper.cpp +++ b/modules/extra/m_sql_oper.cpp @@ -46,7 +46,7 @@ class SQLOperResult : public SQL::Interface { SQLOperResultDeleter d(this); - if (!user || !user->Account()) + if (!user || !user->IsIdentified()) return; if (r.Rows() == 0) diff --git a/modules/extra/stats/irc2sql/irc2sql.cpp b/modules/extra/stats/irc2sql/irc2sql.cpp index 8377c5d2e7..391fad0505 100644 --- a/modules/extra/stats/irc2sql/irc2sql.cpp +++ b/modules/extra/stats/irc2sql/irc2sql.cpp @@ -108,7 +108,7 @@ void IRC2SQL::OnUserConnect(User *u, bool &exempt) query.SetValue("ident", u->GetIdent()); query.SetValue("vident", u->GetVIdent()); query.SetValue("secure", u->HasMode("SSL") || u->HasExt("ssl") ? "Y" : "N"); - query.SetValue("account", u->Account() ? u->Account()->display : ""); + query.SetValue("account", u->IsIdentified() ? u->Account()->display : ""); query.SetValue("fingerprint", u->fingerprint); query.SetValue("signon", u->signon); query.SetValue("server", u->server->GetName()); @@ -176,7 +176,7 @@ void IRC2SQL::OnUserLogin(User *u) { query = "UPDATE `" + prefix + "user` SET account=@account@ WHERE nick=@nick@"; query.SetValue("nick", u->nick); - query.SetValue("account", u->Account() ? u->Account()->display : ""); + query.SetValue("account", u->IsIdentified() ? u->Account()->display : ""); this->RunQuery(query); } diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp index b23e65859e..f5b01dde00 100644 --- a/modules/extra/stats/m_chanstats.cpp +++ b/modules/extra/stats/m_chanstats.cpp @@ -207,7 +207,7 @@ class MChanstats : public Module const Anope::string GetDisplay(User *u) { - if (u && u->Account() && ns_stats.HasExt(u->Account())) + if (u && u->IsIdentified() && ns_stats.HasExt(u->Account())) return u->Account()->display; else return ""; @@ -277,8 +277,8 @@ class MChanstats : public Module "`chan` varchar(64) NOT NULL DEFAULT ''," "`nick` varchar(64) NOT NULL DEFAULT ''," "`type` ENUM('total', 'monthly', 'weekly', 'daily') NOT NULL," - "`letters` int(10) unsigned NOT NULL DEFAULT '0'," - "`words` int(10) unsigned NOT NULL DEFAULT '0'," + "`letters` bigint unsigned NOT NULL DEFAULT '0'," + "`words` bigint unsigned NOT NULL DEFAULT '0'," "`line` int(10) unsigned NOT NULL DEFAULT '0'," "`actions` int(10) unsigned NOT NULL DEFAULT '0'," "`smileys_happy` int(10) unsigned NOT NULL DEFAULT '0'," @@ -527,7 +527,7 @@ class MChanstats : public Module void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override { - if (!source || !source->Account() || !c->ci || !cs_stats.HasExt(c->ci)) + if (!source || !source->IsIdentified() || !c->ci || !cs_stats.HasExt(c->ci)) return; query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);"; query.SetValue("channel", c->name); @@ -550,7 +550,7 @@ class MChanstats : public Module private: void OnModeChange(Channel *c, User *u) { - if (!u || !u->Account() || !c->ci || !cs_stats.HasExt(c->ci)) + if (!u || !u->IsIdentified() || !c->ci || !cs_stats.HasExt(c->ci)) return; query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0);"; diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp index c4dfc957ed..c815781bf4 100644 --- a/modules/fantasy.cpp +++ b/modules/fantasy.cpp @@ -167,7 +167,7 @@ class Fantasy : public Module } // Command requires registered users only - if (!cmd->AllowUnregistered() && !u->Account()) + if (!cmd->AllowUnregistered() && !u->IsIdentified()) return; if (params.size() < cmd->min_params) diff --git a/modules/m_dnsbl.cpp b/modules/m_dnsbl.cpp index 78bd9f5963..a37bcf1b18 100644 --- a/modules/m_dnsbl.cpp +++ b/modules/m_dnsbl.cpp @@ -68,7 +68,7 @@ class DNSBLResolver : public Request if (!blacklist.replies.empty() && !reply) return; - if (reply && reply->allow_account && user->Account()) + if (reply && reply->allow_account && user->IsIdentified()) return; Anope::string reason = this->blacklist.reason, addr = user->ip.addr(); diff --git a/modules/m_xmlrpc_main.cpp b/modules/m_xmlrpc_main.cpp index 7b4e35fe66..d391af518c 100644 --- a/modules/m_xmlrpc_main.cpp +++ b/modules/m_xmlrpc_main.cpp @@ -226,7 +226,7 @@ class MyXMLRPCEvent : public XMLRPCEvent request.reply("ip", u->ip.addr()); request.reply("timestamp", stringify(u->timestamp)); request.reply("signon", stringify(u->signon)); - if (u->Account()) + if (u->IsIdentified()) { request.reply("account", iface->Sanitize(u->Account()->display)); if (u->Account()->o) diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 9dbaf69c09..faf064bddc 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -253,7 +253,7 @@ namespace InspIRCdExtban { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); - return !u->Account() && Entry("BAN", real_mask).Matches(u); + return !u->IsIdentified() && Entry("BAN", real_mask).Matches(u); } }; } diff --git a/modules/protocol/inspircd3.cpp b/modules/protocol/inspircd3.cpp index 45d877d784..05371c0912 100644 --- a/modules/protocol/inspircd3.cpp +++ b/modules/protocol/inspircd3.cpp @@ -699,7 +699,7 @@ namespace InspIRCdExtban { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); - return !u->Account() && Entry("BAN", real_mask).Matches(u); + return !u->IsIdentified() && Entry("BAN", real_mask).Matches(u); } }; diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index e6654ddc9b..2fa883c102 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -537,7 +537,7 @@ namespace UnrealExtban const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); - return u->Account() && Anope::Match(u->Account()->display, real_mask); + return u->IsIdentified() && Anope::Match(u->Account()->display, real_mask); } }; } diff --git a/modules/protocol/unreal4.cpp b/modules/protocol/unreal4.cpp index 939a68eea0..1147b10e87 100644 --- a/modules/protocol/unreal4.cpp +++ b/modules/protocol/unreal4.cpp @@ -559,10 +559,10 @@ namespace UnrealExtban const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); - if (real_mask == "0" && !u->Account()) /* ~a:0 is special and matches all unauthenticated users */ + if (real_mask == "0" && !u->IsIdentified()) /* ~a:0 is special and matches all unauthenticated users */ return true; - return u->Account() && Anope::Match(u->Account()->display, real_mask); + return u->IsIdentified() && Anope::Match(u->Account()->display, real_mask); } }; diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp index 8019086c6d..cdfa93599e 100644 --- a/modules/pseudoclients/memoserv.cpp +++ b/modules/pseudoclients/memoserv.cpp @@ -100,7 +100,7 @@ class MemoServCore : public Module, public MemoServService if (ci->AccessFor(cu->user).HasPriv("MEMO")) { - if (cu->user->Account() && cu->user->Account()->HasExt("MEMO_RECEIVE")) + if (cu->user->IsIdentified() && cu->user->Account()->HasExt("MEMO_RECEIVE")) cu->user->SendMessage(MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->StrictPrivmsg.c_str(), MemoServ->nick.c_str(), ci->name.c_str(), mi->memos->size()); } } diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp index 8bed39bbab..bb4b3d3053 100644 --- a/modules/pseudoclients/nickserv.cpp +++ b/modules/pseudoclients/nickserv.cpp @@ -399,7 +399,7 @@ class NickServCore : public Module, public NickServService const NickAlias *na = NickAlias::Find(u->nick); const Anope::string &unregistered_notice = Config->GetModule(this)->Get("unregistered_notice"); - if (!Config->GetModule("nickserv")->Get("nonicknameownership") && !unregistered_notice.empty() && !na && !u->Account()) + if (!Config->GetModule("nickserv")->Get("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified()) u->SendMessage(NickServ, unregistered_notice.replace_all_cs("%n", u->nick)); else if (na && !u->IsIdentified(true)) this->Validate(u); diff --git a/src/language.cpp b/src/language.cpp index b43d36a88b..0e1e7e9a0d 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -62,7 +62,7 @@ const char *Language::Translate(const char *string) const char *Language::Translate(User *u, const char *string) { - if (u && u->Account()) + if (u && u->IsIdentified()) return Translate(u->Account(), string); else return Translate("", string); diff --git a/src/memos.cpp b/src/memos.cpp index 141dcbb42c..891b09aff9 100644 --- a/src/memos.cpp +++ b/src/memos.cpp @@ -114,7 +114,7 @@ void MemoInfo::Del(unsigned index) bool MemoInfo::HasIgnore(User *u) { for (unsigned i = 0; i < this->ignores.size(); ++i) - if (u->nick.equals_ci(this->ignores[i]) || (u->Account() && u->Account()->display.equals_ci(this->ignores[i])) || Anope::Match(u->GetMask(), Anope::string(this->ignores[i]))) + if (u->nick.equals_ci(this->ignores[i]) || (u->IsIdentified() && u->Account()->display.equals_ci(this->ignores[i])) || Anope::Match(u->GetMask(), Anope::string(this->ignores[i]))) return true; return false; } diff --git a/src/tools/geoipupdate.sh b/src/tools/geoipupdate.sh index db6e61d8d8..fbc5213182 100755 --- a/src/tools/geoipupdate.sh +++ b/src/tools/geoipupdate.sh @@ -25,7 +25,7 @@ die="yes" # The GeoIP data is created by MaxMind, available from www.maxmind.com. geoip_country_source="https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip" -geoip_city_source="https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/GeoLiteCity-latest.zip" +geoip_city_source="https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/GeoLiteCity-latest.tar.xz" geoip_region_source="https://www.maxmind.com/download/geoip/misc/region_codes.csv" ########################### @@ -65,17 +65,17 @@ elif test $geoip_database = "city"; then download "$geoip_city_source" "City Database:" download "$geoip_region_source" "Region Database:" echo "Unpacking..." - unzip -jo GeoLiteCity-latest.zip - rm GeoLiteCity-latest.zip + tar -xf GeoLiteCity-latest.tar.xz --strip-components 1 + rm GeoLiteCity-latest.tar.xz echo "Converting to utf-8..." iconv -f ISO-8859-1 -t UTF-8 GeoLiteCity-Blocks.csv -o $prefix"geoip_city_blocks.csv" iconv -f ISO-8859-1 -t UTF-8 GeoLiteCity-Location.csv -o $prefix"geoip_city_location.csv" - iconv -f ISO-8859-1 -t UTF-8 region.csv -o $prefix"geoip_city_region.csv" - rm GeoLiteCity-Blocks.csv GeoLiteCity-Location.csv region.csv + iconv -f ISO-8859-1 -t UTF-8 region_codes.csv -o $prefix"geoip_city_region.csv" + rm GeoLiteCity-Blocks.csv GeoLiteCity-Location.csv region_codes.csv echo "Importing..." mysqlimport --columns=start,end,locID --ignore-lines=2 $PARAMS $prefix"geoip_city_blocks.csv" mysqlimport --columns=locID,country,region,city,@x,latitude,longitude,@x,areaCode --ignore-lines=2 $PARAMS $prefix"geoip_city_location.csv" mysqlimport --columns=country,region,regionname $PARAMS $prefix"geoip_city_region.csv" - rm $prefix"geoip_city_blocks.csv" $prefix"geoip_city_location.csv" $prefix"geoip_city_region.csv" $prefix"geoip_country6.csv" + rm $prefix"geoip_city_blocks.csv" $prefix"geoip_city_location.csv" $prefix"geoip_city_region.csv" echo "Done..." fi diff --git a/src/version.sh b/src/version.sh index 20062ac581..5be2b116dd 100644 --- a/src/version.sh +++ b/src/version.sh @@ -2,5 +2,5 @@ VERSION_MAJOR=2 VERSION_MINOR=0 -VERSION_PATCH=17 +VERSION_PATCH=18 VERSION_EXTRA="-git"