diff options
| author | 2022-07-22 18:33:38 +0100 | |
|---|---|---|
| committer | 2022-07-22 18:53:21 +0100 | |
| commit | 648f813f8c89e6e7d0ed5bda2c2149bee2babb09 (patch) | |
| tree | 5357669e57bb381c80bfdbd24ed4057a99db8e5b /src/modules | |
| parent | Update author list. (diff) | |
| download | inspircd++-648f813f8c89e6e7d0ed5bda2c2149bee2babb09.tar.gz inspircd++-648f813f8c89e6e7d0ed5bda2c2149bee2babb09.tar.bz2 inspircd++-648f813f8c89e6e7d0ed5bda2c2149bee2babb09.zip | |
Switch from NULL to nullptr.
Diffstat (limited to 'src/modules')
65 files changed, 169 insertions, 169 deletions
diff --git a/src/modules/extra/m_argon2.cpp b/src/modules/extra/m_argon2.cpp index 58e11eef0..d15fcf9bd 100644 --- a/src/modules/extra/m_argon2.cpp +++ b/src/modules/extra/m_argon2.cpp @@ -186,7 +186,7 @@ public: void ReadConfig(ConfigStatus& status) override { - ProviderConfig defaultConfig("argon2", NULL); + ProviderConfig defaultConfig("argon2", nullptr); argon2i.config = ProviderConfig("argon2i", &defaultConfig); argon2d.config = ProviderConfig("argon2d", &defaultConfig); argon2id.config = ProviderConfig("argon2id", &defaultConfig); diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp index 6a69d4a0e..80535c8d3 100644 --- a/src/modules/extra/m_geo_maxmind.cpp +++ b/src/modules/extra/m_geo_maxmind.cpp @@ -98,7 +98,7 @@ public: // Attempt to locate this user. location = GetLocation(user->client_sa); if (!location) - return NULL; + return nullptr; // We found the user. Cache their location for future use. ext.Set(user, location); @@ -109,19 +109,19 @@ public: { // Skip trying to look up a UNIX socket. if (sa.family() != AF_INET && sa.family() != AF_INET6) - return NULL; + return nullptr; // Attempt to look up the socket address. int result; MMDB_lookup_result_s lookup = MMDB_lookup_sockaddr(&mmdb, &sa.sa, &result); if (result != MMDB_SUCCESS || !lookup.found_entry) - return NULL; + return nullptr; // Attempt to retrieve the country code. MMDB_entry_data_s country_code; - result = MMDB_get_value(&lookup.entry, &country_code, "country", "iso_code", NULL); + result = MMDB_get_value(&lookup.entry, &country_code, "country", "iso_code", nullptr); if (result != MMDB_SUCCESS || !country_code.has_data || country_code.type != MMDB_DATA_TYPE_UTF8_STRING || country_code.data_size != 2) - return NULL; + return nullptr; // If the country has been seen before then use our cached Location object. const std::string code(country_code.utf8_string, country_code.data_size); @@ -131,9 +131,9 @@ public: // Attempt to retrieve the country name. MMDB_entry_data_s country_name; - result = MMDB_get_value(&lookup.entry, &country_name, "country", "names", "en", NULL); + result = MMDB_get_value(&lookup.entry, &country_name, "country", "names", "en", nullptr); if (result != MMDB_SUCCESS || !country_name.has_data || country_name.type != MMDB_DATA_TYPE_UTF8_STRING) - return NULL; + return nullptr; // Create a Location object and cache it. const std::string cname(country_name.utf8_string, country_name.data_size); diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index c1dfa40d9..ce327c3e8 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -79,7 +79,7 @@ public: virtual ~LDAPRequest() { delete result; - if (message != NULL) + if (message != nullptr) ldap_msgfree(message); } @@ -244,14 +244,14 @@ public: static void FreeMods(LDAPMod** mods) { - for (unsigned int i = 0; mods[i] != NULL; ++i) + for (unsigned int i = 0; mods[i] != nullptr; ++i) { LDAPMod* mod = mods[i]; - if (mod->mod_type != NULL) + if (mod->mod_type != nullptr) free(mod->mod_type); - if (mod->mod_values != NULL) + if (mod->mod_values != nullptr) { - for (unsigned int j = 0; mod->mod_values[j] != NULL; ++j) + for (unsigned int j = 0; mod->mod_values[j] != nullptr; ++j) free(mod->mod_values[j]); delete[] mod->mod_values; } @@ -267,7 +267,7 @@ private: throw LDAPException("Unable to connect to LDAP service " + this->name + ": reconnecting too fast"); last_connect = ServerInstance->Time(); - ldap_unbind_ext(this->con, NULL, NULL); + ldap_unbind_ext(this->con, nullptr, nullptr); Connect(); } @@ -276,8 +276,8 @@ private: int ret = ldap_set_option(this->con, option, value); if (ret != LDAP_OPT_SUCCESS) { - ldap_unbind_ext(this->con, NULL, NULL); - this->con = NULL; + ldap_unbind_ext(this->con, nullptr, nullptr); + this->con = nullptr; } return ret; } @@ -342,7 +342,7 @@ public: this->UnlockQueue(); - ldap_unbind_ext(this->con, NULL, NULL); + ldap_unbind_ext(this->con, nullptr, nullptr); } void Connect() @@ -433,14 +433,14 @@ private: LDAPAttributes attributes; char* dn = ldap_get_dn(this->con, cur); - if (dn != NULL) + if (dn != nullptr) { attributes["dn"].push_back(dn); ldap_memfree(dn); - dn = NULL; + dn = nullptr; } - BerElement* ber = NULL; + BerElement* ber = nullptr; for (char* attr = ldap_first_attribute(this->con, cur, &ber); attr; attr = ldap_next_attribute(this->con, cur, ber)) { @@ -455,7 +455,7 @@ private: ldap_value_free_len(vals); ldap_memfree(attr); } - if (ber != NULL) + if (ber != nullptr) ber_free(ber, 0); ldap_result->messages.push_back(attributes); @@ -656,7 +656,7 @@ int LDAPBind::run() cred.bv_val = strdup(pass.c_str()); cred.bv_len = pass.length(); - int i = ldap_sasl_bind_s(service->GetConnection(), who.c_str(), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL); + int i = ldap_sasl_bind_s(service->GetConnection(), who.c_str(), LDAP_SASL_SIMPLE, &cred, nullptr, nullptr, nullptr); free(cred.bv_val); @@ -670,7 +670,7 @@ std::string LDAPBind::info() int LDAPSearch::run() { - return ldap_search_ext_s(service->GetConnection(), base.c_str(), searchscope, filter.c_str(), NULL, 0, NULL, NULL, &tv, 0, &message); + return ldap_search_ext_s(service->GetConnection(), base.c_str(), searchscope, filter.c_str(), nullptr, 0, nullptr, nullptr, &tv, 0, &message); } std::string LDAPSearch::info() @@ -681,7 +681,7 @@ std::string LDAPSearch::info() int LDAPAdd::run() { LDAPMod** mods = LDAPService::BuildMods(attributes); - int i = ldap_add_ext_s(service->GetConnection(), dn.c_str(), mods, NULL, NULL); + int i = ldap_add_ext_s(service->GetConnection(), dn.c_str(), mods, nullptr, nullptr); LDAPService::FreeMods(mods); return i; } @@ -693,7 +693,7 @@ std::string LDAPAdd::info() int LDAPDel::run() { - return ldap_delete_ext_s(service->GetConnection(), dn.c_str(), NULL, NULL); + return ldap_delete_ext_s(service->GetConnection(), dn.c_str(), nullptr, nullptr); } std::string LDAPDel::info() @@ -704,7 +704,7 @@ std::string LDAPDel::info() int LDAPModify::run() { LDAPMod** mods = LDAPService::BuildMods(attributes); - int i = ldap_modify_ext_s(service->GetConnection(), base.c_str(), mods, NULL, NULL); + int i = ldap_modify_ext_s(service->GetConnection(), base.c_str(), mods, nullptr, nullptr); LDAPService::FreeMods(mods); return i; } @@ -720,7 +720,7 @@ int LDAPCompare::run() cred.bv_val = strdup(val.c_str()); cred.bv_len = val.length(); - int ret = ldap_compare_ext_s(service->GetConnection(), dn.c_str(), attr.c_str(), &cred, NULL, NULL); + int ret = ldap_compare_ext_s(service->GetConnection(), dn.c_str(), attr.c_str(), &cred, nullptr, nullptr); free(cred.bv_val); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 9e1406578..ead27295e 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -327,7 +327,7 @@ public: const std::string pass = config->getString("pass"); const std::string dbname = config->getString("name"); unsigned int port = static_cast<unsigned int>(config->getUInt("port", 3306, 1, 65535)); - if (!mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, NULL, CLIENT_IGNORE_SIGPIPE)) + if (!mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, nullptr, CLIENT_IGNORE_SIGPIPE)) { ServerInstance->Logs.Normal(MODNAME, "Unable to connect to the %s MySQL server: %s", GetId().c_str(), mysql_error(connection)); @@ -435,7 +435,7 @@ public: void ModuleSQL::init() { - if (mysql_library_init(0, NULL, NULL)) + if (mysql_library_init(0, nullptr, nullptr)) throw ModuleException(this, "Unable to initialise the MySQL library!"); Dispatcher = new DispatcherThread(this); diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 30d2690a6..f2e23d2e0 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -198,7 +198,7 @@ public: SQLConn(Module* Creator, std::shared_ptr<ConfigTag> tag) : SQL::Provider(Creator, tag->getString("id")) , conf(tag) - , qinprog(NULL, "") + , qinprog(nullptr, "") { if (!DoConnect()) DelayReconnect(); @@ -384,7 +384,7 @@ restart: } delete qinprog.c; - qinprog = QueueItem(NULL, ""); + qinprog = QueueItem(nullptr, ""); goto restart; } else @@ -520,7 +520,7 @@ restart: if(sql) { PQfinish(sql); - sql = NULL; + sql = nullptr; } } }; @@ -599,7 +599,7 @@ public: { conn->qinprog.c->OnError(err); delete conn->qinprog.c; - conn->qinprog.c = NULL; + conn->qinprog.c = nullptr; } std::deque<QueueItem>::iterator j = conn->queue.begin(); while (j != conn->queue.end()) @@ -620,7 +620,7 @@ public: bool ReconnectTimer::Tick() { - mod->retimer = NULL; + mod->retimer = nullptr; mod->ReadConf(); delete this; return false; diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index 377939867..819046e2b 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -47,7 +47,7 @@ public: return; // Retrieve the size of the error message and allocate a buffer. - size_t errorsize = regerror(error, ®ex, NULL, 0); + size_t errorsize = regerror(error, ®ex, nullptr, 0); std::vector<char> errormsg(errorsize); // Retrieve the error message and free the buffer. @@ -64,7 +64,7 @@ public: bool IsMatch(const std::string& text) override { - return !regexec(®ex, text.c_str(), 0, NULL, 0); + return !regexec(®ex, text.c_str(), 0, nullptr, 0); } std::optional<Regex::MatchCollection> Matches(const std::string& text) override diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index a388d3797..797f54a51 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -106,11 +106,11 @@ public: , config(tag) { std::string host = tag->getString("hostname"); - if (sqlite3_open_v2(host.c_str(), &conn, SQLITE_OPEN_READWRITE, 0) != SQLITE_OK) + if (sqlite3_open_v2(host.c_str(), &conn, SQLITE_OPEN_READWRITE, nullptr) != SQLITE_OK) { // Even in case of an error conn must be closed sqlite3_close(conn); - conn = NULL; + conn = nullptr; ServerInstance->Logs.Normal(MODNAME, "WARNING: Could not open DB with id: " + tag->getString("id")); } } @@ -128,7 +128,7 @@ public: { SQLite3Result res; sqlite3_stmt *stmt; - int err = sqlite3_prepare_v2(conn, q.c_str(), static_cast<int>(q.length()), &stmt, NULL); + int err = sqlite3_prepare_v2(conn, q.c_str(), static_cast<int>(q.length()), &stmt, nullptr); if (err != SQLITE_OK) { SQL::Error error(SQL::QSEND_FAIL, sqlite3_errmsg(conn)); diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 11ec78db0..b21ce982f 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -129,7 +129,7 @@ namespace GnuTLS gnutls_hash_hd_t is_digest; if (gnutls_hash_init(&is_digest, hash) < 0) throw Exception("Unknown hash type " + hashname); - gnutls_hash_deinit(is_digest, NULL); + gnutls_hash_deinit(is_digest, nullptr); } gnutls_digest_algorithm_t get() const { return hash; } @@ -311,7 +311,7 @@ namespace GnuTLS ret.append(token); gnutls_priority_t test; - if (gnutls_priority_init(&test, ret.c_str(), NULL) < 0) + if (gnutls_priority_init(&test, ret.c_str(), nullptr) < 0) { // The new token broke the priority string, revert to the previously working one ServerInstance->Logs.Debug(MODNAME, "Priority string token not recognized: \"%s\"", token.c_str()); @@ -441,7 +441,7 @@ namespace GnuTLS { // Copy data from GnuTLS buffers to recvq gnutls_datum_t datum; - gnutls_packet_get(packet, &datum, NULL); + gnutls_packet_get(packet, &datum, nullptr); recvq.append(reinterpret_cast<const char*>(datum.data), datum.size); gnutls_packet_deinit(packet); @@ -610,8 +610,8 @@ private: gnutls_bye(this->sess, GNUTLS_SHUT_WR); gnutls_deinit(this->sess); } - sess = NULL; - certificate = NULL; + sess = nullptr; + certificate = nullptr; status = STATUS_NONE; } @@ -1116,7 +1116,7 @@ public: void init() override { - ServerInstance->Logs.Normal(MODNAME, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(NULL)); + ServerInstance->Logs.Normal(MODNAME, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(nullptr)); ServerInstance->GenRandom = GnuTLS::GenRandom; } diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 67a5cac79..2b4b34bc5 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -106,7 +106,7 @@ namespace mbedTLS public: bool Seed(Entropy& entropy) { - return (mbedtls_ctr_drbg_seed(get(), mbedtls_entropy_func, entropy.get(), NULL, 0) == 0); + return (mbedtls_ctr_drbg_seed(get(), mbedtls_entropy_func, entropy.get(), nullptr, 0) == 0); } void SetupConf(mbedtls_ssl_config* conf) @@ -136,10 +136,10 @@ namespace mbedTLS { #if MBEDTLS_VERSION_MAJOR >= 3 int ret = mbedtls_pk_parse_key(get(), reinterpret_cast<const unsigned char*>(keystr.c_str()), - keystr.size() + 1, NULL, 0, mbedtls_ctr_drbg_random, 0); + keystr.size() + 1, nullptr, 0, mbedtls_ctr_drbg_random, 0); #else int ret = mbedtls_pk_parse_key(get(), reinterpret_cast<const unsigned char*>(keystr.c_str()), - keystr.size() + 1, NULL, 0); + keystr.size() + 1, nullptr, 0); #endif ThrowOnError(ret, "Unable to import private key"); } @@ -221,7 +221,7 @@ namespace mbedTLS ThrowOnError(ret, "Unable to load certificates"); } - bool empty() const { return (get()->raw.p != NULL); } + bool empty() const { return (get()->raw.p != nullptr); } }; class X509CRL final @@ -295,7 +295,7 @@ namespace mbedTLS mbedtls_ssl_config_init(&conf); #ifdef INSPIRCD_MBEDTLS_LIBRARY_DEBUG mbedtls_debug_set_threshold(INT_MAX); - mbedtls_ssl_conf_dbg(&conf, DebugLogFunc, NULL); + mbedtls_ssl_conf_dbg(&conf, DebugLogFunc, nullptr); #endif // TODO: check ret of mbedtls_ssl_config_defaults @@ -555,7 +555,7 @@ private: mbedtls_ssl_close_notify(&sess); mbedtls_ssl_free(&sess); - certificate = NULL; + certificate = nullptr; status = STATUS_NONE; } @@ -709,7 +709,7 @@ public: else GetProfile().SetupClientSession(&sess); - mbedtls_ssl_set_bio(&sess, reinterpret_cast<void*>(sock), Push, Pull, NULL); + mbedtls_ssl_set_bio(&sess, reinterpret_cast<void*>(sock), Push, Pull, nullptr); sock->AddIOHook(this); Handshake(sock); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 002411fa8..a7ad33aa4 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -64,7 +64,7 @@ static Module* thismod; char* get_error() { - return ERR_error_string(ERR_get_error(), NULL); + return ERR_error_string(ERR_get_error(), nullptr); } static int OnVerify(int preverify_ok, X509_STORE_CTX* ctx); @@ -94,7 +94,7 @@ namespace OpenSSL if (!dhpfile) throw Exception("Couldn't open DH file " + filename); - dh = PEM_read_bio_DHparams(dhpfile, NULL, NULL, NULL); + dh = PEM_read_bio_DHparams(dhpfile, nullptr, nullptr, nullptr); BIO_free(dhpfile); if (!dh) @@ -140,7 +140,7 @@ namespace OpenSSL mode |= SSL_MODE_RELEASE_BUFFERS; #endif SSL_CTX_set_mode(ctx, mode); - SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL); + SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, nullptr); SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); SSL_CTX_set_info_callback(ctx, StaticSSLInfoCallback); } @@ -200,7 +200,7 @@ namespace OpenSSL bool SetCA(const std::string& filename) { ERR_clear_error(); - return SSL_CTX_load_verify_locations(ctx, filename.c_str(), 0); + return SSL_CTX_load_verify_locations(ctx, filename.c_str(), nullptr); } void SetCRL(const std::string& crlfile, const std::string& crlpath, const std::string& crlmode) @@ -227,11 +227,11 @@ namespace OpenSSL } ERR_clear_error(); if (!X509_STORE_load_locations(store, - crlfile.empty() ? NULL : crlfile.c_str(), - crlpath.empty() ? NULL : crlpath.c_str())) + crlfile.empty() ? nullptr : crlfile.c_str(), + crlpath.empty() ? nullptr : crlpath.c_str())) { unsigned long err = ERR_get_error(); - throw ModuleException(thismod, "Unable to load CRL file '" + crlfile + "' or CRL path '" + crlpath + "': '" + (err ? ERR_error_string(err, NULL) : "unknown") + "'"); + throw ModuleException(thismod, "Unable to load CRL file '" + crlfile + "' or CRL path '" + crlpath + "': '" + (err ? ERR_error_string(err, nullptr) : "unknown") + "'"); } /* Set CRL mode */ @@ -562,8 +562,8 @@ private: SSL_shutdown(sess); SSL_free(sess); } - sess = NULL; - certificate = NULL; + sess = nullptr; + certificate = nullptr; status = STATUS_NONE; } @@ -978,7 +978,7 @@ public: : Module(VF_VENDOR, "Allows TLS encrypted connections using the OpenSSL library.") { // Initialize OpenSSL - OPENSSL_init_ssl(0, NULL); + OPENSSL_init_ssl(0, nullptr); biomethods = OpenSSL::BIOMethod::alloc(); thismod = this; @@ -995,7 +995,7 @@ public: // Register application specific data char exdatastr[] = "inspircd"; - exdataindex = SSL_get_ex_new_index(0, exdatastr, NULL, NULL, NULL); + exdataindex = SSL_get_ex_new_index(0, exdatastr, nullptr, nullptr, nullptr); if (exdataindex < 0) throw ModuleException(this, "Failed to register application specific data"); } diff --git a/src/modules/extra/m_sslrehashsignal.cpp b/src/modules/extra/m_sslrehashsignal.cpp index 41b90d6df..e8abe7a1d 100644 --- a/src/modules/extra/m_sslrehashsignal.cpp +++ b/src/modules/extra/m_sslrehashsignal.cpp @@ -57,7 +57,7 @@ public: ServerInstance->Logs.Normal(MODNAME, feedbackmsg); const std::string str = "tls"; - FOREACH_MOD(OnModuleRehash, (NULL, str)); + FOREACH_MOD(OnModuleRehash, (nullptr, str)); signaled = 0; } }; diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 70b302f6e..621fa4f04 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -181,7 +181,7 @@ public: { if (alias.UserCommand) { - if (DoAlias(user, NULL, alias, compare, original_line)) + if (DoAlias(user, nullptr, alias, compare, original_line)) { return MOD_RES_DENY; } diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index c7bd7039c..dca983b3e 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -48,7 +48,7 @@ public: return ServerInstance->Modes.FindPrefixMode(mid[0]); ModeHandler* mh = ServerInstance->Modes.FindMode(mid, MODETYPE_CHANNEL); - return mh ? mh->IsPrefixMode() : NULL; + return mh ? mh->IsPrefixMode() : nullptr; } ModResult AccessCheck(User* source, Channel* channel, Modes::Change& change) override @@ -117,7 +117,7 @@ public: changelist.push_add(given, memb->user->nick); } } - ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, NULL, changelist); + ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, nullptr, changelist); } } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 1926bf464..02db49a89 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -282,7 +282,7 @@ public: for (const auto& redirect : *redirects) changelist.push_add(*banwatcher.banmode, redirect.banmask); - ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, NULL, changelist, ModeParser::MODE_LOCALONLY); + ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, nullptr, changelist, ModeParser::MODE_LOCALONLY); } } } diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 60cfba367..cb51f458d 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -102,7 +102,7 @@ struct CallerIDExtInfo final void* old = GetRaw(container); if (old) - this->Delete(NULL, old); + this->Delete(nullptr, old); callerid_data* dat = new callerid_data; SetRaw(container, dat); @@ -164,7 +164,7 @@ class CommandAccept final */ typedef std::pair<User*, bool> ACCEPTAction; - static ACCEPTAction GetTargetAndAction(std::string& tok, User* cmdfrom = NULL) + static ACCEPTAction GetTargetAndAction(std::string& tok, User* cmdfrom = nullptr) { bool remove = (tok[0] == '-'); if ((remove) || (tok[0] == '+')) @@ -177,7 +177,7 @@ class CommandAccept final target = ServerInstance->Users.FindNick(tok); if ((!target) || (target->registered != REG_ALL) || (target->quitting)) - target = NULL; + target = nullptr; return std::make_pair(target, !remove); } diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 06522b315..b4ba0d7ce 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -199,7 +199,7 @@ public: CapMap::const_iterator it = caps.find(capname); if (it != caps.end()) return it->second; - return NULL; + return nullptr; } void NotifyValueChange(Capability* cap) override diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 36e0ade78..fe4176766 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -73,17 +73,17 @@ class ModuleChanFilter final const ChanFilter::ListItem* Match(User* user, Channel* chan, const std::string& text) { if (!IS_LOCAL(user)) - return NULL; // We don't handle remote users. + return nullptr; // We don't handle remote users. if (user->HasPrivPermission("channels/ignore-chanfilter")) - return NULL; // The source is an exempt server operator. + return nullptr; // The source is an exempt server operator. if (CheckExemption::Call(exemptionprov, user, chan, "filter") == MOD_RES_ALLOW) - return NULL; // The source matches an exemptchanops entry. + return nullptr; // The source matches an exemptchanops entry. ListModeBase::ModeList* list = cf.GetList(chan); if (!list) - return NULL; + return nullptr; for (const auto& entry : *list) { @@ -91,7 +91,7 @@ class ModuleChanFilter final return &entry; } - return NULL; + return nullptr; } public: diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index 931af03b9..7e88ee38a 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -79,7 +79,7 @@ public: { removepermchan.clear(); removepermchan.push_remove(*permchannelmode); - ServerInstance->Modes.Process(ServerInstance->FakeClient, c, NULL, removepermchan); + ServerInstance->Modes.Process(ServerInstance->FakeClient, c, nullptr, removepermchan); } Channel::MemberMap& users = c->userlist; diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp index d3a646a3c..0718d8f0d 100644 --- a/src/modules/m_clearchan.cpp +++ b/src/modules/m_clearchan.cpp @@ -55,7 +55,7 @@ public: std::transform(method.begin(), method.end(), method.begin(), ::toupper); } - XLineFactory* xlf = NULL; + XLineFactory* xlf = nullptr; bool kick = (method == "KICK"); if ((!kick) && (method != "KILL")) { diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 5271d5305..db7bd2e29 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -411,7 +411,7 @@ public: Modes::ChangeList modechangelist; modechangelist.push_remove(&cu); - ClientProtocol::Events::Mode modeevent(ServerInstance->FakeClient, NULL, u, modechangelist); + ClientProtocol::Events::Mode modeevent(ServerInstance->FakeClient, nullptr, u, modechangelist); luser->Send(modeevent); } cu.active = false; diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index e074c9cc7..645345a82 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -148,7 +148,7 @@ public: { // Create Z-line for set duration. ZLine* zl = new ZLine(ServerInstance->Time(), banduration, MODNAME "@" + ServerInstance->Config->ServerName, banmessage, mask.str()); - if (!ServerInstance->XLines->AddLine(zl, NULL)) + if (!ServerInstance->XLines->AddLine(zl, nullptr)) { delete zl; return; diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 52da3b51f..a1babeccb 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -168,7 +168,7 @@ public: // If there is no redirect chan, the user has enabled the antiredirect mode, or // the target channel redirects elsewhere we just tell the user and deny the join. - Channel* target = NULL; + Channel* target = nullptr; if (badchan.redirect.empty() || user->IsModeSet(antiredirectmode) || ((target = ServerInstance->Channels.Find(badchan.redirect)) && target->IsModeSet(redirectmode))) { diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index eaa768308..7ea17e4f1 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -48,7 +48,7 @@ public: return ServerInstance->Modes.FindPrefixMode(pmode[0]); ModeHandler* mh = ServerInstance->Modes.FindMode(pmode, MODETYPE_CHANNEL); - return mh ? mh->IsPrefixMode() : NULL; + return mh ? mh->IsPrefixMode() : nullptr; } static bool ParseEntry(const std::string& entry, std::string& restriction, std::string& prefix) diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 544ef99d8..51c13c07a 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -470,7 +470,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar user->nick.c_str(), sh->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str())); - if (ServerInstance->XLines->AddLine(sh, NULL)) + if (ServerInstance->XLines->AddLine(sh, nullptr)) { ServerInstance->XLines->ApplyLines(); } @@ -484,7 +484,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar user->nick.c_str(), gl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str())); - if (ServerInstance->XLines->AddLine(gl,NULL)) + if (ServerInstance->XLines->AddLine(gl, nullptr)) { ServerInstance->XLines->ApplyLines(); } @@ -498,7 +498,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar user->nick.c_str(), zl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str())); - if (ServerInstance->XLines->AddLine(zl,NULL)) + if (ServerInstance->XLines->AddLine(zl, nullptr)) { ServerInstance->XLines->ApplyLines(); } @@ -577,7 +577,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), command.c_str(), f->freeform.c_str(), f->reason.c_str())); - if (ServerInstance->XLines->AddLine(gl,NULL)) + if (ServerInstance->XLines->AddLine(gl, nullptr)) { ServerInstance->XLines->ApplyLines(); } @@ -593,7 +593,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), command.c_str(), f->freeform.c_str(), f->reason.c_str())); - if (ServerInstance->XLines->AddLine(zl,NULL)) + if (ServerInstance->XLines->AddLine(zl, nullptr)) { ServerInstance->XLines->ApplyLines(); } @@ -610,7 +610,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), command.c_str(), f->freeform.c_str(), f->reason.c_str())); - if (ServerInstance->XLines->AddLine(sh, NULL)) + if (ServerInstance->XLines->AddLine(sh, nullptr)) { ServerInstance->XLines->ApplyLines(); } @@ -649,7 +649,7 @@ void ModuleFilter::ReadConfig(ConfigStatus& status) filterconf = ServerInstance->Config->Paths.PrependConfig(filterconf); SetInterval(tag->getDuration("saveperiod", 5)); - factory = RegexEngine ? (RegexEngine.operator->()) : NULL; + factory = RegexEngine ? (RegexEngine.operator->()) : nullptr; RegexEngine.SetEngine(newrxengine); if (!RegexEngine) @@ -776,7 +776,7 @@ const FilterResult* ModuleFilter::FilterMatch(User* user, const std::string &tex if (filter.regex->IsMatch(filter.flag_strip_color ? stripped_text : text)) return &filter; } - return NULL; + return nullptr; } bool ModuleFilter::DeleteFilter(const std::string& freeform, std::string& reason) diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp index 15e827507..448caefc1 100644 --- a/src/modules/m_gateway.cpp +++ b/src/modules/m_gateway.cpp @@ -170,7 +170,7 @@ public: static bool ParseIP(const std::string& in, irc::sockets::sockaddrs& out) { - const char* ident = NULL; + const char* ident = nullptr; if (in.length() == 8) { // The ident is an IPv4 address encoded in hexadecimal with two characters @@ -195,7 +195,7 @@ public: // Try to convert the IP address to a string. If this fails then the user // does not have an IPv4 address in their ident. errno = 0; - unsigned long address = strtoul(ident, NULL, 16); + unsigned long address = strtoul(ident, nullptr, 16); if (errno) return false; diff --git a/src/modules/m_geoban.cpp b/src/modules/m_geoban.cpp index ecd8fe8e0..caaf038f6 100644 --- a/src/modules/m_geoban.cpp +++ b/src/modules/m_geoban.cpp @@ -39,7 +39,7 @@ public: bool IsMatch(User* user, Channel* channel, const std::string& text) override { - Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : NULL; + Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr; const std::string code = location ? location->GetCode() : "XX"; // Does this user match against the ban? @@ -71,7 +71,7 @@ public: if (!request.flags['G']) return MOD_RES_PASSTHRU; - Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : NULL; + Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr; const std::string code = location ? location->GetCode() : "XX"; return InspIRCd::Match(code, request.matchtext, ascii_case_insensitive_map) ? MOD_RES_ALLOW : MOD_RES_DENY; } @@ -81,7 +81,7 @@ public: if (whois.GetTarget()->server->IsService()) return; - Geolocation::Location* location = geoapi ? geoapi->GetLocation(whois.GetTarget()) : NULL; + Geolocation::Location* location = geoapi ? geoapi->GetLocation(whois.GetTarget()) : nullptr; if (location) whois.SendLine(RPL_WHOISCOUNTRY, location->GetCode(), "is connecting from " + location->GetName()); else diff --git a/src/modules/m_geoclass.cpp b/src/modules/m_geoclass.cpp index 4a0e53830..f381c57c4 100644 --- a/src/modules/m_geoclass.cpp +++ b/src/modules/m_geoclass.cpp @@ -44,7 +44,7 @@ public: // If we can't find the location of this user then we can't assign // them to a location-specific connect class. - Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : NULL; + Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr; const std::string code = location ? location->GetCode() : "XX"; irc::spacesepstream codes(country); diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp index dcb1d4afd..8d6127d35 100644 --- a/src/modules/m_hidemode.cpp +++ b/src/modules/m_hidemode.cpp @@ -85,7 +85,7 @@ class ModeHook final Modes::ChangeList* FilterModeChangeList(const ClientProtocol::Events::Mode& mode, ModeHandler::Rank rank) { - Modes::ChangeList* modechangelist = NULL; + Modes::ChangeList* modechangelist = nullptr; for (Modes::ChangeList::List::const_iterator i = mode.GetChangeList().getlist().begin(); i != mode.GetChangeList().getlist().end(); ++i) { const Modes::Change& curr = *i; @@ -156,14 +156,14 @@ class ModeHook final if (filteredchangelist->empty()) { // This rank cannot see any mode changes in the original change list - finalmsgplist = NULL; + finalmsgplist = nullptr; } else { // This rank can see some of the mode changes in the filtered mode change list. // Create and store a new protocol message from it. filteredmsgplists.emplace_back(); - ClientProtocol::Events::Mode::BuildMessages(mode.GetMessages().front().GetSourceUser(), chan, NULL, *filteredchangelist, filteredmodelist, filteredmsgplists.back()); + ClientProtocol::Events::Mode::BuildMessages(mode.GetMessages().front().GetSourceUser(), chan, nullptr, *filteredchangelist, filteredmodelist, filteredmsgplists.back()); finalmsgplist = &filteredmsgplists.back(); } } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 5b34a0ada..d0a6ae46f 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -250,7 +250,7 @@ public: Close(); } - void SendHTTPError(unsigned int response, const char* errstr = NULL) + void SendHTTPError(unsigned int response, const char* errstr = nullptr) { if (!errstr) errstr = http_status_str((http_status)response); diff --git a/src/modules/m_ircv3_batch.cpp b/src/modules/m_ircv3_batch.cpp index 7d81c60a5..065a543a4 100644 --- a/src/modules/m_ircv3_batch.cpp +++ b/src/modules/m_ircv3_batch.cpp @@ -163,7 +163,7 @@ public: return; // Mark batch as stopped - batch.manager = NULL; + batch.manager = nullptr; BatchInfo& batchinfo = *batch.batchinfo; // Send end batch message to all users who got the batch start message and unset bit so it can be reused @@ -176,7 +176,7 @@ public: // erase() not swaperase because the reftag generation logic depends on the order of the elements stdalgo::erase(active_batches, &batch); delete batch.batchinfo; - batch.batchinfo = NULL; + batch.batchinfo = nullptr; } }; diff --git a/src/modules/m_ircv3_capnotify.cpp b/src/modules/m_ircv3_capnotify.cpp index 4e2cf1863..9a06189fa 100644 --- a/src/modules/m_ircv3_capnotify.cpp +++ b/src/modules/m_ircv3_capnotify.cpp @@ -164,7 +164,7 @@ public: return; reloadedmod = mod->ModuleSourceFile; // Request callback when reload is complete - cd.add(this, NULL); + cd.add(this, nullptr); } void OnReloadModuleRestore(Module* mod, void* data) override @@ -178,7 +178,7 @@ public: for (const auto& capname : reloadedcaps) { if (!capmanager->Find(capname)) - Send(capname, NULL, false); + Send(capname, nullptr, false); } } reloadedmod.clear(); diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index 89efea12d..96295ed6a 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -163,7 +163,7 @@ private: // The target is a user on a specific server (e.g. jto@tolsun.oulu.fi). target = ServerInstance->Users.FindNick(parameters[0].substr(0, targetserver - parameters[0].c_str())); if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1)) - target = NULL; + target = nullptr; } else { @@ -240,7 +240,7 @@ public: // If the message begins with one or more status characters then look them up. const char* target = parameters[0].c_str(); - PrefixMode* targetpfx = NULL; + PrefixMode* targetpfx = nullptr; for (PrefixMode* pfx; (pfx = ServerInstance->Modes.FindPrefix(target[0])); ++target) { // We want the lowest ranked prefix specified. diff --git a/src/modules/m_ircv3_labeledresponse.cpp b/src/modules/m_ircv3_labeledresponse.cpp index d4cbbbffe..c90154371 100644 --- a/src/modules/m_ircv3_labeledresponse.cpp +++ b/src/modules/m_ircv3_labeledresponse.cpp @@ -171,7 +171,7 @@ public: } } - tag.labeluser = NULL; + tag.labeluser = nullptr; msgcount = 0; } diff --git a/src/modules/m_monitor.cpp b/src/modules/m_monitor.cpp index d52033dd0..def2c6f5e 100644 --- a/src/modules/m_monitor.cpp +++ b/src/modules/m_monitor.cpp @@ -178,7 +178,7 @@ public: Entry* entry = Find(nick); if (entry) return &entry->watchers; - return NULL; + return nullptr; } static User* FindNick(const std::string& nick) @@ -186,7 +186,7 @@ public: User* user = ServerInstance->Users.FindNick(nick); if ((user) && (user->registered == REG_ALL)) return user; - return NULL; + return nullptr; } private: @@ -197,7 +197,7 @@ private: NickHash::iterator it = nicks.find(nick); if (it != nicks.end()) return &it->second; - return NULL; + return nullptr; } Entry* AddWatcher(const std::string& nick, LocalUser* user) @@ -235,7 +235,7 @@ private: { ExtData* extdata = ext.Get(user, create); if (!extdata) - return NULL; + return nullptr; return &extdata->list; } diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index 99c911fdc..f28a57747 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -104,7 +104,7 @@ public: modes.push(mh, plus); } } - ServerInstance->Modes.ProcessSingle(src, chan, NULL, modes, ModeParser::MODE_CHECKACCESS); + ServerInstance->Modes.ProcessSingle(src, chan, nullptr, modes, ModeParser::MODE_CHECKACCESS); return CmdResult::SUCCESS; } }; diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 7b28bff3f..12b0b306e 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -76,7 +76,7 @@ public: changelist.push_add(npmh, user->nick); if (op && opmode) changelist.push_add(*opmode, user->nick); - ServerInstance->Modes.Process(ServerInstance->FakeClient, channel, NULL, changelist); + ServerInstance->Modes.Process(ServerInstance->FakeClient, channel, nullptr, changelist); } return CmdResult::SUCCESS; } diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index bc8236798..405f0bce0 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -93,7 +93,7 @@ public: // The user was force joined and OnUserPreJoin() did not run. Set the operprefix now. Modes::ChangeList changelist; changelist.push_add(&opm, memb->user->nick); - ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, NULL, changelist); + ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, nullptr, changelist); } void SetOperPrefix(User* user, bool add) @@ -101,7 +101,7 @@ public: Modes::ChangeList changelist; changelist.push(&opm, add, user->nick); for (const auto* memb : user->chans) - ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, NULL, changelist); + ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, nullptr, changelist); } void OnPostOper(User* user) override diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index d7f9002a1..517183e1a 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -57,7 +57,7 @@ public: std::string salt = ServerInstance->GenRandomStr(hp->out_size, false); std::string target = hp->hmac(salt, parameters[1]); - std::string str = Base64::Encode(salt) + "$" + Base64::Encode(target, NULL, 0); + std::string str = Base64::Encode(salt) + "$" + Base64::Encode(target, nullptr, 0); user->WriteNotice(parameters[0] + " hashed password for " + parameters[1] + " is " + str); return CmdResult::SUCCESS; diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 0095d6696..daf59ff7e 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -69,7 +69,7 @@ public: if (ZlineOnMatch) { ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, MODNAME "@" + ServerInstance->Config->ServerName, reason.c_str(), u->GetIPString()); - if (ServerInstance->XLines->AddLine(zl, NULL)) + if (ServerInstance->XLines->AddLine(zl, nullptr)) { if (!duration) { @@ -157,7 +157,7 @@ public: user->WriteNotice("*** Invalid duration for R-line."); return CmdResult::FAILURE; } - XLine *r = NULL; + XLine *r = nullptr; try { @@ -273,7 +273,7 @@ public: ZlineOnMatch = tag->getBool("zlineonmatch"); std::string newrxengine = tag->getString("engine"); - factory = rxfactory ? (rxfactory.operator->()) : NULL; + factory = rxfactory ? (rxfactory.operator->()) : nullptr; rxfactory.SetEngine(newrxengine); if (!rxfactory) diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp index b084eab54..78d9ff4e2 100644 --- a/src/modules/m_rmode.cpp +++ b/src/modules/m_rmode.cpp @@ -76,7 +76,7 @@ public: changelist.push_remove(mh, u->nick); } } - else if ((lm = mh->IsListModeBase()) && ((ml = lm->GetList(chan)) != NULL)) + else if ((lm = mh->IsListModeBase()) && ((ml = lm->GetList(chan)) != nullptr)) { for (const auto& entry : *ml) { @@ -90,7 +90,7 @@ public: changelist.push_remove(mh); } - ServerInstance->Modes.Process(user, chan, NULL, changelist); + ServerInstance->Modes.Process(user, chan, nullptr, changelist); return CmdResult::SUCCESS; } }; diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 4172f9470..fd2ecb37f 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -64,7 +64,7 @@ public: // XXX: Make ModeParser clear LastParse Modes::ChangeList emptychangelist; - ServerInstance->Modes.ProcessSingle(ServerInstance->FakeClient, NULL, ServerInstance->FakeClient, emptychangelist); + ServerInstance->Modes.ProcessSingle(ServerInstance->FakeClient, nullptr, ServerInstance->FakeClient, emptychangelist); logged = false; this->active = true; diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 233524c01..a52a784d3 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -53,7 +53,7 @@ public: return CmdResult::SUCCESS; } - target->SetTopic(user, newTopic, ServerInstance->Time(), NULL); + target->SetTopic(user, newTopic, ServerInstance->Time(), nullptr); ServerInstance->SNO.WriteGlobalSno('a', user->nick + " used SATOPIC on " + target->name + ", new topic: " + newTopic); return CmdResult::SUCCESS; diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index 40c8bb80f..d3f12850b 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -42,7 +42,7 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params) return CmdResult::FAILURE; } - XLine* xl = NULL; + XLine* xl = nullptr; try { xl = xlf->Generate(ServerInstance->Time(), ConvToNum<unsigned long>(params[4]), params[2], params[5], params[1]); @@ -53,7 +53,7 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params) return CmdResult::FAILURE; } xl->SetCreateTime(ServerCommand::ExtractTS(params[3])); - if (ServerInstance->XLines->AddLine(xl, NULL)) + if (ServerInstance->XLines->AddLine(xl, nullptr)) { if (xl->duration) { diff --git a/src/modules/m_spanningtree/encap.cpp b/src/modules/m_spanningtree/encap.cpp index 00cde72fa..4e4524789 100644 --- a/src/modules/m_spanningtree/encap.cpp +++ b/src/modules/m_spanningtree/encap.cpp @@ -43,7 +43,7 @@ CmdResult CommandEncap::Handle(User* user, Params& params) return CmdResult::SUCCESS; } - Command* cmd = NULL; + Command* cmd = nullptr; ServerInstance->Parser.CallHandler(params[1], plist, user, &cmd); // Discard return value, ENCAP shall succeed even if the command does not exist diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index e5470d9c2..46de08382 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -166,7 +166,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params) if (apply_other_sides_modes) { ServerInstance->Modes.ModeParamsToChangeList(srcuser, MODETYPE_CHANNEL, params, modechangelist, 2, params.size() - 1); - ServerInstance->Modes.Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE); + ServerInstance->Modes.Process(srcuser, chan, nullptr, modechangelist, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE); // Reuse for prefix modes modechangelist.clear(); } @@ -178,7 +178,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params) // Process every member in the message irc::spacesepstream users(params.back()); std::string item; - Modes::ChangeList* modechangelistptr = (apply_other_sides_modes ? &modechangelist : NULL); + Modes::ChangeList* modechangelistptr = (apply_other_sides_modes ? &modechangelist : nullptr); while (users.GetToken(item)) { ProcessModeUUIDPair(item, sourceserver, chan, modechangelistptr, fwdfjoin); @@ -189,7 +189,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params) // Set prefix modes on their users if we lost the FJOIN or had equal TS if (apply_other_sides_modes) - ServerInstance->Modes.Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY); + ServerInstance->Modes.Process(srcuser, chan, nullptr, modechangelist, ModeParser::MODE_LOCALONLY); return CmdResult::SUCCESS; } @@ -233,7 +233,7 @@ void CommandFJoin::ProcessModeUUIDPair(const std::string& item, TreeServer* sour } } - Membership* memb = chan->ForceJoin(who, NULL, sourceserver->IsBursting()); + Membership* memb = chan->ForceJoin(who, nullptr, sourceserver->IsBursting()); if (!memb) { // User was already on the channel, forward because of the modes they potentially got @@ -264,7 +264,7 @@ void CommandFJoin::RemoveStatus(Channel* c) mh->RemoveMode(c, changelist); } - ServerInstance->Modes.Process(ServerInstance->FakeClient, c, NULL, changelist, ModeParser::MODE_LOCALONLY); + ServerInstance->Modes.Process(ServerInstance->FakeClient, c, nullptr, changelist, ModeParser::MODE_LOCALONLY); } void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname) diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index e59812efa..789342207 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -54,7 +54,7 @@ CmdResult CommandFMode::Handle(User* who, Params& params) if ((TS == ourTS) && IS_SERVER(who)) flags |= ModeParser::MODE_MERGE; - ServerInstance->Modes.Process(who, chan, NULL, changelist, flags); + ServerInstance->Modes.Process(who, chan, nullptr, changelist, flags); return CmdResult::SUCCESS; } @@ -97,6 +97,6 @@ CmdResult CommandLMode::Handle(User* who, Params& params) if (chants == chan->age && IS_SERVER(who)) flags |= ModeParser::MODE_MERGE; - ServerInstance->Modes.Process(who, chan, NULL, changelist, flags); + ServerInstance->Modes.Process(who, chan, nullptr, changelist, flags); return CmdResult::SUCCESS; } diff --git a/src/modules/m_spanningtree/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp index 1e756b115..625f0bdfc 100644 --- a/src/modules/m_spanningtree/ijoin.cpp +++ b/src/modules/m_spanningtree/ijoin.cpp @@ -49,7 +49,7 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, Params& params) apply_modes = false; // Join the user and set the membership id to what they sent - Membership* memb = chan->ForceJoin(user, apply_modes ? ¶ms[3] : NULL); + Membership* memb = chan->ForceJoin(user, apply_modes ? ¶ms[3] : nullptr); if (!memb) return CmdResult::FAILURE; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index b2fa9c2d8..ad45a2746 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -532,7 +532,7 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by params.add(memb); params.finalize(); params.Broadcast(); - Utils->SendListLimits(memb->chan, NULL); + Utils->SendListLimits(memb->chan, nullptr); } else { @@ -659,7 +659,7 @@ void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter) { CmdBuilder params(user ? user : ServerInstance->FakeClient, "REHASH"); params.push(parameter); - params.Forward(user ? TreeServer::Get(user)->GetRoute() : NULL); + params.Forward(user ? TreeServer::Get(user)->GetRoute() : nullptr); } } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index d4edfebef..abbb21efd 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -154,7 +154,7 @@ public: /** Connect a server locally */ - void ConnectServer(std::shared_ptr<Link> x, std::shared_ptr<Autoconnect> y = NULL); + void ConnectServer(std::shared_ptr<Link> x, std::shared_ptr<Autoconnect> y = nullptr); /** Connect the next autoconnect server */ diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index 2119fae3e..bf7f47aa9 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -31,7 +31,7 @@ CmdResult CommandMetadata::Handle(User* srcuser, Params& params) if (params[0] == "*") { std::string value = params.size() < 3 ? "" : params[2]; - FOREACH_MOD(OnDecodeMetaData, (NULL,params[1],value)); + FOREACH_MOD(OnDecodeMetaData, (nullptr, params[1], value)); return CmdResult::SUCCESS; } diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 4769d8a94..fe0857bd7 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -30,7 +30,7 @@ void ModuleSpanningTree::OnPostCommand(Command* command, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, bool loop) { if (result == CmdResult::SUCCESS) - Utils->RouteCommand(NULL, command, parameters, user); + Utils->RouteCommand(nullptr, command, parameters, user); } void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscmd, const CommandBase::Params& parameters, User* user) @@ -105,7 +105,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm std::string message; if (parameters.size() >= 2) message.assign(parameters[1]); - SendChannelMessage(user, c, message, pfx, parameters.GetTags(), exempts, command.c_str(), origin ? origin->GetSocket() : NULL); + SendChannelMessage(user, c, message, pfx, parameters.GetTags(), exempts, command.c_str(), origin ? origin->GetSocket() : nullptr); } else if (dest[0] == '$') { diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index 6674b67b0..d8369089d 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -83,7 +83,7 @@ void SpanningTreeProtocolInterface::BroadcastEncap(const std::string& cmd, const // If omit is non-NULL we pass the route belonging to the user to Forward(), // otherwise we pass NULL, which is equivalent to Broadcast() - TreeServer* server = (omit ? TreeServer::Get(omit)->GetRoute() : NULL); + TreeServer* server = (omit ? TreeServer::Get(omit)->GetRoute() : nullptr); CmdBuilder(source, "ENCAP * ").push_raw(cmd).insert(params).Forward(server); } diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index d8b0edc02..535299e72 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -101,7 +101,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) if (params.size() < 5) { SendError("Protocol error - Not enough parameters for SERVER command"); - return NULL; + return nullptr; } const std::string& sname = params[0]; @@ -114,7 +114,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) if (!ServerInstance->IsSID(sid)) { this->SendError("Invalid format server ID: "+sid+"!"); - return NULL; + return nullptr; } for (std::shared_ptr<Link> x : Utils->LinkBlocks) @@ -129,7 +129,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) } if (!CheckDuplicate(sname, sid)) - return NULL; + return nullptr; const SSLIOHook* const ssliohook = SSLIOHook::IsSSL(this); if (ssliohook) @@ -141,7 +141,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) else if (capab->remotesa.family() != AF_UNIX && !irc::sockets::cidr_mask("127.0.0.0/8").match(capab->remotesa) && !irc::sockets::cidr_mask("::1/128").match(capab->remotesa)) { this->SendError("Non-local server connections MUST be linked with SSL!"); - return NULL; + return nullptr; } ServerInstance->SNO.WriteToSnoMask('l', "Verified server connection " + linkID + " ("+description+")"); @@ -150,7 +150,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) this->SendError("Mismatched server name or password (check the other server's snomask output for details - e.g. user mode +s +Ll)"); ServerInstance->SNO.WriteToSnoMask('l', "Server connection from \002"+sname+"\002 denied, invalid link credentials"); - return NULL; + return nullptr; } /* diff --git a/src/modules/m_spanningtree/servercommand.cpp b/src/modules/m_spanningtree/servercommand.cpp index b4ce6775c..68f21a4aa 100644 --- a/src/modules/m_spanningtree/servercommand.cpp +++ b/src/modules/m_spanningtree/servercommand.cpp @@ -52,7 +52,7 @@ ServerCommand* ServerCommandManager::GetHandler(const std::string& command) cons ServerCommandMap::const_iterator it = commands.find(command); if (it != commands.end()) return it->second; - return NULL; + return nullptr; } bool ServerCommandManager::AddCommand(ServerCommand* cmd) diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index c55021e64..dabf064e6 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -37,8 +37,8 @@ */ TreeServer::TreeServer() : Server(ServerInstance->Config->GetSID(), ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc) - , Parent(NULL), Route(NULL) - , Socket(NULL) + , Parent(nullptr), Route(nullptr) + , Socket(nullptr) , behind_bursting(0) , pingtimer(this) , ServerUser(ServerInstance->FakeClient) diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 27e96d50e..85e5de440 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -117,7 +117,7 @@ class TreeSocket final std::unique_ptr<CapabData> capab; /* Link setup data (held until burst is sent) */ /* The server we are talking to */ - TreeServer* MyRoot = NULL; + TreeServer* MyRoot = nullptr; /** Checks if the given servername and sid are both free */ diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 0f6cb5d33..bb5633988 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -272,7 +272,7 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma } // Unknown prefix - return NULL; + return nullptr; } void TreeSocket::ProcessTag(User* source, const std::string& tag, ClientProtocol::TagMap& tags) @@ -337,7 +337,7 @@ void TreeSocket::ProcessConnectedLine(std::string& taglist, std::string& prefix, ServerCommand* scmd = Utils->Creator->CmdManager.GetHandler(command); CommandBase* cmdbase = scmd; - Command* cmd = NULL; + Command* cmd = nullptr; if (!scmd) { // Not a special server-to-server command diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 1205880b2..7cf345dfd 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -112,12 +112,12 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params * yourself. */ Modes::Change modechange(mh, true, params[paramptr++]); - mh->OnModeChange(_new, _new, NULL, modechange); + mh->OnModeChange(_new, _new, nullptr, modechange); } else { Modes::Change modechange(mh, true, ""); - mh->OnModeChange(_new, _new, NULL, modechange); + mh->OnModeChange(_new, _new, nullptr, modechange); } _new->SetMode(mh, true); } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 1d42af1ea..3afe0fddb 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -34,7 +34,7 @@ #include "resolvers.h" #include "commandbuilder.h" -SpanningTreeUtilities* Utils = NULL; +SpanningTreeUtilities* Utils = nullptr; ModResult ModuleSpanningTree::OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) { @@ -67,7 +67,7 @@ TreeServer* SpanningTreeUtilities::FindServer(const std::string &ServerName) } else { - return NULL; + return nullptr; } } @@ -81,7 +81,7 @@ TreeServer* SpanningTreeUtilities::FindServerMask(const std::string &ServerName) if (InspIRCd::Match(name, ServerName)) return server; } - return NULL; + return nullptr; } TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id) @@ -90,7 +90,7 @@ TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id) if (iter != sidlist.end()) return iter->second; else - return NULL; + return nullptr; } TreeServer* SpanningTreeUtilities::FindRouteTarget(const std::string& target) @@ -103,7 +103,7 @@ TreeServer* SpanningTreeUtilities::FindRouteTarget(const std::string& target) if (user) return TreeServer::Get(user); - return NULL; + return nullptr; } SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) @@ -350,7 +350,7 @@ std::shared_ptr<Link> SpanningTreeUtilities::FindLink(const std::string& name) return x; } } - return NULL; + return nullptr; } void SpanningTreeUtilities::SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit) diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index ef97cdc9a..074c1c993 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -172,7 +172,7 @@ public: /** Sends a PRIVMSG or a NOTICE to a channel obeying an exempt list and an optional prefix */ - void SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit = NULL); + void SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit = nullptr); // Builds link data to be sent to another server. std::string BuildLinkString(uint16_t protocol, Module* mod); diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 4ee937496..7a4601289 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -141,11 +141,11 @@ public: LocalUser* luser = IS_LOCAL(user); if (!luser || nosslext.Get(luser)) - return NULL; + return nullptr; cert = SSLClientCert::GetCertificate(&luser->eh); if (!cert) - return NULL; + return nullptr; SetCertificate(user, cert); return cert; @@ -402,7 +402,7 @@ public: ModResult OnSetConnectClass(LocalUser* user, ConnectClass::Ptr myclass) override { ssl_cert* cert = cmd.sslapi.GetCertificate(user); - const char* error = NULL; + const char* error = nullptr; const std::string requiressl = myclass->config->getString("requiressl"); if (stdalgo::string::equalsci(requiressl, "trusted")) { diff --git a/src/modules/m_starttls.cpp b/src/modules/m_starttls.cpp index fc80b3e68..53819ce72 100644 --- a/src/modules/m_starttls.cpp +++ b/src/modules/m_starttls.cpp @@ -76,7 +76,7 @@ public: */ user->eh.DoWrite(); - ssl->OnAccept(&user->eh, NULL, NULL); + ssl->OnAccept(&user->eh, nullptr, nullptr); return CmdResult::SUCCESS; } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 3fe06a0b9..09085dabb 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -122,7 +122,7 @@ public: // Pass the user (instead of ServerInstance->FakeClient) to ModeHandler::Process() to // make it so that the user sets the mode themselves - ServerInstance->Modes.Process(user, channel, NULL, setban); + ServerInstance->Modes.Process(user, channel, nullptr, setban); if (ServerInstance->Modes.GetLastChangeList().empty()) { user->WriteNotice("Invalid ban mask"); diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp index 64976f4ed..74f8b7b1a 100644 --- a/src/modules/m_websocket.cpp +++ b/src/modules/m_websocket.cpp @@ -465,7 +465,7 @@ class WebSocketHook final key.append(MagicGUID); std::string reply = "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: "; - reply.append(Base64::Encode((*sha1)->GenerateRaw(key), NULL, '=')).append(newline); + reply.append(Base64::Encode((*sha1)->GenerateRaw(key), nullptr, '=')).append(newline); if (!selectedproto.empty()) reply.append("Sec-WebSocket-Protocol: ").append(selectedproto).append(newline); reply.append(newline); diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index 8d9a8f936..f055ff804 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -224,7 +224,7 @@ public: XLine* xl = xlf->Generate(ServerInstance->Time(), ConvToNum<unsigned long>(command_p[5]), command_p[3], command_p[6], command_p[2]); xl->SetCreateTime(ConvToNum<time_t>(command_p[4])); - if (ServerInstance->XLines->AddLine(xl, NULL)) + if (ServerInstance->XLines->AddLine(xl, nullptr)) { ServerInstance->SNO.WriteToSnoMask('x', "database: Added a line of type %s", command_p[1].c_str()); } |
