From d185decae97752368d5cf62311cbc0d1a52aa22c Mon Sep 17 00:00:00 2001 From: pippijn Date: Wed, 11 Jun 2008 11:35:23 +0000 Subject: [PATCH] fixed some indentation and spacing in modules git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9888 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_filter_pcre.cpp | 2 +- src/modules/extra/m_ldapauth.cpp | 28 +++--- src/modules/extra/m_ldapoper.cpp | 38 ++++---- src/modules/extra/m_mssql.cpp | 24 ++--- src/modules/extra/m_mysql.cpp | 16 ++-- src/modules/extra/m_pgsql.cpp | 14 +-- src/modules/extra/m_rline.cpp | 2 +- src/modules/extra/m_sqlauth.cpp | 26 ++--- src/modules/extra/m_sqlite3.cpp | 20 ++-- src/modules/extra/m_sqllog.cpp | 2 +- src/modules/extra/m_sqloper.cpp | 32 +++---- src/modules/extra/m_sqlutils.cpp | 70 +++++++------- src/modules/extra/m_ssl_gnutls.cpp | 2 +- src/modules/extra/m_ssl_openssl.cpp | 80 ++++++++-------- src/modules/extra/m_ssl_oper_cert.cpp | 6 +- src/modules/extra/m_sslinfo.cpp | 4 +- src/modules/extra/m_testclient.cpp | 28 +++--- src/modules/extra/m_ziplink.cpp | 14 +-- src/modules/httpd.h | 24 ++--- src/modules/m_abbreviation.cpp | 2 +- src/modules/m_alias.cpp | 6 +- src/modules/m_alltime.cpp | 8 +- src/modules/m_antibear.cpp | 10 +- src/modules/m_antibottler.cpp | 8 +- src/modules/m_auditorium.cpp | 6 +- src/modules/m_banexception.cpp | 10 +- src/modules/m_banredirect.cpp | 64 ++++++------- src/modules/m_blockamsg.cpp | 40 ++++---- src/modules/m_blockcaps.cpp | 2 +- src/modules/m_blockcolor.cpp | 10 +- src/modules/m_botmode.cpp | 8 +- src/modules/m_callerid.cpp | 2 +- src/modules/m_cap.cpp | 4 +- src/modules/m_cban.cpp | 2 +- src/modules/m_censor.cpp | 16 ++-- src/modules/m_cgiirc.cpp | 70 +++++++------- src/modules/m_chancreate.cpp | 6 +- src/modules/m_chanfilter.cpp | 22 ++--- src/modules/m_chanprotect.cpp | 30 +++--- src/modules/m_check.cpp | 10 +- src/modules/m_chghost.cpp | 10 +- src/modules/m_chgident.cpp | 16 ++-- src/modules/m_chgname.cpp | 18 ++-- src/modules/m_cloaking.cpp | 24 ++--- src/modules/m_clones.cpp | 8 +- src/modules/m_close.cpp | 4 +- src/modules/m_commonchans.cpp | 6 +- src/modules/m_conn_join.cpp | 2 +- src/modules/m_conn_umodes.cpp | 8 +- src/modules/m_conn_waitpong.cpp | 36 +++---- src/modules/m_connectban.cpp | 4 +- src/modules/m_connflood.cpp | 11 +-- src/modules/m_customtitle.cpp | 39 ++++---- src/modules/m_cycle.cpp | 18 ++-- src/modules/m_dccallow.cpp | 68 ++++++------- src/modules/m_delayjoin.cpp | 4 +- src/modules/m_denychans.cpp | 18 ++-- src/modules/m_dnsbl.cpp | 14 +-- src/modules/m_filter.cpp | 4 +- src/modules/m_foobar.cpp | 26 ++--- src/modules/m_globalload.cpp | 8 +- src/modules/m_globops.cpp | 4 +- src/modules/m_helpop.cpp | 4 +- src/modules/m_hidechans.cpp | 10 +- src/modules/m_hideoper.cpp | 10 +- src/modules/m_hostchange.cpp | 10 +- src/modules/m_httpd.cpp | 64 ++++++------- src/modules/m_httpd_acl.cpp | 4 +- src/modules/m_httpd_config.cpp | 2 +- src/modules/m_httpd_stats.cpp | 4 +- src/modules/m_ident.cpp | 18 ++-- src/modules/m_invisible.cpp | 10 +- src/modules/m_inviteexception.cpp | 8 +- src/modules/m_joinflood.cpp | 14 +-- src/modules/m_jumpserver.cpp | 6 +- src/modules/m_kicknorejoin.cpp | 34 +++---- src/modules/m_knock.cpp | 2 +- src/modules/m_md5.cpp | 52 +++++----- src/modules/m_messageflood.cpp | 20 ++-- src/modules/m_namesx.cpp | 2 +- src/modules/m_nickban.cpp | 4 +- src/modules/m_nickflood.cpp | 12 +-- src/modules/m_nicklock.cpp | 6 +- src/modules/m_noctcp.cpp | 14 +-- src/modules/m_noinvite.cpp | 2 +- src/modules/m_nokicks.cpp | 10 +- src/modules/m_nonicks.cpp | 6 +- src/modules/m_nonotice.cpp | 10 +- src/modules/m_operchans.cpp | 8 +- src/modules/m_operjoin.cpp | 2 +- src/modules/m_operlog.cpp | 16 ++-- src/modules/m_opermodes.cpp | 10 +- src/modules/m_opermotd.cpp | 2 +- src/modules/m_override.cpp | 26 ++--- src/modules/m_password_hash.cpp | 4 +- src/modules/m_permchannels.cpp | 2 +- src/modules/m_proxyscan.cpp | 18 ++-- src/modules/m_quietban.cpp | 6 +- src/modules/m_randquote.cpp | 8 +- src/modules/m_redirect.cpp | 16 ++-- src/modules/m_regonlycreate.cpp | 4 +- src/modules/m_remove.cpp | 52 +++++----- src/modules/m_restrictbanned.cpp | 6 +- src/modules/m_restrictchans.cpp | 10 +- src/modules/m_restrictmsg.cpp | 8 +- src/modules/m_ripemd160.cpp | 26 ++--- src/modules/m_rpc_json.cpp | 96 +++++++++---------- src/modules/m_rpctest.cpp | 14 +-- src/modules/m_safelist.cpp | 16 ++-- src/modules/m_sajoin.cpp | 8 +- src/modules/m_samode.cpp | 6 +- src/modules/m_sanick.cpp | 8 +- src/modules/m_sapart.cpp | 8 +- src/modules/m_saquit.cpp | 14 +-- src/modules/m_sasl.cpp | 2 +- src/modules/m_securelist.cpp | 12 +-- src/modules/m_services.cpp | 18 ++-- src/modules/m_services_account.cpp | 24 ++--- src/modules/m_servprotect.cpp | 8 +- src/modules/m_sethost.cpp | 6 +- src/modules/m_setident.cpp | 16 ++-- src/modules/m_setidle.cpp | 6 +- src/modules/m_setname.cpp | 12 +-- src/modules/m_sha256.cpp | 10 +- src/modules/m_showwhois.cpp | 4 +- src/modules/m_shun.cpp | 6 +- src/modules/m_silence.cpp | 16 ++-- src/modules/m_spanningtree/addline.cpp | 2 +- src/modules/m_spanningtree/capab.cpp | 2 +- src/modules/m_spanningtree/delline.cpp | 2 +- src/modules/m_spanningtree/fjoin.cpp | 6 +- src/modules/m_spanningtree/hmac.cpp | 2 +- src/modules/m_spanningtree/kill.cpp | 4 +- src/modules/m_spanningtree/main.cpp | 12 +-- src/modules/m_spanningtree/netburst.cpp | 2 +- src/modules/m_spanningtree/nickcollide.cpp | 18 ++-- src/modules/m_spanningtree/override_admin.cpp | 8 +- src/modules/m_spanningtree/override_map.cpp | 10 +- .../m_spanningtree/override_modules.cpp | 8 +- src/modules/m_spanningtree/override_motd.cpp | 8 +- src/modules/m_spanningtree/override_squit.cpp | 6 +- src/modules/m_spanningtree/override_stats.cpp | 10 +- src/modules/m_spanningtree/override_time.cpp | 12 +-- src/modules/m_spanningtree/override_whois.cpp | 10 +- src/modules/m_spanningtree/postcommand.cpp | 10 +- src/modules/m_spanningtree/precommand.cpp | 8 +- src/modules/m_spanningtree/privmsg.cpp | 4 +- src/modules/m_spanningtree/treesocket2.cpp | 24 ++--- src/modules/m_spanningtree/uid.cpp | 4 +- src/modules/m_spy.cpp | 8 +- src/modules/m_ssl_dummy.cpp | 14 +-- src/modules/m_sslmodes.cpp | 10 +- src/modules/m_stripcolor.cpp | 12 +-- src/modules/m_svshold.cpp | 22 ++--- src/modules/m_swhois.cpp | 36 +++---- src/modules/m_taxonomy.cpp | 2 +- src/modules/m_timedbans.cpp | 6 +- src/modules/m_tline.cpp | 8 +- src/modules/m_uhnames.cpp | 2 +- src/modules/m_uninvite.cpp | 16 ++-- src/modules/m_userip.cpp | 8 +- src/modules/m_vhost.cpp | 6 +- src/modules/m_watch.cpp | 18 ++-- src/modules/m_xline_db.cpp | 2 +- src/modules/m_xmlsocket.cpp | 2 +- 165 files changed, 1166 insertions(+), 1168 deletions(-) diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index f751a846d..4710d7a33 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -133,7 +133,7 @@ class ModuleFilterPCRE : public FilterBase } virtual void OnRehash(User* user, const std::string ¶meter) - { + { ConfigReader MyConf(ServerInstance); for (int index = 0; index < MyConf.Enumerate("keyword"); index++) diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 93ca34ff2..ab56de6d7 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -13,7 +13,7 @@ * Taken from the UnrealIRCd 4.0 SVN version, based on * InspIRCd 1.1.x. * - * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk + * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk * This program is free but copyrighted software; see * the file COPYING for details. * @@ -44,7 +44,7 @@ class ModuleLDAPAuth : public Module bool verbose; bool useusername; LDAP *conn; - + public: ModuleLDAPAuth(InspIRCd* Me) : Module::Module(Me) @@ -64,9 +64,9 @@ public: virtual void OnRehash(User* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); - + base = Conf.ReadValue("ldapauth", "baserdn", 0); - attribute = Conf.ReadValue("ldapauth", "attribute", 0); + attribute = Conf.ReadValue("ldapauth", "attribute", 0); ldapserver = Conf.ReadValue("ldapauth", "server", 0); allowpattern = Conf.ReadValue("ldapauth", "allowpattern", 0); killreason = Conf.ReadValue("ldapauth", "killreason", 0); @@ -75,13 +75,13 @@ public: password = Conf.ReadValue("ldapauth", "bindauth", 0); verbose = Conf.ReadFlag("ldapauth", "verbose", 0); /* Set to true if failed connects should be reported to operators */ useusername = Conf.ReadFlag("ldapauth", "userfield", 0); - + if (scope == "base") searchscope = LDAP_SCOPE_BASE; else if (scope == "onelevel") searchscope = LDAP_SCOPE_ONELEVEL; else searchscope = LDAP_SCOPE_SUBTREE; - + Connect(); } @@ -96,9 +96,9 @@ public: if (verbose) ServerInstance->SNO->WriteToSnoMask('A', "LDAP connection failed: %s", ldap_err2string(res)); conn = NULL; - return false; + return false; } - + res = ldap_set_option(conn, LDAP_OPT_PROTOCOL_VERSION, (void *)&v); if (res != LDAP_SUCCESS) { @@ -188,16 +188,16 @@ public: ldap_msgfree(msg); user->Extend("ldapauth_failed"); return false; - } + } } - - + + virtual void OnUserDisconnect(User* user) { user->Shrink("ldapauthed"); - user->Shrink("ldapauth_failed"); + user->Shrink("ldapauth_failed"); } - + virtual bool OnCheckReady(User* user) { return user->GetExt("ldapauthed"); @@ -207,7 +207,7 @@ public: { return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleLDAPAuth) diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index 61e518dcf..9a2a5b131 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -13,7 +13,7 @@ * Taken from the UnrealIRCd 4.0 SVN version, based on * InspIRCd 1.1.x. * - * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk + * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk * This program is free but copyrighted software; see * the file COPYING for details. * @@ -39,7 +39,7 @@ class ModuleLDAPAuth : public Module std::string password; int searchscope; LDAP *conn; - + public: ModuleLDAPAuth(InspIRCd* Me) : Module::Module(Me) @@ -59,19 +59,19 @@ public: virtual void OnRehash(User* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); - + base = Conf.ReadValue("ldapoper", "baserdn", 0); ldapserver = Conf.ReadValue("ldapoper", "server", 0); std::string scope = Conf.ReadValue("ldapoper", "searchscope", 0); username = Conf.ReadValue("ldapoper", "binddn", 0); password = Conf.ReadValue("ldapoper", "bindauth", 0); - + if (scope == "base") searchscope = LDAP_SCOPE_BASE; else if (scope == "onelevel") searchscope = LDAP_SCOPE_ONELEVEL; else searchscope = LDAP_SCOPE_SUBTREE; - + Connect(); } @@ -84,9 +84,9 @@ public: if (res != LDAP_SUCCESS) { conn = NULL; - return false; + return false; } - + res = ldap_set_option(conn, LDAP_OPT_PROTOCOL_VERSION, (void *)&v); if (res != LDAP_SUCCESS) { @@ -97,20 +97,20 @@ public: return true; } - virtual int OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) - { + virtual int OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) + { User* user = dynamic_cast(ex); - if (hashtype == "ldap") + if (hashtype == "ldap") { - if (LookupOper(user, data, input)) - { + if (LookupOper(user, data, input)) + { /* This is an ldap oper and has been found, claim the OPER command */ - return 1; - } - } + return 1; + } + } /* We don't know this oper! */ - return 0; - } + return 0; + } bool LookupOper(User* user, const std::string &what, const std::string &opassword) { @@ -163,14 +163,14 @@ public: free(authpass); ldap_msgfree(msg); return false; - } + } } virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleLDAPAuth) diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index 972130396..782b5bfac 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -94,7 +94,7 @@ class ResultNotifier : public BufferedSocket class MsSQLResult : public SQLresult { - private: + private: int currentrow; int rows; int cols; @@ -106,7 +106,7 @@ class MsSQLResult : public SQLresult SQLfieldList* fieldlist; SQLfieldMap* fieldmap; - public: + public: MsSQLResult(Module* self, Module* to, unsigned int rid) : SQLresult(self, to, rid), currentrow(0), rows(0), cols(0), fieldlist(NULL), fieldmap(NULL) { @@ -262,16 +262,16 @@ class MsSQLResult : public SQLresult class SQLConn : public classbase { - private: + private: ResultQueue results; - InspIRCd* Instance; + InspIRCd* Instance; Module* mod; SQLhost host; TDSLOGIN* login; TDSSOCKET* sock; TDSCONTEXT* context; - public: + public: SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) : Instance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL) { @@ -308,7 +308,7 @@ class SQLConn : public classbase { if (!sock) return SQLerror(BAD_CONN, "Socket was NULL, check if SQL server is running."); - + /* Pointer to the buffer we screw around with substitution in */ char* query; @@ -357,7 +357,7 @@ class SQLConn : public classbase escend++; } *escend = 0; - + for (char* n = escaped; *n; n++) { *queryend = *n; @@ -395,7 +395,7 @@ class SQLConn : public classbase } delete[] query; free(msquery); - + int tds_res; while (tds_process_tokens(sock, &tds_res, NULL, TDS_TOKEN_RESULTS) == TDS_SUCCEED) { @@ -450,7 +450,7 @@ class SQLConn : public classbase default: break; - } + } } results.push_back(res); SendNotify(); @@ -610,11 +610,11 @@ class SQLConn : public classbase class ModuleMsSQL : public Module { - private: + private: ConnMap connections; unsigned long currid; - public: + public: ModuleMsSQL(InspIRCd* Me) : Module::Module(Me), currid(0) { @@ -705,7 +705,7 @@ class ModuleMsSQL : public Module } return false; } - + void ReadConf() { ClearOldConnections(); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index be6f4bc4c..e49c3ced4 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -30,7 +30,7 @@ /* $ModDep: m_sqlv2.h */ /* THE NONBLOCKING MYSQL API! - * + * * MySQL provides no nonblocking (asyncronous) API of its own, and its developers recommend * that instead, you should thread your program. This is what i've done here to allow for * asyncronous SQL requests via mysql. The way this works is as follows: @@ -137,7 +137,7 @@ class MySQLresult : public SQLresult std::string b = (row[field_count] ? row[field_count] : ""); SQLfield sqlf(b, !row[field_count]); colnames.push_back(a); - fieldlists[n].push_back(sqlf); + fieldlists[n].push_back(sqlf); field_count++; } n++; @@ -247,7 +247,7 @@ class MySQLresult : public SQLresult virtual SQLfieldMap* GetRowMapPtr() { fieldmap = new SQLfieldMap(); - + if (currentrow < rows) { for (int i = 0; i < Cols(); i++) @@ -632,7 +632,7 @@ class Notifier : public BufferedSocket { insp_sockaddr sock_us; socklen_t uslen; - + public: @@ -707,7 +707,7 @@ class Notifier : public BufferedSocket class ModuleSQL : public Module { public: - + ConfigReader *Conf; InspIRCd* PublicServerInstance; pthread_t Dispatcher; @@ -725,7 +725,7 @@ class ModuleSQL : public Module SQLModule = this; MessagePipe = new Notifier(ServerInstance); - + pthread_attr_t attribs; pthread_attr_init(&attribs); pthread_attr_setdetachstate(&attribs, PTHREAD_CREATE_JOINABLE); @@ -817,12 +817,12 @@ class ModuleSQL : public Module { rehashing = true; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR|VF_SERVICEPROVIDER,API_VERSION); } - + }; void* DispatcherThread(void* arg) diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index fb282fb98..67b3594c7 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -83,9 +83,9 @@ std::string SQLhost::GetDSN() class ReconnectTimer : public Timer { - private: + private: Module* mod; - public: + public: ReconnectTimer(InspIRCd* SI, Module* m) : Timer(5, SI->Time(), false), mod(m) { @@ -314,8 +314,8 @@ public: */ class SQLConn : public EventHandler { - private: - InspIRCd* Instance; + private: + InspIRCd* Instance; SQLhost confhost; /* The entry */ Module* us; /* Pointer to the SQL provider itself */ PGconn* sql; /* PgSQL database connection handle */ @@ -324,7 +324,7 @@ class SQLConn : public EventHandler QueryQueue queue; /* Queue of queries waiting to be executed on this connection */ time_t idle; /* Time we last heard from the database */ - public: + public: SQLConn(InspIRCd* SI, Module* self, const SQLhost& hi) : EventHandler(), Instance(SI), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false) { @@ -713,13 +713,13 @@ class SQLConn : public EventHandler class ModulePgSQL : public Module { - private: + private: ConnMap connections; unsigned long currid; char* sqlsuccess; ReconnectTimer* retimer; - public: + public: ModulePgSQL(InspIRCd* Me) : Module::Module(Me), currid(0) { diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp index 0a26ea63d..2a4124c94 100644 --- a/src/modules/extra/m_rline.cpp +++ b/src/modules/extra/m_rline.cpp @@ -25,7 +25,7 @@ class CoreExport RLine : public XLine { - public: + public: /** Create a R-Line. * @param s_time The set time diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 18859d133..dcc314af9 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -31,9 +31,9 @@ class ModuleSQLAuth : public Module std::string killreason; std::string allowpattern; std::string databaseid; - + bool verbose; - + public: ModuleSQLAuth(InspIRCd* Me) : Module::Module(Me) @@ -79,7 +79,7 @@ public: user->Extend("sqlauthed"); return 0; } - + if (!CheckCredentials(user)) { ServerInstance->Users->QuitUser(user, killreason); @@ -104,7 +104,7 @@ public: { std::string thisquery = freeformquery; std::string safepass = user->password; - + /* Search and replace the escaped nick and escaped pass into the query */ SearchAndReplace(safepass, "\"", ""); @@ -132,7 +132,7 @@ public: /* Build the query */ SQLrequest req = SQLrequest(this, SQLprovider, databaseid, SQLquery(thisquery)); - + if(req.Send()) { /* When we get the query response from the service provider we will be given an ID to play with, @@ -143,7 +143,7 @@ public: * us to discard the query. */ AssociateUser(this, SQLutils, req.id, user).Send(); - + return true; } else @@ -153,7 +153,7 @@ public: return false; } } - + virtual const char* OnRequest(Request* request) { if(strcmp(SQLRESID, request->GetId()) == 0) @@ -162,7 +162,7 @@ public: User* user = GetAssocUser(this, SQLutils, res->id).S().user; UnAssociate(this, SQLutils, res->id).S(); - + if(user) { if(res->error.Id() == NO_ERROR) @@ -195,16 +195,16 @@ public: ServerInstance->Users->QuitUser(user, killreason); } return SQLSUCCESS; - } + } return NULL; } - + virtual void OnUserDisconnect(User* user) { user->Shrink("sqlauthed"); - user->Shrink("sqlauth_failed"); + user->Shrink("sqlauth_failed"); } - + virtual bool OnCheckReady(User* user) { return user->GetExt("sqlauthed"); @@ -214,7 +214,7 @@ public: { return Version(1,2,1,0,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleSQLAuth) diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 8c191381a..0aa5ad92a 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -94,7 +94,7 @@ class ResultNotifier : public BufferedSocket class SQLite3Result : public SQLresult { - private: + private: int currentrow; int rows; int cols; @@ -106,7 +106,7 @@ class SQLite3Result : public SQLresult SQLfieldList* fieldlist; SQLfieldMap* fieldmap; - public: + public: SQLite3Result(Module* self, Module* to, unsigned int rid) : SQLresult(self, to, rid), currentrow(0), rows(0), cols(0), fieldlist(NULL), fieldmap(NULL) { @@ -262,14 +262,14 @@ class SQLite3Result : public SQLresult class SQLConn : public classbase { - private: + private: ResultQueue results; - InspIRCd* Instance; + InspIRCd* Instance; Module* mod; SQLhost host; sqlite3* conn; - public: + public: SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) : Instance(SI), mod(m), host(hi) { @@ -475,11 +475,11 @@ class SQLConn : public classbase class ModuleSQLite3 : public Module { - private: + private: ConnMap connections; unsigned long currid; - public: + public: ModuleSQLite3(InspIRCd* Me) : Module::Module(Me), currid(0) { @@ -507,20 +507,20 @@ class ModuleSQLite3 : public Module ServerInstance->SE->DelFd(resultnotify); resultnotify->Close(); ServerInstance->BufferedSocketCull(); - + if (QueueFD >= 0) { shutdown(QueueFD, 2); close(QueueFD); } - + if (resultdispatch) { ServerInstance->SE->DelFd(resultdispatch); resultdispatch->Close(); ServerInstance->BufferedSocketCull(); } - + ServerInstance->Modules->UnpublishInterface("SQL", this); ServerInstance->Modules->UnpublishFeature("SQL"); ServerInstance->Modules->DoneWithInterface("SQLutils"); diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index fb49f828c..ecd931dd6 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -304,7 +304,7 @@ class ModuleSQLLog : public Module { return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleSQLLog) diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index b84834558..60207548d 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -106,7 +106,7 @@ public: virtual void OnRehash(User* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); - + databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */ hashtype = assign(Conf.ReadValue("sqloper", "hash", 0)); } @@ -116,7 +116,7 @@ public: if ((validated) && (command == "OPER")) { if (LookupOper(user, parameters[0], parameters[1])) - { + { /* Returning true here just means the query is in progress, or on it's way to being * in progress. Nothing about the /oper actually being successful.. * If the oper lookup fails later, we pass the command to the original handler @@ -131,7 +131,7 @@ public: bool LookupOper(User* user, const std::string &username, const std::string &password) { Module* target; - + target = ServerInstance->Modules->FindFeature("SQL"); if (target) @@ -150,7 +150,7 @@ public: */ SQLrequest req = SQLrequest(this, target, databaseid, SQLquery("SELECT username, password, hostname, type FROM ircd_opers WHERE username = '?' AND password='?'") % username % md5_pass_hash); - + if (req.Send()) { /* When we get the query response from the service provider we will be given an ID to play with, @@ -164,7 +164,7 @@ public: user->Extend("oper_user", strdup(username.c_str())); user->Extend("oper_pass", strdup(password.c_str())); - + return true; } else @@ -178,7 +178,7 @@ public: return false; } } - + virtual const char* OnRequest(Request* request) { if (strcmp(SQLRESID, request->GetId()) == 0) @@ -193,7 +193,7 @@ public: user->GetExt("oper_user", tried_user); user->GetExt("oper_pass", tried_pass); - + if (user) { if (res->error.Id() == NO_ERROR) @@ -203,18 +203,18 @@ public: /* We got a row in the result, this means there was a record for the oper.. * now we just need to check if their host matches, and if it does then * oper them up. - * + * * We now (previous versions of the module didn't) support multiple SQL * rows per-oper in the same way the config file does, all rows will be tried * until one is found which matches. This is useful to define several different * hosts for a single oper. - * + * * The for() loop works as SQLresult::GetRowMap() returns an empty map when there * are no more rows to return. */ - + for (SQLfieldMap& row = res->GetRowMap(); row.size(); row = res->GetRowMap()) - { + { if (OperUser(user, row["username"].d, row["password"].d, row["hostname"].d, row["type"].d)) { /* If/when one of the rows matches, stop checking and return */ @@ -263,7 +263,7 @@ public: } } - + return SQLSUCCESS; } @@ -290,14 +290,14 @@ public: bool OperUser(User* user, const std::string &username, const std::string &password, const std::string &pattern, const std::string &type) { ConfigReader Conf(ServerInstance); - + for (int j = 0; j < Conf.Enumerate("type"); j++) { std::string tname = Conf.ReadValue("type","name",j); std::string hostname(user->ident); hostname.append("@").append(user->host); - + if ((tname == type) && OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str())) { /* Opertype and host match, looks like this is it. */ @@ -315,7 +315,7 @@ public: return true; } } - + return false; } @@ -323,7 +323,7 @@ public: { return Version(1,2,1,0,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleSQLOper) diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp index eea748db4..7a8a2810a 100644 --- a/src/modules/extra/m_sqlutils.cpp +++ b/src/modules/extra/m_sqlutils.cpp @@ -45,7 +45,7 @@ public: virtual ~ModuleSQLutils() { ServerInstance->Modules->UnpublishInterface("SQLutils", this); - } + } virtual const char* OnRequest(Request* request) @@ -53,36 +53,36 @@ public: if(strcmp(SQLUTILAU, request->GetId()) == 0) { AssociateUser* req = (AssociateUser*)request; - + iduser.insert(std::make_pair(req->id, req->user)); - + AttachList(req->user, req->id); } else if(strcmp(SQLUTILAC, request->GetId()) == 0) { AssociateChan* req = (AssociateChan*)request; - - idchan.insert(std::make_pair(req->id, req->chan)); - + + idchan.insert(std::make_pair(req->id, req->chan)); + AttachList(req->chan, req->id); } else if(strcmp(SQLUTILUA, request->GetId()) == 0) { UnAssociate* req = (UnAssociate*)request; - + /* Unassociate a given query ID with all users and channels * it is associated with. */ - + DoUnAssociate(iduser, req->id); DoUnAssociate(idchan, req->id); } else if(strcmp(SQLUTILGU, request->GetId()) == 0) { GetAssocUser* req = (GetAssocUser*)request; - + IdUserMap::iterator iter = iduser.find(req->id); - + if(iter != iduser.end()) { req->user = iter->second; @@ -90,19 +90,19 @@ public: } else if(strcmp(SQLUTILGC, request->GetId()) == 0) { - GetAssocChan* req = (GetAssocChan*)request; - + GetAssocChan* req = (GetAssocChan*)request; + IdChanMap::iterator iter = idchan.find(req->id); - + if(iter != idchan.end()) { req->chan = iter->second; } } - + return SQLUTILSUCCESS; } - + virtual void OnUserDisconnect(User* user) { /* A user is disconnecting, first we need to check if they have a list of queries associated with them. @@ -110,15 +110,15 @@ public: * associated them asks to look them up then it gets a NULL result and knows to discard the query. */ AssocIdList* il; - + if(user->GetExt("sqlutils_queryids", il)) { for(AssocIdList::iterator listiter = il->begin(); listiter != il->end(); listiter++) { IdUserMap::iterator iter; - + iter = iduser.find(*listiter); - + if(iter != iduser.end()) { if(iter->second != user) @@ -133,36 +133,36 @@ public: ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick.c_str()); } } - + user->Shrink("sqlutils_queryids"); delete il; } } - + void AttachList(Extensible* obj, unsigned long id) { AssocIdList* il; - + if(!obj->GetExt("sqlutils_queryids", il)) { /* Doesn't already exist, create a new list and attach it. */ il = new AssocIdList; obj->Extend("sqlutils_queryids", il); } - + /* Now either way we have a valid list in il, attached. */ il->push_back(id); } - + void RemoveFromList(Extensible* obj, unsigned long id) { AssocIdList* il; - + if(obj->GetExt("sqlutils_queryids", il)) { /* Only do anything if the list exists... (which it ought to) */ il->remove(id); - + if(il->empty()) { /* If we just emptied it.. */ @@ -171,7 +171,7 @@ public: } } } - + template void DoUnAssociate(T &map, unsigned long id) { /* For each occurence of 'id' (well, only one..it's not a multimap) in 'map' @@ -179,7 +179,7 @@ public: * 'id' from the list of query IDs attached to it. */ typename T::iterator iter = map.find(id); - + if(iter != map.end()) { /* Found a value indexed by 'id', call RemoveFromList() @@ -189,7 +189,7 @@ public: RemoveFromList(iter->second, id); } } - + virtual void OnChannelDelete(Channel* chan) { /* A channel is being destroyed, first we need to check if it has a list of queries associated with it. @@ -197,39 +197,39 @@ public: * associated them asks to look them up then it gets a NULL result and knows to discard the query. */ AssocIdList* il; - + if(chan->GetExt("sqlutils_queryids", il)) { for(AssocIdList::iterator listiter = il->begin(); listiter != il->end(); listiter++) { IdChanMap::iterator iter; - + iter = idchan.find(*listiter); - + if(iter != idchan.end()) { if(iter->second != chan) { ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name.c_str()); } - idchan.erase(iter); + idchan.erase(iter); } else { ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name.c_str()); } } - + chan->Shrink("sqlutils_queryids"); delete il; } } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR|VF_SERVICEPROVIDER, API_VERSION); } - + }; MODULE_INIT(ModuleSQLutils) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index ac385ceb5..53c242c63 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -913,7 +913,7 @@ class ModuleSSLGnuTLS : public Module GenericCapHandler(ev, "tls", "tls"); } - void Prioritize() + void Prioritize() { Module* server = ServerInstance->Modules->Find("m_spanningtree.so"); ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIO_AFTER, &server); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 9a51f0eb3..70da472a3 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -162,7 +162,7 @@ class ModuleSSLOpenSSL : public Module ServerInstance->Modules->Attach(eventlist, this, 16); } - virtual void OnHookUserIO(User* user, const std::string &targetip) + virtual void OnHookUserIO(User* user, const std::string &targetip) { if (!user->io && isin(targetip,user->GetPort(), listenports)) { @@ -175,43 +175,43 @@ class ModuleSSLOpenSSL : public Module { ConfigReader Conf(ServerInstance); - listenports.clear(); - clientactive = 0; - sslports.clear(); - - for(int index = 0; index < Conf.Enumerate("bind"); index++) - { - // For each tag - std::string x = Conf.ReadValue("bind", "type", index); - if(((x.empty()) || (x == "clients")) && (Conf.ReadValue("bind", "ssl", index) == "openssl")) - { - // Get the port we're meant to be listening on with SSL - std::string port = Conf.ReadValue("bind", "port", index); - std::string addr = Conf.ReadValue("bind", "address", index); - - irc::portparser portrange(port, false); - long portno = -1; - while ((portno = portrange.GetToken())) - { - clientactive++; - try - { - listenports.push_back(addr + ":" + ConvToStr(portno)); - - for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++) - if ((ServerInstance->Config->ports[i]->GetPort() == portno) && (ServerInstance->Config->ports[i]->GetIP() == addr)) - ServerInstance->Config->ports[i]->SetDescription("ssl"); - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %ld", portno); - - sslports.append((addr.empty() ? "*" : addr)).append(":").append(ConvToStr(portno)).append(";"); - } - catch (ModuleException &e) - { - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); - } - } - } - } + listenports.clear(); + clientactive = 0; + sslports.clear(); + + for(int index = 0; index < Conf.Enumerate("bind"); index++) + { + // For each tag + std::string x = Conf.ReadValue("bind", "type", index); + if(((x.empty()) || (x == "clients")) && (Conf.ReadValue("bind", "ssl", index) == "openssl")) + { + // Get the port we're meant to be listening on with SSL + std::string port = Conf.ReadValue("bind", "port", index); + std::string addr = Conf.ReadValue("bind", "address", index); + + irc::portparser portrange(port, false); + long portno = -1; + while ((portno = portrange.GetToken())) + { + clientactive++; + try + { + listenports.push_back(addr + ":" + ConvToStr(portno)); + + for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++) + if ((ServerInstance->Config->ports[i]->GetPort() == portno) && (ServerInstance->Config->ports[i]->GetIP() == addr)) + ServerInstance->Config->ports[i]->SetDescription("ssl"); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %ld", portno); + + sslports.append((addr.empty() ? "*" : addr)).append(":").append(ConvToStr(portno)).append(";"); + } + catch (ModuleException &e) + { + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); + } + } + } + } if (!sslports.empty()) sslports.erase(sslports.end() - 1); @@ -430,7 +430,7 @@ class ModuleSSLOpenSSL : public Module virtual void OnRawSocketConnect(int fd) { - /* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */ + /* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */ if ((fd < 0) || (fd > ServerInstance->SE->GetMaxFds() -1)) return; @@ -636,7 +636,7 @@ class ModuleSSLOpenSSL : public Module { // Is this right? Not sure if the unencrypted data is garaunteed to be the same length. // Read into the inbuffer, offset from the beginning by the amount of data we have that insp hasn't taken yet. - + int ret = SSL_read(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset); if (ret == 0) diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp index ed4ba9c00..817854fa8 100644 --- a/src/modules/extra/m_ssl_oper_cert.cpp +++ b/src/modules/extra/m_ssl_oper_cert.cpp @@ -31,8 +31,8 @@ class cmd_fingerprint : public Command { this->source = "m_ssl_oper_cert.so"; syntax = ""; - } - + } + CmdResult Handle (const std::vector ¶meters, User *user) { User* target = ServerInstance->FindNick(parameters[0]); @@ -115,7 +115,7 @@ class ModuleOperSSLCert : public Module virtual int OnPreCommand(std::string &command, std::vector ¶meters, User *user, bool validated, const std::string &original_line) { irc::string cmd = command.c_str(); - + if ((cmd == "OPER") && (validated)) { char TheHost[MAXBUF]; diff --git a/src/modules/extra/m_sslinfo.cpp b/src/modules/extra/m_sslinfo.cpp index 6c74b15d4..6d0c78937 100644 --- a/src/modules/extra/m_sslinfo.cpp +++ b/src/modules/extra/m_sslinfo.cpp @@ -71,7 +71,7 @@ class ModuleSSLInfo : public Module ModuleSSLInfo(InspIRCd* Me) : Module(Me) { - + newcommand = new cmd_sslinfo(ServerInstance); ServerInstance->AddCommand(newcommand); @@ -81,7 +81,7 @@ class ModuleSSLInfo : public Module virtual ~ModuleSSLInfo() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index 0bad0466e..f0492ed78 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -21,7 +21,7 @@ class ModuleTestClient : public Module { private: - + public: ModuleTestClient(InspIRCd* Me) @@ -31,21 +31,21 @@ public: ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); } - + virtual void OnBackgroundTimer(time_t) { Module* target = ServerInstance->Modules->FindFeature("SQL"); - + if(target) { SQLrequest foo = SQLrequest(this, target, "foo", SQLquery("UPDATE rawr SET foo = '?' WHERE bar = 42") % time(NULL)); - + if(foo.Send()) { ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Sent query, got given ID %lu", foo.id); @@ -56,13 +56,13 @@ public: } } } - + virtual const char* OnRequest(Request* request) { if(strcmp(SQLRESID, request->GetId()) == 0) { ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Got SQL result (%s)", request->GetId()); - + SQLresult* res = (SQLresult*)request; if (res->error.Id() == NO_ERROR) @@ -74,7 +74,7 @@ public: for (int r = 0; r < res->Rows(); r++) { ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Row %d:", r); - + for(int i = 0; i < res->Cols(); i++) { ServerInstance->Logs->Log("m_testclient.so", DEBUG, "\t[%s]: %s", res->ColName(i).c_str(), res->GetValue(r, i).d.c_str()); @@ -89,20 +89,20 @@ public: else { ServerInstance->Logs->Log("m_testclient.so", DEBUG, "SQLrequest failed: %s", res->error.Str()); - + } - + return SQLSUCCESS; } - + ServerInstance->Logs->Log("m_testclient.so", DEBUG, "Got unsupported API version string: %s", request->GetId()); - + return NULL; } - + virtual ~ModuleTestClient() { - } + } }; MODULE_INIT(ModuleTestClient) diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index 7b1cb281c..be57eea97 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -144,9 +144,9 @@ class ModuleZLib : public Module float total_in_compressed; float total_out_uncompressed; float total_in_uncompressed; - + public: - + ModuleZLib(InspIRCd* Me) : Module::Module(Me) { @@ -261,7 +261,7 @@ class ModuleZLib : public Module virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport) { izip_session* session = &sessions[fd]; - + /* allocate state and buffers */ session->fd = fd; session->status = IZIP_OPEN; @@ -308,7 +308,7 @@ class ModuleZLib : public Module /* Add it to the frame queue */ session->inbuf->AddData(compr, readresult); total_in_compressed += readresult; - + /* Parse all completed frames */ int size = 0; while ((size = session->inbuf->GetFrame(compr, CHUNK)) != 0) @@ -320,14 +320,14 @@ class ModuleZLib : public Module /* If we cant call this, well, we're boned. */ if (inflateInit(&session->d_stream) != Z_OK) return 0; - + while ((session->d_stream.total_out < count) && (session->d_stream.total_in < (unsigned int)size)) { session->d_stream.avail_in = session->d_stream.avail_out = 1; if (inflate(&session->d_stream, Z_NO_FLUSH) == Z_STREAM_END) break; } - + /* Stick a fork in me, i'm done */ inflateEnd(&session->d_stream); @@ -435,7 +435,7 @@ class ModuleZLib : public Module */ return ocount; } - + void CloseSession(izip_session* session) { if (session->status == IZIP_OPEN) diff --git a/src/modules/httpd.h b/src/modules/httpd.h index 0fa5c09d5..2d8da2cbd 100644 --- a/src/modules/httpd.h +++ b/src/modules/httpd.h @@ -27,7 +27,7 @@ class HTTPHeaders : public classbase protected: std::map headers; public: - + /** Set the value of a header * Sets the value of the named header. If the header is already present, it will be replaced */ @@ -35,7 +35,7 @@ class HTTPHeaders : public classbase { headers[name] = data; } - + /** Set the value of a header, only if it doesn't exist already * Sets the value of the named header. If the header is already present, it will NOT be updated */ @@ -44,21 +44,21 @@ class HTTPHeaders : public classbase if (!IsSet(name)) SetHeader(name, data); } - + /** Remove the named header */ void RemoveHeader(const std::string &name) { headers.erase(name); } - + /** Remove all headers */ void Clear() { headers.clear(); } - + /** Get the value of a header * @return The value of the header, or an empty string */ @@ -67,10 +67,10 @@ class HTTPHeaders : public classbase std::map::iterator it = headers.find(name); if (it == headers.end()) return std::string(); - + return it->second; } - + /** Check if the given header is specified * @return true if the header is specified */ @@ -79,17 +79,17 @@ class HTTPHeaders : public classbase std::map::iterator it = headers.find(name); return (it != headers.end()); } - + /** Get all headers, formatted by the HTTP protocol * @return Returns all headers, formatted according to the HTTP protocol. There is no request terminator at the end */ std::string GetFormattedHeaders() { std::string re; - + for (std::map::iterator i = headers.begin(); i != headers.end(); i++) re += i->first + ": " + i->second + "\r\n"; - + return re; } }; @@ -105,7 +105,7 @@ class HTTPRequest : public classbase std::string document; std::string ipaddr; std::string postdata; - + public: HTTPHeaders *headers; @@ -181,7 +181,7 @@ class HTTPDocument : public classbase public: HTTPHeaders headers; - + /** The socket pointer from an earlier HTTPRequest */ void* sock; diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 0b59613ca..dc298d726 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -19,7 +19,7 @@ class ModuleAbbreviation : public Module { public: - + ModuleAbbreviation(InspIRCd* Me) : Module(Me) { diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 762ba6e29..28190cec9 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -69,7 +69,7 @@ class ModuleAlias : public Module } public: - + ModuleAlias(InspIRCd* Me) : Module(Me) { @@ -177,7 +177,7 @@ class ModuleAlias : public Module { if (!ServerInstance->ULine(u->server)) { - ServerInstance->SNO->WriteToSnoMask('A', "NOTICE -- Service "+Aliases[i].requires+" required by alias "+std::string(Aliases[i].text.c_str())+" is not on a u-lined server, possibly underhanded antics detected!"); + ServerInstance->SNO->WriteToSnoMask('A', "NOTICE -- Service "+Aliases[i].requires+" required by alias "+std::string(Aliases[i].text.c_str())+" is not on a u-lined server, possibly underhanded antics detected!"); user->WriteNumeric(401, ""+std::string(user->nick)+" "+Aliases[i].requires+" :is an imposter! Please inform an IRC operator as soon as possible."); return 1; } @@ -255,7 +255,7 @@ class ModuleAlias : public Module } ServerInstance->Parser->CallHandler(command, pars, user); } - + virtual void OnRehash(User* user, const std::string ¶meter) { ReadAliases(); diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 04a3f4a4f..b0ccd2886 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -33,7 +33,7 @@ class CommandAlltime : public Command std::string msg = ":" + std::string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :System time for " + ServerInstance->Config->ServerName + " is: " + fmtdate; - + if (IS_LOCAL(user)) { user->Write(msg); @@ -60,16 +60,16 @@ class Modulealltime : public Module ServerInstance->AddCommand(mycommand); } - + virtual ~Modulealltime() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(Modulealltime) diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp index 925ec2314..77b817b54 100644 --- a/src/modules/m_antibear.cpp +++ b/src/modules/m_antibear.cpp @@ -23,15 +23,15 @@ class ModuleAntiBear : public Module public: ModuleAntiBear(InspIRCd* Me) : Module(Me) { - + Implementation eventlist[] = { I_OnUserRegister, I_OnPreCommand }; ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual ~ModuleAntiBear() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); @@ -54,12 +54,12 @@ class ModuleAntiBear : public Module return 1; } - + user->Shrink("antibear_timewait"); // Block the command, so the user doesn't receive a no such nick notice return 1; } - + return 0; } diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index 37f5f953e..cd177fd8e 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -21,17 +21,17 @@ class ModuleAntiBottler : public Module ModuleAntiBottler(InspIRCd* Me) : Module(Me) { - + Implementation eventlist[] = { I_OnPreCommand }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleAntiBottler() { } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); @@ -48,7 +48,7 @@ class ModuleAntiBottler : public Module { if (*j == ':') break; - + if (*j == '"') { not_bottler = true; diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 28e5a54ac..cba99d471 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -67,7 +67,7 @@ class ModuleAuditorium : public Module Me->Modules->Attach(eventlist, this, 6); } - + virtual ~ModuleAuditorium() { ServerInstance->Modes->DelMode(aum); @@ -86,7 +86,7 @@ class ModuleAuditorium : public Module return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick) + virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick) { if (!channel->IsModeSet('u')) return; @@ -113,7 +113,7 @@ class ModuleAuditorium : public Module return; } } - + virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent) { if (channel->IsModeSet('u')) diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index d90cbff29..2a0bafc25 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -39,7 +39,7 @@ class BanException : public ListModeBase class ModuleBanException : public Module { BanException* be; - + public: ModuleBanException(InspIRCd* Me) : Module(Me) @@ -54,7 +54,7 @@ public: Me->Modules->Attach(list, this, 4); } - + virtual void On005Numeric(std::string &output) { output.append(" EXCEPTS=e"); @@ -66,7 +66,7 @@ public: { modelist* list; chan->GetExt(be->GetInfoKey(), list); - + if (!list) { // No list, proceed normally @@ -83,7 +83,7 @@ public: } } } - return 0; + return 0; } virtual void OnCleanup(int target_type, void* item) @@ -134,7 +134,7 @@ public: { return Version(1, 2, 0, 3, VF_COMMON | VF_VENDOR, API_VERSION); } - + virtual ~ModuleBanException() { ServerInstance->Modes->DelMode(be); diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 6714dde1e..5965811c4 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -52,22 +52,22 @@ class BanRedirect : public ModeWatcher * nick!ident#chan -> nick!ident@*#chan * nick#chan -> nick!*@*#chan */ - + if(channel && (type == MODETYPE_CHANNEL) && param.length()) { BanRedirectList* redirects; - + std::string mask[4]; enum { NICK, IDENT, HOST, CHAN } current = NICK; std::string::iterator start_pos = param.begin(); long maxbans = channel->GetMaxBans(); - + if(adding && (channel->bans.size() > static_cast(maxbans))) { source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)", source->nick.c_str(), channel->name.c_str(), channel->name.c_str(), maxbans); return false; } - + for(std::string::iterator curr = start_pos; curr != param.end(); curr++) { switch(*curr) @@ -89,19 +89,19 @@ class BanRedirect : public ModeWatcher break; } } - + if(mask[current].empty()) { - mask[current].assign(start_pos, param.end()); + mask[current].assign(start_pos, param.end()); } - + /* nick@host wants to be changed to *!nick@host rather than nick!*@host... */ if(mask[NICK].length() && mask[HOST].length() && mask[IDENT].empty()) { /* std::string::swap() is fast - it runs in constant time */ mask[NICK].swap(mask[IDENT]); } - + for(int i = 0; i < 3; i++) { if(mask[i].empty()) @@ -109,9 +109,9 @@ class BanRedirect : public ModeWatcher mask[i].assign("*"); } } - + param.assign(mask[NICK]).append(1, '!').append(mask[IDENT]).append(1, '@').append(mask[HOST]); - + if(mask[CHAN].length()) { if(!IS_LOCAL(source) || Srv->IsChannel(mask[CHAN].c_str(), ServerInstance->Config->Limits.ChanMax)) @@ -131,10 +131,10 @@ class BanRedirect : public ModeWatcher redirects = new BanRedirectList; channel->Extend("banredirects", redirects); } - + /* Here 'param' doesn't have the channel on it yet */ redirects->push_back(BanRedirectEntry(mask[CHAN].c_str(), param.c_str())); - + /* Now it does */ param.append(mask[CHAN]); } @@ -144,25 +144,25 @@ class BanRedirect : public ModeWatcher if(channel->GetExt("banredirects", redirects)) { /* But there were, so we need to remove the matching one if there is one */ - + for(BanRedirectList::iterator redir = redirects->begin(); redir != redirects->end(); redir++) { /* Ugly as fuck */ if((irc::string(redir->targetchan.c_str()) == irc::string(mask[CHAN].c_str())) && (irc::string(redir->banmask.c_str()) == irc::string(param.c_str()))) { redirects->erase(redir); - + if(redirects->empty()) { delete redirects; channel->Shrink("banredirects"); } - + break; } } } - + /* Append the channel so the default +b handler can remove the entry too */ param.append(mask[CHAN]); } @@ -175,7 +175,7 @@ class BanRedirect : public ModeWatcher } } } - + return true; } }; @@ -192,7 +192,7 @@ class ModuleBanRedirect : public Module { re = new BanRedirect(Me); nofollow = false; - + if(!ServerInstance->Modes->AddModeWatcher(re)) { delete re; @@ -205,47 +205,47 @@ class ModuleBanRedirect : public Module Me->Modules->Attach(list, this, 4); } - + virtual void OnChannelDelete(Channel* chan) { OnCleanup(TYPE_CHANNEL, chan); } - + virtual void OnCleanup(int target_type, void* item) { if(target_type == TYPE_CHANNEL) { Channel* chan = static_cast(item); BanRedirectList* redirects; - + if(chan->GetExt("banredirects", redirects)) { irc::modestacker modestack(ServerInstance, false); StringDeque stackresult; std::vector mode_junk; mode_junk.push_back(chan->name); - + for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++) { modestack.Push('b', i->targetchan.insert(0, i->banmask)); } - + for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++) { modestack.PushPlus(); modestack.Push('b', i->banmask); } - + while(modestack.GetStackedLine(stackresult)) { for(StringDeque::size_type i = 0; i < stackresult.size(); i++) { mode_junk.push_back(stackresult[i]); } - + ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient); } - + delete redirects; chan->Shrink("banredirects"); } @@ -269,11 +269,11 @@ class ModuleBanRedirect : public Module if (chan) { BanRedirectList* redirects; - + if(chan->GetExt("banredirects", redirects)) { /* We actually had some ban redirects to check */ - + /* This was replaced with user->MakeHostIP() when I had a snprintf(), but MakeHostIP() doesn't seem to add the nick. * Maybe we should have a GetFullIPHost() or something to match GetFullHost() and GetFullRealHost? */ @@ -288,14 +288,14 @@ class ModuleBanRedirect : public Module std::string ipmask(user->nick); ipmask.append(1, '!').append(user->MakeHostIP()); - + for(BanRedirectList::iterator redir = redirects->begin(); redir != redirects->end(); redir++) { if(ServerInstance->MatchText(user->GetFullRealHost(), redir->banmask) || ServerInstance->MatchText(user->GetFullHost(), redir->banmask) || ServerInstance->MatchText(ipmask, redir->banmask)) { /* tell them they're banned and are being transferred */ Channel* destchan = ServerInstance->FindChan(redir->targetchan); - + if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit)) { user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str()); @@ -322,12 +322,12 @@ class ModuleBanRedirect : public Module ServerInstance->Modes->DelModeWatcher(re); delete re; } - + virtual Version GetVersion() { return Version(1, 0, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + void Prioritize() { Module* banex = ServerInstance->Modules->Find("m_banexception.so"); diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index cf390f165..9d42571e2 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -42,7 +42,7 @@ class ModuleBlockAmsg : public Module { int ForgetDelay; BlockAction action; - + public: ModuleBlockAmsg(InspIRCd* Me) : Module(Me) { @@ -51,27 +51,27 @@ class ModuleBlockAmsg : public Module ServerInstance->Modules->Attach(eventlist, this, 3); } - + virtual ~ModuleBlockAmsg() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - + virtual void OnRehash(User* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); - + ForgetDelay = Conf.ReadInteger("blockamsg", "delay", 0, false); - + if(Conf.GetError() == CONF_VALUE_NOT_FOUND) ForgetDelay = -1; - + std::string act = Conf.ReadValue("blockamsg", "action", 0); - + if(act == "notice") action = IBLOCK_NOTICE; else if(act == "noticeopers") @@ -89,30 +89,30 @@ class ModuleBlockAmsg : public Module // Don't do anything with unregistered users, or remote ones. if(!user || (user->registered != REG_ALL) || !IS_LOCAL(user)) return 0; - + // We want case insensitive command comparison. // Add std::string contructor for irc::string :x irc::string cmd = command.c_str(); - + if(validated && (cmd == "PRIVMSG" || cmd == "NOTICE") && (parameters.size() >= 2)) { // parameters[0] should have the target(s) in it. // I think it will be faster to first check if there are any commas, and if there are then try and parse it out. // Most messages have a single target so... - + int targets = 1; int userchans = 0; - + if(*parameters[0].c_str() != '#') { // Decrement if the first target wasn't a channel. targets--; } - + for(const char* c = parameters[0].c_str(); *c; c++) if((*c == ',') && *(c+1) && (*(c+1) == '#')) targets++; - + /* targets should now contain the number of channel targets the msg/notice was pointed at. * If the msg/notice was a PM there should be no channel targets and 'targets' should = 0. * We don't want to block PMs so... @@ -121,13 +121,13 @@ class ModuleBlockAmsg : public Module { return 0; } - + userchans = user->chans.size(); // Check that this message wasn't already sent within a few seconds. BlockedMessage* m; user->GetExt("amsgblock", m); - + // If the message is identical and within the time. // We check the target is *not* identical, that'd straying into the realms of flood control. Which isn't what we're doing... // OR @@ -143,10 +143,10 @@ class ModuleBlockAmsg : public Module ServerInstance->Users->QuitUser(user, "Global message (/amsg or /ame) detected"); else if(action == IBLOCK_NOTICE || action == IBLOCK_NOTICEOPERS) user->WriteServ( "NOTICE %s :Global message (/amsg or /ame) detected", user->nick.c_str()); - + return 1; } - + if(m) { // If there's already a BlockedMessage allocated, use it. @@ -159,10 +159,10 @@ class ModuleBlockAmsg : public Module m = new BlockedMessage(parameters[1], parameters[0].c_str(), ServerInstance->Time()); user->Extend("amsgblock", (char*)m); } - } + } return 0; } - + void OnCleanup(int target_type, void* item) { if(target_type == TYPE_USER) diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 29e481c1e..0b47f8821 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -31,7 +31,7 @@ class ModuleBlockCAPS : public Module unsigned int minlen; char capsmap[256]; public: - + ModuleBlockCAPS(InspIRCd* Me) : Module(Me) { OnRehash(NULL,""); diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 72f41801e..3943e436d 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -25,10 +25,10 @@ class BlockColor : public SimpleChannelModeHandler class ModuleBlockColour : public Module { - bool AllowChanOps; + bool AllowChanOps; BlockColor *bc; public: - + ModuleBlockColour(InspIRCd* Me) : Module(Me) { bc = new BlockColor(ServerInstance); @@ -50,7 +50,7 @@ class ModuleBlockColour : public Module { return 0; } - + if(c->IsModeSet('c')) { for (std::string::iterator i = text.begin(); i != text.end(); i++) @@ -72,7 +72,7 @@ class ModuleBlockColour : public Module } return 0; } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); @@ -83,7 +83,7 @@ class ModuleBlockColour : public Module ServerInstance->Modes->DelMode(bc); delete bc; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 7cc050403..2aa425643 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -25,13 +25,13 @@ class BotMode : public SimpleUserModeHandler class ModuleBotMode : public Module { - + BotMode* bm; public: ModuleBotMode(InspIRCd* Me) : Module(Me) { - + bm = new BotMode(ServerInstance); if (!ServerInstance->Modes->AddMode(bm)) throw ModuleException("Could not add new modes!"); @@ -39,13 +39,13 @@ class ModuleBotMode : public Module ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleBotMode() { ServerInstance->Modes->DelMode(bm); delete bm; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index d41fcd5d0..1d53a30f7 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -51,7 +51,7 @@ void RemoveFromAllAccepts(InspIRCd* ServerInstance, User* who) for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); ++i) { callerid_data* dat = GetData(i->second, false); - + if (!dat) continue; diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 2849444b4..4f66008a5 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -20,11 +20,11 @@ CAP LS :alfred.staticbox.net CAP * LS :multi-prefix sasl CAP REQ :multi-prefix -:alfred.staticbox.net CAP * ACK :multi-prefix +:alfred.staticbox.net CAP * ACK :multi-prefix CAP CLEAR :alfred.staticbox.net CAP * ACK :-multi-prefix CAP REQ :multi-prefix -:alfred.staticbox.net CAP * ACK :multi-prefix +:alfred.staticbox.net CAP * ACK :multi-prefix CAP LIST :alfred.staticbox.net CAP * LIST :multi-prefix CAP END diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 50260920a..8c4460d76 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -171,7 +171,7 @@ class ModuleCBan : public Module { ServerInstance->XLines->UnregisterFactory(f); } - + virtual int OnStats(char symbol, User* user, string_list &results) { return 0; diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 4ade3e347..46e4daa48 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -39,11 +39,11 @@ class CensorChannel : public SimpleChannelModeHandler class ModuleCensor : public Module { - + censor_t censors; CensorUser *cu; CensorChannel *cc; - + public: ModuleCensor(InspIRCd* Me) : Module(Me) @@ -110,7 +110,7 @@ class ModuleCensor : public Module irc::string text2 = text.c_str(); for (censor_t::iterator index = censors.begin(); index != censors.end(); index++) - { + { if (text2.find(index->first) != irc::string::npos) { if (index->second.empty()) @@ -118,19 +118,19 @@ class ModuleCensor : public Module user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str()); return 1; } - + this->ReplaceLine(text2,index->first,index->second); } } text = text2.c_str(); return 0; } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); } - + virtual void OnRehash(User* user, const std::string ¶meter) { /* @@ -149,12 +149,12 @@ class ModuleCensor : public Module delete MyConf; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleCensor) diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 318c1b3b4..a9abb4b15 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -65,7 +65,7 @@ class CommandWebirc : public Command { if(user->registered == REG_ALL) return CMD_FAILURE; - + for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++) { if(ServerInstance->MatchText(user->host, iter->hostmask) || ServerInstance->MatchText(user->GetIPString(), iter->hostmask)) @@ -140,7 +140,7 @@ class ModuleCgiIRC : public Module public: ModuleCgiIRC(InspIRCd* Me) : Module(Me) { - + OnRehash(NULL,""); mycommand = new CommandWebirc(Me, Hosts, NotifyOpers); ServerInstance->AddCommand(mycommand); @@ -149,7 +149,7 @@ public: ServerInstance->Modules->Attach(eventlist, this, 7); } - + virtual void Prioritize() { ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIO_FIRST); @@ -159,18 +159,18 @@ public: { ConfigReader Conf(ServerInstance); Hosts.clear(); - + NotifyOpers = Conf.ReadFlag("cgiirc", "opernotice", 0); // If we send an oper notice when a CGI:IRC has their host changed. - + if(Conf.GetError() == CONF_VALUE_NOT_FOUND) NotifyOpers = true; - + for(int i = 0; i < Conf.Enumerate("cgihost"); i++) { std::string hostmask = Conf.ReadValue("cgihost", "mask", i); // An allowed CGI:IRC host std::string type = Conf.ReadValue("cgihost", "type", i); // What type of user-munging we do on this host. std::string password = Conf.ReadValue("cgihost", "password", i); - + if(hostmask.length()) { if (type == "webirc" && !password.length()) { @@ -211,13 +211,13 @@ public: User* user = (User*)item; std::string* realhost; std::string* realip; - + if(user->GetExt("cgiirc_realhost", realhost)) { delete realhost; user->Shrink("cgiirc_realhost"); } - + if(user->GetExt("cgiirc_realip", realip)) { delete realip; @@ -225,13 +225,13 @@ public: } } } - + virtual void OnSyncUserMetaData(User* user, Module* proto, void* opaque, const std::string &extname, bool displayable) { if((extname == "cgiirc_realhost") || (extname == "cgiirc_realip")) { std::string* data; - + if(user->GetExt(extname, data)) { proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, *data); @@ -256,12 +256,12 @@ public: { OnCleanup(TYPE_USER, user); } - + virtual int OnUserRegister(User* user) - { + { for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++) - { + { if(ServerInstance->MatchText(user->host, iter->hostmask) || ServerInstance->MatchText(user->GetIPString(), iter->hostmask)) { // Deal with it... @@ -313,7 +313,7 @@ public: bool valid=false; ServerInstance->Users->RemoveCloneCounts(user); #ifdef IPV6 - valid = (inet_pton(AF_INET6, webirc_ip->c_str(), &((sockaddr_in6*)user->ip)->sin6_addr) > 0); + valid = (inet_pton(AF_INET6, webirc_ip->c_str(), &((sockaddr_in6*)user->ip)->sin6_addr) > 0); if(!valid) valid = (inet_aton(webirc_ip->c_str(), &((sockaddr_in*)user->ip)->sin_addr)); @@ -379,34 +379,34 @@ public: ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname!", user->nick.c_str(), user->host.c_str()); } } - + user->password.clear(); return true; } - + return false; } - + bool CheckIdent(User* user) { int ip[4]; const char* ident; char newip[16]; int len = user->ident.length(); - + if(len == 8) ident = user->ident.c_str(); else if(len == 9 && user->ident[0] == '~') ident = user->ident.c_str() + 1; else return false; - + for(int i = 0; i < 4; i++) if(!HexToInt(ip[i], ident + i*2)) return false; snprintf(newip, 16, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - + user->Extend("cgiirc_realhost", new std::string(user->host)); user->Extend("cgiirc_realip", new std::string(user->GetIPString())); ServerInstance->Users->RemoveCloneCounts(user); @@ -442,12 +442,12 @@ public: return true; } - + bool IsValidHost(const std::string &host) { if(!host.size()) return false; - + for(unsigned int i = 0; i < host.size(); i++) { if( ((host[i] >= '0') && (host[i] <= '9')) || @@ -455,12 +455,12 @@ public: ((host[i] >= 'a') && (host[i] <= 'z')) || ((host[i] == '-') && (i > 0) && (i+1 < host.size()) && (host[i-1] != '.') && (host[i+1] != '.')) || ((host[i] == '.') && (i > 0) && (i+1 < host.size())) ) - + continue; else return false; } - + return true; } @@ -468,10 +468,10 @@ public: { if(ip.size() < 7 || ip.size() > 15) return false; - + short sincedot = 0; short dots = 0; - + for(unsigned int i = 0; i < ip.size(); i++) { if((dots <= 3) && (sincedot <= 3)) @@ -489,16 +489,16 @@ public: else { return false; - + } } - + if(dots != 3) return false; - + return true; } - + bool HexToInt(int &out, const char* in) { char ip[3]; @@ -506,22 +506,22 @@ public: ip[1] = in[1]; ip[2] = 0; out = strtol(ip, NULL, 16); - + if(out > 255 || out < 0) return false; return true; } - + virtual ~ModuleCgiIRC() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleCgiIRC) diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index 8633ddc05..1b6ca6192 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -26,18 +26,18 @@ class ModuleChanCreate : public Module Implementation eventlist[] = { I_OnUserJoin }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleChanCreate() { ServerInstance->SNO->DisableSnomask('j'); } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - + virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent) { if (channel->GetUserCounter() == 1) diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index e8d1d1452..4a5dcb2b3 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -26,7 +26,7 @@ class ChanFilter : public ListModeBase { public: ChanFilter(InspIRCd* Instance) : ListModeBase(Instance, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } - + virtual bool ValidateParam(User* user, Channel* chan, std::string &word) { if ((word.length() > 35) || (word.empty())) @@ -34,21 +34,21 @@ class ChanFilter : public ListModeBase user->WriteNumeric(935, "%s %s %s :word is too %s for censor list",user->nick.c_str(), chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long")); return false; } - + return true; } - + virtual bool TellListTooLong(User* user, Channel* chan, std::string &word) { user->WriteNumeric(939, "%s %s %s :Channel spamfilter list is full", user->nick.c_str(), chan->name.c_str(), word.c_str()); return true; } - + virtual void TellAlreadyOnList(User* user, Channel* chan, std::string &word) { user->WriteNumeric(937, "%s %s :The word %s is already on the spamfilter list",user->nick.c_str(), chan->name.c_str(), word.c_str()); } - + virtual void TellNotSet(User* user, Channel* chan, std::string &word) { user->WriteNumeric(938, "%s %s :No such spamfilter word is set",user->nick.c_str(), chan->name.c_str()); @@ -57,11 +57,11 @@ class ChanFilter : public ListModeBase class ModuleChanFilter : public Module { - + ChanFilter* cf; - + public: - + ModuleChanFilter(InspIRCd* Me) : Module(Me) { @@ -123,12 +123,12 @@ class ModuleChanFilter : public Module { cf->DoCleanup(target_type, item); } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); } - + virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque) { cf->DoSyncChannel(chan, proto, opaque); @@ -138,7 +138,7 @@ class ModuleChanFilter : public Module { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + virtual ~ModuleChanFilter() { ServerInstance->Modes->DelMode(cf); diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 94fa164b3..cd84d9c5f 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -69,7 +69,7 @@ class FounderProtectBase std::vector mode_junk; mode_junk.push_back(channel->name); irc::modestacker modestack(MyInstance, false); - std::deque stackresult; + std::deque stackresult; for (CUList::iterator i = cl->begin(); i != cl->end(); i++) { @@ -261,7 +261,7 @@ class ChanProtect : public ModeHandler, public FounderProtectBase } // source has +q, is a server, or ulined, we'll let them +-a the user. if (source == ServerInstance->FakeClient || - ((source == theuser) && (!adding) && (FounderProtectBase::remove_own_privs)) || + ((source == theuser) && (!adding) && (FounderProtectBase::remove_own_privs)) || (ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server) || @@ -287,7 +287,7 @@ class ChanProtect : public ModeHandler, public FounderProtectBase class ModuleChanProtect : public Module { - + bool FirstInGetsFounder; char QPrefix; char APrefix; @@ -296,9 +296,9 @@ class ModuleChanProtect : public Module bool booting; ChanProtect* cp; ChanFounder* cf; - + public: - + ModuleChanProtect(InspIRCd* Me) : Module(Me), FirstInGetsFounder(false), QPrefix(0), APrefix(0), DeprivSelf(false), DeprivOthers(false), booting(true), cp(NULL), cf(NULL) { @@ -365,7 +365,7 @@ class ModuleChanProtect : public Module DeprivSelf = Conf.ReadFlag("options","deprotectself",0); DeprivOthers = Conf.ReadFlag("options","deprotectothers",0); } - + virtual int OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven) { // if the user is the first user into the channel, mark them as the founder, but only if @@ -373,15 +373,15 @@ class ModuleChanProtect : public Module if (FirstInGetsFounder && !chan) privs = QPrefix + "@"; - + return 0; } - + virtual void OnPostJoin(User *user, Channel *channel) { // This *must* be in PostJoin, not UserJoin - the former will make it appear to happen // before the client is in the channel - + // This notice was here originally because it was all done prior to the creation of // privs in OnUserPreJoin. I've left it because it might still be wanted, but i'm // not sure it really should be here - ops don't get shown, obviously, and the prefix @@ -390,7 +390,7 @@ class ModuleChanProtect : public Module if (FirstInGetsFounder && channel->GetUserCounter() == 1) user->WriteServ("MODE %s +q %s", channel->name.c_str(), user->nick.c_str()); } - + virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type) { // here we perform access checks, this is the important bit that actually stops kicking/deopping @@ -401,8 +401,8 @@ class ModuleChanProtect : public Module // (B) Theyre protected, and you're not // always allow the action if: // (A) The source is ulined - - + + // firstly, if a ulined nick, or a server, is setting the mode, then allow them to set the mode // without any access checks, we're not worthy :p if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server)) @@ -469,11 +469,11 @@ class ModuleChanProtect : public Module } break; } - + // we dont know what this access check is, or dont care. just carry on, nothing to see here. return ACR_DEFAULT; } - + virtual ~ModuleChanProtect() { ServerInstance->Modes->DelMode(cp); @@ -481,7 +481,7 @@ class ModuleChanProtect : public Module delete cp; delete cf; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 81354609f..ac9e8f2ac 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -107,7 +107,7 @@ class CommandCheck : public Command user->WriteServ(checkstr + " modes " + targchan->ChanModes(true)); user->WriteServ(checkstr + " membercount " + ConvToStr(targchan->GetUserCounter())); - + /* now the ugly bit, spool current members of a channel. :| */ CUList *ulist= targchan->GetUsers(); @@ -161,22 +161,22 @@ class ModuleCheck : public Module public: ModuleCheck(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandCheck(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleCheck() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleCheck) diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index e927ca69a..67b39cb66 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -28,7 +28,7 @@ class CommandChghost : public Command syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - + CmdResult Handle(const std::vector ¶meters, User *user) { const char * x = parameters[1].c_str(); @@ -46,7 +46,7 @@ class CommandChghost : public Command user->WriteServ("NOTICE %s :*** CHGHOST: Host must be specified", user->nick.c_str()); return CMD_FAILURE; } - + if ((parameters[1].c_str() - x) > 63) { user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick.c_str()); @@ -94,7 +94,7 @@ class ModuleChgHost : public Module ServerInstance->Modules->Attach(eventlist, this, 1); } - + void OnRehash(User* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); @@ -111,12 +111,12 @@ class ModuleChgHost : public Module ~ModuleChgHost() { } - + Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleChgHost) diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 3ab558b57..4c8b256e4 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -26,7 +26,7 @@ class CommandChgident : public Command syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - + CmdResult Handle(const std::vector ¶meters, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); @@ -42,13 +42,13 @@ class CommandChgident : public Command user->WriteServ("NOTICE %s :*** CHGIDENT: Ident must be specified", user->nick.c_str()); return CMD_FAILURE; } - + if (parameters[1].length() > ServerInstance->Config->Limits.IdentMax) { user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str()); return CMD_FAILURE; } - + if (!ServerInstance->IsIdent(parameters[1].c_str())) { user->WriteServ("NOTICE %s :*** CHGIDENT: Invalid characters in ident", user->nick.c_str()); @@ -69,8 +69,8 @@ class CommandChgident : public Command class ModuleChgIdent : public Module { CommandChgident* mycommand; - - + + public: ModuleChgIdent(InspIRCd* Me) : Module(Me) { @@ -78,16 +78,16 @@ public: ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleChgIdent() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleChgIdent) diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 936cd72ac..787980d80 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -26,7 +26,7 @@ class CommandChgname : public Command syntax = " "; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - + CmdResult Handle(const std::vector ¶meters, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); @@ -36,19 +36,19 @@ class CommandChgname : public Command user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } - + if (parameters[1].empty()) { user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick.c_str()); return CMD_FAILURE; } - + if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos) { user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str()); return CMD_FAILURE; } - + if (IS_LOCAL(dest)) { dest->ChangeName(parameters[1].c_str()); @@ -65,8 +65,8 @@ class CommandChgname : public Command class ModuleChgName : public Module { CommandChgname* mycommand; - - + + public: ModuleChgName(InspIRCd* Me) : Module(Me) { @@ -74,16 +74,16 @@ public: ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleChgName() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleChgName) diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index e0ca026bb..64ba71d95 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -39,7 +39,7 @@ class CloakUser : public ModeHandler * For example, if it is passed "svn.inspircd.org" it will return ".inspircd.org". * If it is passed "brainbox.winbot.co.uk" it will return ".co.uk", * and if it is passed "localhost.localdomain" it will return ".localdomain". - * + * * This is used to ensure a significant part of the host is always cloaked (see Bug #216) */ std::string LastTwoDomainParts(const std::string &host) @@ -111,11 +111,11 @@ class CloakUser : public ModeHandler } } else - { + { if (dest->IsModeSet('x')) { - /* User is removing the mode, so just restore their real host - * and make it match the displayed one. + /* User is removing the mode, so just restore their real host + * and make it match the displayed one. */ dest->ChangeDisplayedHost(dest->host.c_str()); dest->SetMode('x',false); @@ -196,13 +196,13 @@ class CloakUser : public ModeHandler /* Stick them all together */ return irc::stringjoiner(":", hashies, 0, hashies.size() - 1).GetJoined(); } - + void DoRehash() { ConfigReader Conf(ServerInstance); bool lowercase; - - /* These are *not* using the need_positive parameter of ReadInteger - + + /* These are *not* using the need_positive parameter of ReadInteger - * that will limit the valid values to only the positive values in a * signed int. Instead, accept any value that fits into an int and * cast it to an unsigned int. That will, a bit oddly, give us the full @@ -215,7 +215,7 @@ class CloakUser : public ModeHandler prefix = Conf.ReadValue("cloak","prefix",0); ipalways = Conf.ReadFlag("cloak", "ipalways", 0); lowercase = Conf.ReadFlag("cloak", "lowercase", 0); - + if (!lowercase) { xtab[0] = "F92E45D871BCA630"; @@ -255,7 +255,7 @@ class CloakUser : public ModeHandler class ModuleCloaking : public Module { private: - + CloakUser* cu; Module* HashModule; @@ -339,14 +339,14 @@ class ModuleCloaking : public Module if (target_type == TYPE_USER) OnUserDisconnect((User*)item); } - + virtual ~ModuleCloaking() { ServerInstance->Modes->DelMode(cu); delete cu; ServerInstance->Modules->DoneWithInterface("HashRequest"); } - + virtual Version GetVersion() { // returns the version number of the module to be @@ -387,7 +387,7 @@ class ModuleCloaking : public Module std::string hostcloak = cu->prefix + "-" + std::string(HashSumRequest(this, cu->HashProvider, dest->host.c_str()).Send()).substr(0,8) + a; /* Fix by brain - if the cloaked host is > the max length of a host (64 bytes - * according to the DNS RFC) then tough titty, they get cloaked as an IP. + * according to the DNS RFC) then tough titty, they get cloaked as an IP. * Their ISP shouldnt go to town on subdomains, or they shouldnt have a kiddie * vhost. */ diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 02f0f3fae..43d0bb1c7 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -65,22 +65,22 @@ class ModuleClones : public Module public: ModuleClones(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandClones(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleClones() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleClones) diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index a99036049..b9ad87587 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -12,7 +12,7 @@ * * Based on the UnrealIRCd 4.0 (1.1.x fork) module * - * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk + * UnrealIRCd 4.0 (C) 2007 Carsten Valdemar Munk * This program is free but copyrighted software; see * the file COPYING for details. * @@ -58,7 +58,7 @@ class CommandClose : public Command user->WriteServ("NOTICE %s :*** %i unknown connection%s closed",user->nick.c_str(),total,(total>1)?"s":""); else user->WriteServ("NOTICE %s :*** No unknown connections found",user->nick.c_str()); - + return CMD_LOCALONLY; } }; diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 9e31d428e..e0552f0d7 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -40,7 +40,7 @@ class PrivacyMode : public ModeHandler return MODEACTION_ALLOW; } } - + return MODEACTION_DENY; } }; @@ -58,13 +58,13 @@ class ModulePrivacyMode : public Module ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual ~ModulePrivacyMode() { ServerInstance->Modes->DelMode(pm); delete pm; } - + virtual Version GetVersion() { return Version(1,2,0,0, VF_COMMON|VF_VENDOR, API_VERSION); diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index 606794d10..21c03922e 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -20,7 +20,7 @@ class ModuleConnJoin : public Module private: std::string JoinChan; std::vector Joinchans; - + int tokenize(const std::string &str, std::vector &tokens) { diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index ab017b157..e7ff2c584 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -26,7 +26,7 @@ class ModuleModesOnConnect : public Module ModuleModesOnConnect(InspIRCd* Me) : Module(Me) { - + Conf = new ConfigReader(ServerInstance); Implementation eventlist[] = { I_OnPostConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -38,17 +38,17 @@ class ModuleModesOnConnect : public Module delete Conf; Conf = new ConfigReader(ServerInstance); } - + virtual ~ModuleModesOnConnect() { delete Conf; } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + virtual void OnPostConnect(User* user) { if (!IS_LOCAL(user)) diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 8d631b4f0..c27ee0c81 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -29,16 +29,16 @@ class ModuleWaitPong : public Module Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash, I_OnUserDisconnect, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 6); } - + virtual void OnRehash(User* user, const std::string ¶m) { ConfigReader Conf(ServerInstance); - + sendsnotice = Conf.ReadFlag("waitpong", "sendsnotice", 0); - + if(Conf.GetError() == CONF_VALUE_NOT_FOUND) sendsnotice = true; - + killonbadreply = Conf.ReadFlag("waitpong", "killonbadreply", 0); if(Conf.GetError() == CONF_VALUE_NOT_FOUND) @@ -52,30 +52,30 @@ class ModuleWaitPong : public Module for(unsigned int i = 0; i < length; i++) out[i] = ((rand() % 26) + 65); out[length] = '\0'; - + return (char*)out; } - + virtual int OnUserRegister(User* user) { char* pingrpl = RandString(10); - + user->Write("PING :%s", pingrpl); - + if(sendsnotice) user->WriteServ("NOTICE %s :*** If you are having problems connecting due to ping timeouts, please type /quote PONG %s or /raw PONG %s now.", user->nick.c_str(), pingrpl, pingrpl); - + user->Extend(extenstr, pingrpl); return 0; } - + virtual int OnPreCommand(std::string &command, std::vector ¶meters, User* user, bool validated, const std::string &original_line) { if (command == "PONG") { char* pingrpl; user->GetExt(extenstr, pingrpl); - + if (pingrpl) { if (strcmp(pingrpl, parameters[0].c_str()) == 0) @@ -100,7 +100,7 @@ class ModuleWaitPong : public Module char* pingrpl; return (!user->GetExt(extenstr, pingrpl)); } - + virtual void OnUserDisconnect(User* user) { char* pingrpl; @@ -112,7 +112,7 @@ class ModuleWaitPong : public Module user->Shrink(extenstr); } } - + virtual void OnCleanup(int target_type, void* item) { if (target_type == TYPE_USER) @@ -120,24 +120,24 @@ class ModuleWaitPong : public Module User* user = (User*)item; char* pingrpl; user->GetExt(extenstr, pingrpl); - + if (pingrpl) { delete[] pingrpl; user->Shrink(extenstr); - } + } } } - + virtual ~ModuleWaitPong() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleWaitPong) diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index a1ff0816c..8c39ae8ba 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -29,11 +29,11 @@ class ModuleQuitBan : public Module ServerInstance->Modules->Attach(eventlist, this, 3); OnRehash(NULL, ""); } - + virtual ~ModuleQuitBan() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 412a0965e..d25b6abfc 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -25,12 +25,12 @@ private: std::string quitmsg; ConfigReader* conf; - + public: ModuleConnFlood(InspIRCd* Me) : Module(Me) { - + InitConf(); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -45,7 +45,6 @@ public: return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - void InitConf() { /* read configuration variables */ @@ -61,14 +60,14 @@ public: first = ServerInstance->Time(); } - + virtual int OnUserRegister(User* user) { time_t next = ServerInstance->Time(); - + if ((ServerInstance->startup_time + boot_wait) > next) return 0; - + /* time difference between first and latest connection */ time_t tdiff = next - first; diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index b7e67b507..b15b308d0 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -20,7 +20,6 @@ */ class CommandTitle : public Command { - public: CommandTitle (InspIRCd* Instance) : Command(Instance,"TITLE",0,2) { @@ -29,25 +28,25 @@ class CommandTitle : public Command TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } -bool OneOfMatches(const char* host, const char* ip, const char* hostlist) -{ - std::stringstream hl(hostlist); - std::string xhost; - while (hl >> xhost) - { - if (match(host, xhost) || match(ip,xhost, true)) - { - return true; - } - } - return false; -} + bool OneOfMatches(const char* host, const char* ip, const char* hostlist) + { + std::stringstream hl(hostlist); + std::string xhost; + while (hl >> xhost) + { + if (match(host, xhost) || match(ip,xhost, true)) + { + return true; + } + } + return false; + } CmdResult Handle(const std::vector ¶meters, User* user) { if (!IS_LOCAL(user)) return CMD_LOCALONLY; - + char TheHost[MAXBUF]; char TheIP[MAXBUF]; @@ -79,7 +78,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) user->Extend("ctitle", text); ServerInstance->PI->SendMetaData(user, TYPE_USER, "ctitle", *text); - + if (!vhost.empty()) user->ChangeDisplayedHost(vhost.c_str()); @@ -106,11 +105,11 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) class ModuleCustomTitle : public Module { CommandTitle* mycommand; - + public: ModuleCustomTitle(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandTitle(ServerInstance); ServerInstance->AddCommand(mycommand); Implementation eventlist[] = { I_OnDecodeMetaData, I_OnWhoisLine, I_OnSyncUserMetaData, I_OnUserQuit, I_OnCleanup }; @@ -208,11 +207,11 @@ class ModuleCustomTitle : public Module } } } - + virtual ~ModuleCustomTitle() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index be57f8af1..037e570f6 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -31,19 +31,19 @@ class CommandCycle : public Command { Channel* channel = ServerInstance->FindChan(parameters[0]); std::string reason = ConvToStr("Cycling"); - + if (parameters.size() > 1) { /* reason provided, use it */ reason = reason + ": " + parameters[1]; } - + if (!channel) { user->WriteNumeric(403, "%s %s :No such channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } - + if (channel->HasUser(user)) { /* @@ -57,11 +57,11 @@ class CommandCycle : public Command user->WriteServ("NOTICE "+std::string(user->nick)+" :*** You may not cycle, as you are banned on channel " + channel->name); return CMD_FAILURE; } - + /* XXX in the future, this may move to a static Channel method (the delete.) -- w00t */ if (!channel->PartUser(user, reason.c_str())) delete channel; - + Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), true, "", false, ServerInstance->Time()); } @@ -84,21 +84,21 @@ class ModuleCycle : public Module ModuleCycle(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandCycle(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleCycle() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleCycle) diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index a18979878..76658f454 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -66,7 +66,7 @@ class CommandDccallow : public Command else if (parameters.size() > 0) { char action = *parameters[0].c_str(); - + // if they didn't specify an action, this is probably a command if (action != '+' && action != '-') { @@ -75,7 +75,7 @@ class CommandDccallow : public Command // list current DCCALLOW list DisplayDCCAllowList(user); return CMD_FAILURE; - } + } else if (!strcasecmp(parameters[0].c_str(), "HELP")) { // display help @@ -83,13 +83,13 @@ class CommandDccallow : public Command return CMD_FAILURE; } } - + std::string nick = parameters[0].substr(1); User *target = ServerInstance->FindNick(nick); - + if (target) { - + if (action == '-') { // check if it contains any entries @@ -110,7 +110,7 @@ class CommandDccallow : public Command { delete dl; user->Shrink("dccallow_list"); - + // remove from userlist for (userlist::iterator j = ul.begin(); j != ul.end(); ++j) { @@ -145,15 +145,15 @@ class CommandDccallow : public Command return CMD_FAILURE; } } - + std::string mask = std::string(target->nick)+"!"+std::string(target->ident)+"@"+std::string(target->dhost); std::string default_length = Conf->ReadValue("dccallow", "length", 0); - + long length; if (parameters.size() < 2) { length = ServerInstance->Duration(default_length); - } + } else if (!atoi(parameters[1].c_str())) { length = 0; @@ -162,14 +162,14 @@ class CommandDccallow : public Command { length = ServerInstance->Duration(parameters[1]); } - + if (!ServerInstance->IsValidMask(mask.c_str())) { return CMD_FAILURE; } - + dl->push_back(DCCAllow(target->nick, mask, ServerInstance->Time(), length)); - + if (length > 0) { user->WriteNumeric(993, "%s %s :Added %s to DCCALLOW list for %ld seconds", user->nick.c_str(), user->nick.c_str(), target->nick.c_str(), length); @@ -216,12 +216,12 @@ class CommandDccallow : public Command user->WriteNumeric(998, "%s : your DCCALLOW list will be deleted when you leave IRC.", user->nick.c_str()); user->WriteNumeric(999, "%s :End of DCCALLOW HELP", user->nick.c_str()); } - + void DisplayDCCAllowList(User* user) { // display current DCCALLOW list user->WriteNumeric(990, "%s :Users on your DCCALLOW list:", user->nick.c_str()); - + if (user->GetExt("dccallow_list", dl)) { for (dccallowlist::const_iterator c = dl->begin(); c != dl->end(); ++c) @@ -229,12 +229,12 @@ class CommandDccallow : public Command user->WriteNumeric(991, "%s %s :%s (%s)", user->nick.c_str(), user->nick.c_str(), c->nickname.c_str(), c->hostmask.c_str()); } } - + user->WriteNumeric(992, "%s :End of DCCALLOW list", user->nick.c_str()); - } + } }; - + class ModuleDCCAllow : public Module { CommandDccallow* mycommand; @@ -261,7 +261,7 @@ class ModuleDCCAllow : public Module virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { dccallowlist* udl; - + // remove their DCCALLOW list if they have one if (user->GetExt("dccallow_list", udl)) { @@ -269,7 +269,7 @@ class ModuleDCCAllow : public Module user->Shrink("dccallow_list"); RemoveFromUserlist(user); } - + // remove them from any DCCALLOW lists // they are currently on RemoveNick(user); @@ -299,43 +299,43 @@ class ModuleDCCAllow : public Module /* Always allow a user to dcc themselves (although... why?) */ if (user == u) return 0; - + if ((text.length()) && (text[0] == '\1')) { Expire(); // :jamie!jamie@test-D4457903BA652E0F.silverdream.org PRIVMSG eimaj :DCC SEND m_dnsbl.cpp 3232235786 52650 9676 // :jamie!jamie@test-D4457903BA652E0F.silverdream.org PRIVMSG eimaj :VERSION - + if (strncmp(text.c_str(), "\1DCC ", 5) == 0) - { + { if (u->GetExt("dccallow_list", dl) && dl->size()) { for (dccallowlist::const_iterator iter = dl->begin(); iter != dl->end(); ++iter) if (ServerInstance->MatchText(user->GetFullHost(), iter->hostmask)) return 0; } - + // tokenize std::stringstream ss(text); std::string buf; std::vector tokens; - + while (ss >> buf) tokens.push_back(buf); - + irc::string type = tokens[1].c_str(); - + bool blockchat = Conf->ReadFlag("dccallow", "blockchat", 0); - + if (type == "SEND") { std::string defaultaction = Conf->ReadValue("dccallow", "action", 0); std::string filename = tokens[2]; - - if (defaultaction == "allow") + + if (defaultaction == "allow") return 0; - + for (unsigned int i = 0; i < bfl.size(); i++) { if (ServerInstance->MatchText(filename, bfl[i].filemask)) @@ -366,7 +366,7 @@ class ModuleDCCAllow : public Module } return 0; } - + void Expire() { for (userlist::iterator iter = ul.begin(); iter != ul.end(); ++iter) @@ -397,7 +397,7 @@ class ModuleDCCAllow : public Module } } } - + void RemoveNick(User* user) { /* Iterate through all DCCALLOW lists and remove user */ @@ -412,7 +412,7 @@ class ModuleDCCAllow : public Module { if (i->nickname == user->nick) { - + u->WriteServ("NOTICE %s :%s left the network or changed their nickname and has been removed from your DCCALLOW list", u->nick.c_str(), i->nickname.c_str()); u->WriteNumeric(995, "%s %s :Removed %s from your DCCALLOW list", u->nick.c_str(), u->nick.c_str(), i->nickname.c_str()); dl->erase(i); @@ -454,7 +454,7 @@ class ModuleDCCAllow : public Module bf.action = action; bfl.push_back(bf); } - + } virtual ~ModuleDCCAllow() diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 20255abf6..f8a1d0e9f 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -70,7 +70,7 @@ class ModuleDelayJoin : public Module Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnText }; ServerInstance->Modules->Attach(eventlist, this, 6); } - + virtual ~ModuleDelayJoin() { ServerInstance->Modes->DelMode(djm); @@ -183,7 +183,7 @@ class ModuleDelayJoin : public Module user->Shrink("delayjoin_"+channel->name); /* Check if the user is left on any other +D channels, if so don't take away the - * metadata that says theyre on one or more channels + * metadata that says theyre on one or more channels */ for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++) if (f->first->IsModeSet('D')) diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index e847f8c7c..2717d873a 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -20,18 +20,18 @@ class ModuleDenyChannels : public Module { private: - + ConfigReader *Conf; public: ModuleDenyChannels(InspIRCd* Me) : Module(Me) { - + Conf = new ConfigReader(ServerInstance); Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual void OnRehash(User* user, const std::string ¶m) { delete Conf; @@ -41,17 +41,17 @@ class ModuleDenyChannels : public Module { std::string name = Conf->ReadValue("badchan","name",i); std::string redirect = Conf->ReadValue("badchan","redirect",i); - + if (!redirect.empty()) { - + if (!ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax)) { if (user) user->WriteServ("Notice %s :Invalid badchan redirect '%s'", user->nick.c_str(), redirect.c_str()); throw ModuleException("Invalid badchan redirect, not a channel"); } - + for (int j =0; j < Conf->Enumerate("badchan"); j++) { if (match(redirect, Conf->ReadValue("badchan","name",j))) @@ -62,7 +62,7 @@ class ModuleDenyChannels : public Module if (match(redirect, Conf->ReadValue("goodchan","name",k))) goodchan = true; } - + if (!goodchan) { /* is a badchan */ @@ -80,7 +80,7 @@ class ModuleDenyChannels : public Module { delete Conf; } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); @@ -109,7 +109,7 @@ class ModuleDenyChannels : public Module return 0; } } - + if (ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax)) { /* simple way to avoid potential loops: don't redirect to +L channels */ diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 9fd8ba5e5..3b68e1c94 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -143,7 +143,7 @@ class DNSBLResolver : public Resolver { ServerInstance->XLines->ApplyLines(); } - else + else delete zl; break; } @@ -257,7 +257,7 @@ class ModuleDNSBL : public Module e->banaction = str2banaction(MyConf->ReadValue("dnsbl", "action", i)); e->duration = ServerInstance->Duration(MyConf->ReadValue("dnsbl", "duration", i)); - + /* Use portparser for record replies */ /* yeah, logic here is a little messy */ @@ -360,26 +360,26 @@ class ModuleDNSBL : public Module /* don't do anything with this hot potato */ return 0; } - + virtual int OnStats(char symbol, User* user, string_list &results) { if (symbol != 'd') return 0; - + unsigned long total_hits = 0, total_misses = 0; for (std::vector::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++) { total_hits += (*i)->stats_hits; total_misses += (*i)->stats_misses; - + results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS DNSbl \"" + (*i)->name + "\" had " + ConvToStr((*i)->stats_hits) + " hits and " + ConvToStr((*i)->stats_misses) + " misses"); } - + results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total hits: " + ConvToStr(total_hits)); results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total misses: " + ConvToStr(total_misses)); - + return 0; } }; diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 2be2cfeca..3609d0d10 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -21,7 +21,7 @@ typedef std::map filter_t; class ModuleFilter : public FilterBase { - + filter_t filters; public: @@ -31,7 +31,7 @@ class ModuleFilter : public FilterBase OnRehash(NULL,""); } - + virtual ~ModuleFilter() { } diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp index 667a739a5..7a8ac8e32 100644 --- a/src/modules/m_foobar.cpp +++ b/src/modules/m_foobar.cpp @@ -21,41 +21,41 @@ class ModuleFoobar : public Module { private: - + // It is recommended that your class makes use of one or more Server // objects. A server object is a class which contains methods which // encapsulate the exports from the core of the ircd. // such methods include Debug, SendChannel, etc. - - + + public: ModuleFoobar(InspIRCd* Me) : Module(Me) { // The constructor just makes a copy of the server class - - + + Implementation eventlist[] = { I_OnUserConnect, I_OnUserQuit, I_OnUserJoin, I_OnUserPart, I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, 5); } - + virtual ~ModuleFoobar() { } - + virtual Version GetVersion() { // this method instantiates a class of type Version, and returns // the modules version information using it. - + return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + virtual void OnUserConnect(User* user) { // method called when a user connects - + std::string b = user->nick; ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User connecting: "+b); } @@ -63,11 +63,11 @@ class ModuleFoobar : public Module virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { // method called when a user disconnects - + std::string b = user->nick; ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User quitting: "+b); } - + virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent) { // method called when a user joins a channel @@ -80,7 +80,7 @@ class ModuleFoobar : public Module virtual void OnUserPart(User* user, Channel* channel, const std::string &partreason, bool &silent) { // method called when a user parts a channel - + std::string c = channel->name; std::string b = user->nick; ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User "+b+" parted "+c); diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 2f39a66e6..d24f23aa9 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -124,11 +124,11 @@ class ModuleGlobalLoad : public Module CommandGloadmodule *mycommand; CommandGunloadmodule *mycommand2; CommandGreloadmodule *mycommand3; - + public: ModuleGlobalLoad(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandGloadmodule(ServerInstance); mycommand2 = new CommandGunloadmodule(ServerInstance); mycommand3 = new CommandGreloadmodule(ServerInstance); @@ -137,11 +137,11 @@ class ModuleGlobalLoad : public Module ServerInstance->AddCommand(mycommand3); } - + virtual ~ModuleGlobalLoad() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 81aef9f57..fafc3df2c 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -55,12 +55,12 @@ class ModuleGlobops : public Module ServerInstance->SNO->EnableSnomask('g',"GLOBOPS"); } - + virtual ~ModuleGlobops() { ServerInstance->SNO->DisableSnomask('g'); } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index a7f9e4007..1a1867e07 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -48,7 +48,7 @@ class CommandHelpop : public Command user->WriteServ("NOTICE %s :HELPOP topic index", user->nick.c_str()); for (std::map::iterator iter = helpop_map.begin(); iter != helpop_map.end(); iter++) { - user->WriteServ("NOTICE %s : %s", user->nick.c_str(), iter->first.c_str()); + user->WriteServ("NOTICE %s : %s", user->nick.c_str(), iter->first.c_str()); } user->WriteServ("NOTICE %s :*** End of HELPOP topic index", user->nick.c_str()); } @@ -152,7 +152,7 @@ class ModuleHelpop : public Module ServerInstance->Modes->DelMode(ho); delete ho; } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index 0788a1eaf..c111e323d 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -40,20 +40,20 @@ class HideChans : public ModeHandler return MODEACTION_ALLOW; } } - + return MODEACTION_DENY; } }; class ModuleHideChans : public Module { - + HideChans* hm; public: ModuleHideChans(InspIRCd* Me) : Module(Me) { - + hm = new HideChans(ServerInstance); if (!ServerInstance->Modes->AddMode(hm)) throw ModuleException("Could not add new modes!"); @@ -61,13 +61,13 @@ class ModuleHideChans : public Module ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleHideChans() { ServerInstance->Modes->DelMode(hm); delete hm; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 722904360..97cb53c76 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -40,20 +40,20 @@ class HideOper : public ModeHandler return MODEACTION_ALLOW; } } - + return MODEACTION_DENY; } }; class ModuleHideOper : public Module { - + HideOper* hm; public: ModuleHideOper(InspIRCd* Me) : Module(Me) { - + hm = new HideOper(ServerInstance); if (!ServerInstance->Modes->AddMode(hm)) throw ModuleException("Could not add new modes!"); @@ -61,13 +61,13 @@ class ModuleHideOper : public Module ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleHideOper() { ServerInstance->Modes->DelMode(hm); delete hm; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 7861823f1..95c40d65e 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -35,7 +35,7 @@ class ModuleHostChange : public Module std::string MySuffix; std::string MyPrefix; std::string MySeparator; - + public: ModuleHostChange(InspIRCd* Me) : Module(Me) @@ -44,7 +44,7 @@ class ModuleHostChange : public Module Implementation eventlist[] = { I_OnRehash, I_OnUserConnect }; ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual ~ModuleHostChange() { for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++) @@ -85,14 +85,14 @@ class ModuleHostChange : public Module hostchanges[mask] = x; } } - + virtual Version GetVersion() { // returns the version number of the module to be // listed in /MODULES return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + virtual void OnUserConnect(User* user) { for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++) @@ -142,7 +142,7 @@ class ModuleHostChange : public Module } if (complete.empty()) complete = "i-have-a-lame-nick"; - + if (!MyPrefix.empty()) newhost = MyPrefix + MySeparator + complete; else diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 7c93a70b6..eba78b98b 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -38,7 +38,7 @@ class HttpServerSocket : public BufferedSocket { FileReader* index; HttpState InternalState; - + HTTPHeaders headers; std::string reqbuffer; std::string postdata; @@ -46,7 +46,7 @@ class HttpServerSocket : public BufferedSocket std::string request_type; std::string uri; std::string http_version; - + public: HttpServerSocket(InspIRCd* SI, std::string shost, int iport, bool listening, unsigned long maxtime, FileReader* index_page) : BufferedSocket(SI, shost, iport, listening, maxtime), index(index_page), postsize(0) @@ -67,7 +67,7 @@ class HttpServerSocket : public BufferedSocket ~HttpServerSocket() { } - + virtual int OnIncomingConnection(int newsock, char* ip) { if (InternalState == HTTP_LISTEN) @@ -168,21 +168,21 @@ class HttpServerSocket : public BufferedSocket default: return "WTF"; break; - + } } - + void SendHTTPError(int response) { HTTPHeaders empty; std::string data = "Server error "+ConvToStr(response)+": "+Response(response)+"
"+ "Powered by InspIRCd"; - + SendHeaders(data.length(), response, empty); this->Write(data); this->FlushWriteBuffer(); } - + void SendHeaders(unsigned long size, int response, HTTPHeaders &rheaders) { @@ -193,20 +193,20 @@ class HttpServerSocket : public BufferedSocket char *date = asctime(timeinfo); date[strlen(date) - 1] = '\0'; rheaders.CreateHeader("Date", date); - + rheaders.CreateHeader("Server", "InspIRCd/m_httpd.so/1.2"); rheaders.SetHeader("Content-Length", ConvToStr(size)); - + if (size) rheaders.CreateHeader("Content-Type", "text/html"); else rheaders.RemoveHeader("Content-Type"); - + /* Supporting Connection: keep-alive causes a whole world of hurt syncronizing timeouts, * so remove it, its not essential for what we need. */ rheaders.SetHeader("Connection", "Close"); - + this->Write(rheaders.GetFormattedHeaders()); this->Write("\r\n"); } @@ -218,7 +218,7 @@ class HttpServerSocket : public BufferedSocket /* Check that the data read is a valid pointer and it has some content */ if (!data || !*data) return false; - + if (InternalState == HTTP_SERVE_RECV_POSTDATA) { postdata.append(data); @@ -228,54 +228,54 @@ class HttpServerSocket : public BufferedSocket else { reqbuffer.append(data); - + if (reqbuffer.length() >= 8192) { Instance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer"); reqbuffer.clear(); return false; } - + if (InternalState == HTTP_SERVE_WAIT_REQUEST) CheckRequestBuffer(); } - + return true; } - + void CheckRequestBuffer() { std::string::size_type reqend = reqbuffer.find("\r\n\r\n"); if (reqend == std::string::npos) return; - + // We have the headers; parse them all std::string::size_type hbegin = 0, hend; while ((hend = reqbuffer.find("\r\n", hbegin)) != std::string::npos) { if (hbegin == hend) break; - + if (request_type.empty()) { std::istringstream cheader(std::string(reqbuffer, hbegin, hend - hbegin)); cheader >> request_type; cheader >> uri; cheader >> http_version; - + if (request_type.empty() || uri.empty() || http_version.empty()) { SendHTTPError(400); SetWrite(); return; } - + hbegin = hend + 2; continue; } - + std::string cheader = reqbuffer.substr(hbegin, hend - hbegin); - + std::string::size_type fieldsep = cheader.find(':'); if ((fieldsep == std::string::npos) || (fieldsep == 0) || (fieldsep == cheader.length() - 1)) { @@ -283,28 +283,28 @@ class HttpServerSocket : public BufferedSocket SetWrite(); return; } - + headers.SetHeader(cheader.substr(0, fieldsep), cheader.substr(fieldsep + 2)); - + hbegin = hend + 2; } - + reqbuffer.erase(0, reqend + 4); - + std::transform(request_type.begin(), request_type.end(), request_type.begin(), ::toupper); std::transform(http_version.begin(), http_version.end(), http_version.begin(), ::toupper); - + if ((http_version != "HTTP/1.1") && (http_version != "HTTP/1.0")) { SendHTTPError(505); SetWrite(); return; } - + if (headers.IsSet("Content-Length") && (postsize = atoi(headers.GetHeader("Content-Length").c_str())) != 0) { InternalState = HTTP_SERVE_RECV_POSTDATA; - + if (reqbuffer.length() >= postsize) { postdata = reqbuffer.substr(0, postsize); @@ -315,13 +315,13 @@ class HttpServerSocket : public BufferedSocket postdata = reqbuffer; reqbuffer.clear(); } - + if (postdata.length() >= postsize) ServeData(); - + return; } - + ServeData(); } diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index 685eae5c6..bdcc3be6e 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -38,7 +38,7 @@ class HTTPACL : public Extensible class ModuleHTTPAccessList : public Module { - + std::string stylesheet; bool changed; std::vector acl_list; @@ -226,7 +226,7 @@ class ModuleHTTPAccessList : public Module irc::spacesepstream sep(authorization); std::string authtype; std::string base64; - + sep.GetToken(authtype); if (authtype == "Basic") { diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 84fa3a375..2a3041c22 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -20,7 +20,7 @@ class ModuleHttpStats : public Module { - + std::string stylesheet; bool changed; diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 131a9dca1..d2205b80b 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -20,7 +20,7 @@ class ModuleHttpStats : public Module { - + std::string stylesheet; bool changed; @@ -155,7 +155,7 @@ class ModuleHttpStats : public Module } data << ""; - + ProtoServerList sl; ServerInstance->PI->GetServerList(sl); diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 197a6e5e2..3eded4daf 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -40,7 +40,7 @@ * Using this framework we have a much more stable module. * * A few things to note: - * + * * O The only place that may *delete* an active or inactive * ident socket is OnUserDisconnect in the module class. * Because this is out of scope of the socket class there is @@ -49,7 +49,7 @@ * * O Closure of the ident socket with the Close() method will * not cause removal of the socket from memory or detatchment - * from its 'parent' User class. It will only flag it as an + * from its 'parent' User class. It will only flag it as an * inactive socket in the socket engine. * * O Timeouts are handled in OnCheckReaady at the same time as @@ -106,7 +106,7 @@ class IdentRequestSocket : public EventHandler /* We allocate two of these because sizeof(sockaddr_in6) > sizeof(sockaddr_in) */ sockaddr* s = new sockaddr[2]; sockaddr* addr = new sockaddr[2]; - + #ifdef IPV6 /* Horrid icky nasty ugly berkely socket crap. */ if (v6) @@ -208,7 +208,7 @@ class IdentRequestSocket : public EventHandler #else int req_size = snprintf(req, sizeof(req), "%d,%d\r\n", ntohs(raddr.sin6_port), ntohs(laddr.sin6_port)); #endif - + /* Send failed if we didnt write the whole ident request -- * might as well give up if this happens! */ @@ -345,22 +345,22 @@ class ModuleIdent : public Module Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 5); } - + virtual Version GetVersion() { return Version(1, 2, 1, 0, VF_VENDOR, API_VERSION); } - - + + virtual void OnRehash(User *user, const std::string ¶m) { ConfigReader MyConf(ServerInstance); - + RequestTimeout = MyConf.ReadInteger("ident", "timeout", 0, true); if (!RequestTimeout) RequestTimeout = 5; } - + virtual int OnUserRegister(User *user) { /* User::ident is currently the username field from USER; with m_ident loaded, that diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 32e09ab57..999151f79 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -187,7 +187,7 @@ class ModuleInvisible : public Module return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent) { if (user->IsModeSet('Q')) @@ -253,7 +253,7 @@ class ModuleInvisible : public Module } return 0; } - + virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreNotice(user, dest, target_type, text, status, exempt_list); @@ -265,14 +265,14 @@ class ModuleInvisible : public Module va_list argsPtr; char textbuffer[MAXBUF]; char tb[MAXBUF]; - + va_start(argsPtr, text); vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); snprintf(tb,MAXBUF,":%s %s",user->GetFullHost().c_str(), textbuffer); - + CUList *ulist = channel->GetUsers(); - + for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) { /* User only appears to vanish for non-opers */ diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index a31069791..98b1ab55e 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -52,12 +52,12 @@ public: Implementation eventlist[] = { I_OnRequest, I_On005Numeric, I_OnCheckInvite }; ServerInstance->Modules->Attach(eventlist, this, 3); } - + virtual void On005Numeric(std::string &output) { output.append(" INVEX=I"); } - + virtual int OnCheckInvite(User* user, Channel* chan) { if(chan != NULL) @@ -79,7 +79,7 @@ public: // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything. } - return 0; + return 0; } virtual const char* OnRequest(Request* request) @@ -125,7 +125,7 @@ public: { ie->DoRehash(); } - + virtual Version GetVersion() { return Version(1, 2, 0, 3, VF_VENDOR | VF_COMMON, API_VERSION); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index f6f58f0dc..6c3ffdc57 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -97,7 +97,7 @@ class JoinFlood : public ModeHandler return std::make_pair(true, ConvToStr(x->joins)+":"+ConvToStr(x->secs)); else return std::make_pair(false, parameter); - } + } bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel) { @@ -206,22 +206,22 @@ class JoinFlood : public ModeHandler class ModuleJoinFlood : public Module { - + JoinFlood* jf; - + public: - + ModuleJoinFlood(InspIRCd* Me) : Module(Me) { - + jf = new JoinFlood(ServerInstance); if (!ServerInstance->Modes->AddMode(jf)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreJoin, I_OnUserJoin }; ServerInstance->Modules->Attach(eventlist, this, 3); } - + virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { if (chan) @@ -276,7 +276,7 @@ class ModuleJoinFlood : public Module ServerInstance->Modes->DelMode(jf); delete jf; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 0bb198a4d..424ea9438 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -126,13 +126,13 @@ class ModuleJumpServer : public Module ModuleJumpServer(InspIRCd* Me) : Module(Me) { - + js = new CommandJumpserver(ServerInstance); ServerInstance->AddCommand(js); Implementation eventlist[] = { I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleJumpServer() { } @@ -153,7 +153,7 @@ class ModuleJumpServer : public Module { return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleJumpServer) diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 310c0db3a..21bc25799 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -38,27 +38,27 @@ class KickRejoin : public ModeHandler return std::make_pair(true, channel->GetModeParameter('J')); else return std::make_pair(false, parameter); - } + } bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel) { /* When TS is equal, the alphabetically later one wins */ return (their_param < our_param); } - + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { if (!adding) { // Taking the mode off, we need to clean up. delaylist* dl; - + if (channel->GetExt("norejoinusers", dl)) { delete dl; channel->Shrink("norejoinusers"); } - + if (!channel->IsModeSet('J')) { return MODEACTION_DENY; @@ -114,15 +114,15 @@ class KickRejoin : public ModeHandler class ModuleKickNoRejoin : public Module { - + KickRejoin* kr; - + public: - + ModuleKickNoRejoin(InspIRCd* Me) : Module(Me) { - + kr = new KickRejoin(ServerInstance); if (!ServerInstance->Modes->AddMode(kr)) throw ModuleException("Could not add new modes!"); @@ -138,12 +138,12 @@ public: if (chan->GetExt("norejoinusers", dl)) { std::vector itemstoremove; - + for (delaylist::iterator iter = dl->begin(); iter != dl->end(); iter++) { if (iter->second > time(NULL)) { - if (iter->first == user) + if (iter->first == user) { user->WriteNumeric(495, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)", user->nick.c_str(), chan->name.c_str(), chan->GetModeParameter('J').c_str()); return 1; @@ -155,10 +155,10 @@ public: itemstoremove.push_back(iter->first); } } - + for (unsigned int i = 0; i < itemstoremove.size(); i++) dl->erase(itemstoremove[i]); - + if (!dl->size()) { // Now it's empty.. @@ -169,7 +169,7 @@ public: } return 0; } - + virtual void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent) { if (chan->IsModeSet('J') && (source != user)) @@ -183,18 +183,18 @@ public: (*dl)[user] = time(NULL) + strtoint(chan->GetModeParameter('J')); } } - + virtual void OnChannelDelete(Channel* chan) { delaylist* dl; - + if (chan->GetExt("norejoinusers", dl)) { delete dl; chan->Shrink("norejoinusers"); } } - + virtual void OnCleanup(int target_type, void* item) { if(target_type == TYPE_CHANNEL) @@ -207,7 +207,7 @@ public: ServerInstance->Modes->DelMode(kr); delete kr; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 12dc1c796..3d244ac4f 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -26,7 +26,7 @@ class CommandKnock : public Command syntax = " "; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } - + CmdResult Handle (const std::vector ¶meters, User *user) { Channel* c = ServerInstance->FindChan(parameters[0]); diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 6096f9afa..dbb38734b 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -52,7 +52,7 @@ class ModuleMD5 : public Module void byteSwap(word32 *buf, unsigned words) { byte *p = (byte *)buf; - + do { *buf++ = (word32)((unsigned)p[3] << 8 | p[2]) << 16 | @@ -78,7 +78,7 @@ class ModuleMD5 : public Module ctx->buf[2] = ikey[2]; ctx->buf[3] = ikey[3]; } - + ctx->bytes[0] = 0; ctx->bytes[1] = 0; } @@ -86,13 +86,13 @@ class ModuleMD5 : public Module void MD5Update(MD5Context *ctx, byte const *buf, int len) { word32 t; - + /* Update byte count */ - + t = ctx->bytes[0]; if ((ctx->bytes[0] = t + len) < t) ctx->bytes[1]++; /* Carry from low to high */ - + t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ if ((unsigned)t > (unsigned)len) { @@ -105,7 +105,7 @@ class ModuleMD5 : public Module MD5Transform(ctx->buf, ctx->in); buf += (unsigned)t; len -= (unsigned)t; - + /* Process data in 64-byte chunks */ while (len >= 64) { @@ -115,22 +115,22 @@ class ModuleMD5 : public Module buf += 64; len -= 64; } - + /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } - + void MD5Final(byte digest[16], MD5Context *ctx) { int count = (int)(ctx->bytes[0] & 0x3f); /* Bytes in ctx->in */ byte *p = (byte *)ctx->in + count; /* First unused byte */ - + /* Set the first char of padding to 0x80. There is always room. */ *p++ = 0x80; - + /* Bytes of padding needed to make 56 bytes (-8..55) */ count = 56 - 1 - count; - + if (count < 0) { /* Padding forces an extra block */ memset(p, 0, count+8); @@ -141,26 +141,26 @@ class ModuleMD5 : public Module } memset(p, 0, count+8); byteSwap(ctx->in, 14); - + /* Append length in bits and transform */ ctx->in[14] = ctx->bytes[0] << 3; ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; MD5Transform(ctx->buf, ctx->in); - + byteSwap(ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(ctx)); } - + void MD5Transform(word32 buf[4], word32 const in[16]) { register word32 a, b, c, d; - + a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; - + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); @@ -177,7 +177,7 @@ class ModuleMD5 : public Module MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); @@ -194,7 +194,7 @@ class ModuleMD5 : public Module MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); @@ -211,7 +211,7 @@ class ModuleMD5 : public Module MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); @@ -228,14 +228,14 @@ class ModuleMD5 : public Module MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - + buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } - - + + void MyMD5(void *dest, void *orig, int len, unsigned int* ikey) { MD5Context context; @@ -243,8 +243,8 @@ class ModuleMD5 : public Module MD5Update(&context, (const unsigned char*)orig, len); MD5Final((unsigned char*)dest, &context); } - - + + void GenHash(const char* src, char* dest, const char* xtab, unsigned int* ikey, size_t srclen) { unsigned char bytes[16]; @@ -271,13 +271,13 @@ class ModuleMD5 : public Module Implementation eventlist[] = { I_OnRequest }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleMD5() { ServerInstance->Modules->UnpublishInterface("HashRequest", this); } - + virtual const char* OnRequest(Request* request) { HashRequest* MD5 = (HashRequest*)request; diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index b0065f065..166e252d6 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -192,29 +192,29 @@ class MsgFlood : public ModeHandler return MODEACTION_ALLOW; } } - + return MODEACTION_DENY; } }; class ModuleMsgFlood : public Module { - + MsgFlood* mf; - + public: - + ModuleMsgFlood(InspIRCd* Me) : Module(Me) { - + mf = new MsgFlood(ServerInstance); if (!ServerInstance->Modes->AddMode(mf)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNotice, I_OnUserPreMessage }; ServerInstance->Modules->Attach(eventlist, this, 3); } - + int ProcessMessages(User* user,Channel* dest, const std::string &text) { if (!IS_LOCAL(user) || CHANOPS_EXEMPT(ServerInstance, 'f') && dest->GetStatus(user) == STATUS_OP) @@ -252,7 +252,7 @@ class ModuleMsgFlood : public Module return 1; } } - + return 0; } @@ -260,7 +260,7 @@ class ModuleMsgFlood : public Module { if (target_type == TYPE_CHANNEL) return ProcessMessages(user,(Channel*)dest,text); - + return 0; } @@ -268,7 +268,7 @@ class ModuleMsgFlood : public Module { if (target_type == TYPE_CHANNEL) return ProcessMessages(user,(Channel*)dest,text); - + return 0; } @@ -288,7 +288,7 @@ class ModuleMsgFlood : public Module ServerInstance->Modes->DelMode(mf); delete mf; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 6ad15fa1d..d8ba80735 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -19,7 +19,7 @@ class ModuleNamesX : public Module { public: - + ModuleNamesX(InspIRCd* Me) : Module(Me) { diff --git a/src/modules/m_nickban.cpp b/src/modules/m_nickban.cpp index 09a981b44..c2bd883a8 100644 --- a/src/modules/m_nickban.cpp +++ b/src/modules/m_nickban.cpp @@ -24,11 +24,11 @@ class ModuleNickBan : public Module Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual ~ModuleNickBan() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 3e811da93..34f599a52 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -97,7 +97,7 @@ class NickFlood : public ModeHandler return std::make_pair(true, ConvToStr(x->nicks)+":"+ConvToStr(x->secs)); else return std::make_pair(false, parameter); - } + } bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel) { @@ -207,13 +207,13 @@ class NickFlood : public ModeHandler class ModuleNickFlood : public Module { NickFlood* jf; - + public: - + ModuleNickFlood(InspIRCd* Me) : Module(Me) { - + jf = new NickFlood(ServerInstance); if (!ServerInstance->Modes->AddMode(jf)) throw ModuleException("Could not add new modes!"); @@ -255,7 +255,7 @@ class ModuleNickFlood : public Module return 0; } - + void OnChannelDelete(Channel* chan) { nickfloodsettings *f; @@ -272,7 +272,7 @@ class ModuleNickFlood : public Module ServerInstance->Modes->DelMode(jf); delete jf; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 86054ab3e..caa71b53f 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -110,7 +110,7 @@ class ModuleNickLock : public Module ModuleNickLock(InspIRCd* Me) : Module(Me) { - + cmd1 = new CommandNicklock(ServerInstance); cmd2 = new CommandNickunlock(ServerInstance); ServerInstance->AddCommand(cmd1); @@ -118,11 +118,11 @@ class ModuleNickLock : public Module Implementation eventlist[] = { I_OnUserPreNick, I_OnUserQuit, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 3); } - + virtual ~ModuleNickLock() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 557771697..00eea1309 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -45,15 +45,15 @@ class NoCTCP : public ModeHandler class ModuleNoCTCP : public Module { - + NoCTCP* nc; - + public: - + ModuleNoCTCP(InspIRCd* Me) : Module(Me) { - + nc = new NoCTCP(ServerInstance); if (!ServerInstance->Modes->AddMode(nc)) throw ModuleException("Could not add new modes!"); @@ -66,18 +66,18 @@ class ModuleNoCTCP : public Module { return OnUserPreNotice(user,dest,target_type,text,status,exempt_list); } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user))) { Channel* c = (Channel*)dest; - + if (CHANOPS_EXEMPT(ServerInstance, 'C') && c->GetStatus(user) == STATUS_OP) { return 0; } - + if (c->IsModeSet('C')) { if ((text.length()) && (text[0] == '\1')) diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index f7a3ac692..d9f01f044 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -55,7 +55,7 @@ class ModuleNoInvite : public Module ServerInstance->Modes->DelMode(ni); delete ni; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 74701795b..3956c265f 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -23,15 +23,15 @@ class NoKicks : public SimpleChannelModeHandler class ModuleNoKicks : public Module { - + NoKicks* nk; - + public: - + ModuleNoKicks(InspIRCd* Me) : Module(Me) { - + nk = new NoKicks(ServerInstance); if (!ServerInstance->Modes->AddMode(nk)) throw ModuleException("Could not add new modes!"); @@ -67,7 +67,7 @@ class ModuleNoKicks : public Module ServerInstance->Modes->DelMode(nk); delete nk; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 0e5e967bd..a816018e6 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -50,19 +50,19 @@ class ModuleNoNickChange : public Module ModuleNoNickChange(InspIRCd* Me) : Module(Me) { - + nn = new NoNicks(ServerInstance); ServerInstance->Modes->AddMode(nn); Implementation eventlist[] = { I_OnUserPreNick }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleNoNickChange() { ServerInstance->Modes->DelMode(nn); delete nn; } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index bb5e62229..ae00a126a 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -23,14 +23,14 @@ class NoNotice : public SimpleChannelModeHandler class ModuleNoNotice : public Module { - + NoNotice* nt; public: - + ModuleNoNotice(InspIRCd* Me) : Module(Me) { - + nt = new NoNotice(ServerInstance); if (!ServerInstance->Modes->AddMode(nt)) throw ModuleException("Could not add new modes!"); @@ -38,7 +38,7 @@ class ModuleNoNotice : public Module ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user))) @@ -71,7 +71,7 @@ class ModuleNoNotice : public Module ServerInstance->Modes->DelMode(nt); delete nt; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 4600760f2..020e097ff 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -46,13 +46,13 @@ class OperChans : public ModeHandler class ModuleOperChans : public Module { - + OperChans* oc; public: ModuleOperChans(InspIRCd* Me) : Module(Me) { - + oc = new OperChans(ServerInstance); if (!ServerInstance->Modes->AddMode(oc)) throw ModuleException("Could not add new modes!"); @@ -76,13 +76,13 @@ class ModuleOperChans : public Module } return 0; } - + virtual ~ModuleOperChans() { ServerInstance->Modes->DelMode(oc); delete oc; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR|VF_COMMON,API_VERSION); diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index b0976b1cc..4b05b372a 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -54,7 +54,7 @@ class ModuleOperjoin : public Module virtual void OnRehash(User* user, const std::string ¶meter) { ConfigReader* conf = new ConfigReader(ServerInstance); - + operChan = conf->ReadValue("operjoin", "channel", 0); override = conf->ReadFlag("operjoin", "override", "0", 0); operChans.clear(); diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 9c82222c1..10e4503f8 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -18,31 +18,31 @@ class ModuleOperLog : public Module { private: - + public: ModuleOperLog(InspIRCd* Me) : Module(Me) { - + Implementation eventlist[] = { I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual ~ModuleOperLog() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - + virtual int OnPreCommand(std::string &command, std::vector ¶meters, User *user, bool validated, const std::string &original_line) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) return 0; - + if ((IS_OPER(user)) && (IS_LOCAL(user)) && (user->HasPermission(command))) { Command* thiscommand = ServerInstance->Parser->GetHandler(command); @@ -59,6 +59,6 @@ class ModuleOperLog : public Module } }; - - + + MODULE_INIT(ModuleOperLog) diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 4184409f1..0d923d7cb 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -19,14 +19,14 @@ class ModuleModesOnOper : public Module { private: - + ConfigReader *Conf; public: ModuleModesOnOper(InspIRCd* Me) : Module(Me) { - + Conf = new ConfigReader(ServerInstance); Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -38,17 +38,17 @@ class ModuleModesOnOper : public Module delete Conf; Conf = new ConfigReader(ServerInstance); } - + virtual ~ModuleModesOnOper() { delete Conf; } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername) { // whenever a user opers, go through the oper types, find their , diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index d834a6029..f8da2cd10 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -74,7 +74,7 @@ class ModuleOpermotd : public Module opermotd = new FileReader(ServerInstance, filename); delete conf; } - + ModuleOpermotd(InspIRCd* Me) : Module(Me) { diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 31e99609b..15cf2ae55 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -20,7 +20,7 @@ typedef std::map override_t; class ModuleOverride : public Module { - + override_t overrides; bool RequireKey; bool NoisyOverride; @@ -28,10 +28,10 @@ class ModuleOverride : public Module int OverOps, OverDeops, OverVoices, OverDevoices, OverHalfops, OverDehalfops; public: - + ModuleOverride(InspIRCd* Me) : Module(Me) - { + { // read our config options (main config file) OnRehash(NULL,""); ServerInstance->SNO->EnableSnomask('O', "OVERRIDE"); @@ -40,12 +40,12 @@ class ModuleOverride : public Module Implementation eventlist[] = { I_OnRehash, I_OnAccessCheck, I_On005Numeric, I_OnUserPreJoin, I_OnUserPreKick, I_OnPostCommand }; ServerInstance->Modules->Attach(eventlist, this, 6); } - + virtual void OnRehash(User* user, const std::string ¶meter) { // on a rehash we delete our classes for good measure and create them again. ConfigReader* Conf = new ConfigReader(ServerInstance); - + // re-read our config options on a rehash NoisyOverride = Conf->ReadFlag("override", "noisy", 0); RequireKey = Conf->ReadFlag("override", "requirekey", 0); @@ -58,7 +58,7 @@ class ModuleOverride : public Module std::string tokenlist = Conf->ReadValue("type","override",j); overrides[typen] = tokenlist; } - + delete Conf; } @@ -116,7 +116,7 @@ class ModuleOverride : public Module } return 0; } - + virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type) { if (IS_OPER(source)) @@ -207,7 +207,7 @@ class ModuleOverride : public Module } break; } - + if (CanOverride(source,"OTHERMODE")) { if (NoisyOverride) @@ -227,7 +227,7 @@ class ModuleOverride : public Module return ACR_DEFAULT; } - + virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { if (IS_LOCAL(user) && IS_OPER(user)) @@ -252,7 +252,7 @@ class ModuleOverride : public Module } return -1; } - + if ((!chan->key.empty()) && (CanOverride(user,"KEY")) && keygiven != chan->key) { if (RequireKey && keygiven != "override") @@ -267,7 +267,7 @@ class ModuleOverride : public Module ServerInstance->SNO->WriteToSnoMask('O', user->nick+" used oper override to bypass +k on "+std::string(cname)); return -1; } - + if ((chan->limit > 0) && (chan->GetUserCounter() >= chan->limit) && (CanOverride(user,"LIMIT"))) { if (RequireKey && keygiven != "override") @@ -304,12 +304,12 @@ class ModuleOverride : public Module } return 0; } - + virtual ~ModuleOverride() { ServerInstance->SNO->DisableSnomask('O'); } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 93c7ca00a..4d3a9da63 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -65,7 +65,7 @@ class CommandMkpasswd : public Command class ModuleOperHash : public Module { - + CommandMkpasswd* mycommand; hashymodules hashers; /* List of modules which implement HashRequest */ std::deque names; /* Module names which implement HashRequest */ @@ -109,7 +109,7 @@ class ModuleOperHash : public Module Implementation eventlist[] = { I_OnPassCompare, I_OnLoadModule }; ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual ~ModuleOperHash() { if (diduseiface) ServerInstance->Modules->DoneWithInterface("HashRequest"); diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 9ead50535..304192ca8 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -50,7 +50,7 @@ class ModulePermanentChannels : public Module { PermChannel *p; public: - + ModulePermanentChannels(InspIRCd* Me) : Module(Me) { p = new PermChannel(ServerInstance); diff --git a/src/modules/m_proxyscan.cpp b/src/modules/m_proxyscan.cpp index dfccd8781..5e302ea80 100644 --- a/src/modules/m_proxyscan.cpp +++ b/src/modules/m_proxyscan.cpp @@ -31,7 +31,7 @@ /* * A few things to note: - * + * * O The only place that may *delete* an active or inactive * ident socket is OnUserDisconnect in the module class. * Because this is out of scope of the socket class there is @@ -40,7 +40,7 @@ * * O Closure of the ident socket with the Close() method will * not cause removal of the socket from memory or detatchment - * from its 'parent' User class. It will only flag it as an + * from its 'parent' User class. It will only flag it as an * inactive socket in the socket engine. * * O Timeouts are handled in OnCheckReaady at the same time as @@ -95,7 +95,7 @@ class ProxySocket : public EventHandler { this->response[i] = rstr[i]; } - + socklen_t size = 0; #ifdef IPV6 /* Does this look like a v6 ip address? */ @@ -115,7 +115,7 @@ class ProxySocket : public EventHandler /* We allocate two of these because sizeof(sockaddr_in6) > sizeof(sockaddr_in) */ sockaddr* s = new sockaddr[2]; sockaddr* addr = new sockaddr[2]; - + #ifdef IPV6 /* Horrid icky nasty ugly berkely socket crap. */ if (v6) @@ -313,22 +313,22 @@ class ModuleProxy : public Module Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCleanup, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 4); } - + virtual Version GetVersion() { return Version(1, 2, 1, 0, VF_VENDOR, API_VERSION); } - - + + virtual void OnRehash(User *user, const std::string ¶m) { ConfigReader MyConf(ServerInstance); - + RequestTimeout = MyConf.ReadInteger("ident", "timeout", 0, true); if (!RequestTimeout) RequestTimeout = 5; } - + virtual int OnUserRegister(User *user) { user->WriteServ("NOTICE Auth :*** Checking you for proxies..."); diff --git a/src/modules/m_quietban.cpp b/src/modules/m_quietban.cpp index dbb9f1d51..062c45c64 100644 --- a/src/modules/m_quietban.cpp +++ b/src/modules/m_quietban.cpp @@ -24,11 +24,11 @@ class ModuleQuietBan : public Module Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); } - + virtual ~ModuleQuietBan() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); @@ -47,7 +47,7 @@ class ModuleQuietBan : public Module return 1; } } - + return 0; } diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index d7acfadbe..503156eef 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -61,7 +61,7 @@ class ModuleRandQuote : public Module ModuleRandQuote(InspIRCd* Me) : Module(Me) { - + conf = new ConfigReader(ServerInstance); // Sort the Randomizer thingie.. srand(time(NULL)); @@ -92,18 +92,18 @@ class ModuleRandQuote : public Module ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleRandQuote() { delete conf; delete quotes; } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + virtual void OnUserConnect(User* user) { if (mycommand) diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 9c529a37d..8b088af8e 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -35,7 +35,7 @@ class Redirect : public ModeHandler /* When TS is equal, the alphabetically later one wins */ return (their_param < our_param); } - + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { if (adding) @@ -89,28 +89,28 @@ class Redirect : public ModeHandler } return MODEACTION_DENY; - + } }; class ModuleRedirect : public Module { - + Redirect* re; - + public: - + ModuleRedirect(InspIRCd* Me) : Module(Me) { - + re = new Redirect(ServerInstance); if (!ServerInstance->Modes->AddMode(re)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { @@ -145,7 +145,7 @@ class ModuleRedirect : public Module ServerInstance->Modes->DelMode(re); delete re; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index 5c7b825b0..9be3e1400 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -42,11 +42,11 @@ class ModuleRegOnlyCreate : public Module return 0; } - + virtual ~ModuleRegOnlyCreate() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index f0eff03ca..4dfa0bfb5 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -15,7 +15,7 @@ /* $ModDesc: Provides a /remove command, this is mostly an alternative to /kick, except makes users appear to have parted the channel */ -/* +/* * This module supports the use of the +q and +a usermodes, but should work without them too. * Usage of the command is restricted to +hoaq, and you cannot remove a user with a "higher" level than yourself. * eg: +h can remove +hv and users with no modes. +a can remove +aohv and users with no modes. @@ -25,17 +25,17 @@ */ class RemoveBase { - private: + private: bool& supportnokicks; InspIRCd* ServerInstance; - + protected: RemoveBase(InspIRCd* Instance, bool& snk) : supportnokicks(snk), ServerInstance(Instance) { - } - - enum ModeLevel { PEON = 0, HALFOP = 1, OP = 2, ADMIN = 3, OWNER = 4, ULINE = 5 }; - + } + + enum ModeLevel { PEON = 0, HALFOP = 1, OP = 2, ADMIN = 3, OWNER = 4, ULINE = 5 }; + /* This little function just converts a chanmode character (U ~ & @ & +) into an integer (5 4 3 2 1 0) */ /* XXX - We should probably use the new mode prefix rank stuff * for this instead now -- Brain */ @@ -45,7 +45,7 @@ class RemoveBase { return PEON; } - + switch (privs[0]) { case 'U': @@ -68,7 +68,7 @@ class RemoveBase return PEON; } } - + CmdResult Handle (const std::vector& parameters, User *user, bool neworder) { const char* channame; @@ -81,7 +81,7 @@ class RemoveBase std::string protectkey; std::string founderkey; bool hasnokicks; - + /* Set these to the parameters needed, the new version of this module switches it's parameters around * supplying a new command with the new order while keeping the old /remove with the older order. * /remove [reason ...] @@ -89,10 +89,10 @@ class RemoveBase */ channame = parameters[ neworder ? 0 : 1].c_str(); username = parameters[ neworder ? 1 : 0].c_str(); - + /* Look up the user we're meant to be removing from the channel */ target = ServerInstance->FindNick(username); - + /* And the channel we're meant to be removing them from */ channel = ServerInstance->FindChan(channame); @@ -107,13 +107,13 @@ class RemoveBase { user->WriteServ( "NOTICE %s :*** The user %s is not on channel %s", user->nick.c_str(), target->nick.c_str(), channel->name.c_str()); return CMD_FAILURE; - } - + } + /* This is adding support for the +q and +a channel modes, basically if they are enabled, and the remover has them set. * Then we change the @|%|+ to & if they are +a, or ~ if they are +q */ protectkey = "cm_protect_" + std::string(channel->name); founderkey = "cm_founder_" + std::string(channel->name); - + if (ServerInstance->ULine(user->server) || ServerInstance->ULine(user->nick.c_str())) { ulevel = chartolevel("U"); @@ -130,7 +130,7 @@ class RemoveBase { ulevel = chartolevel(channel->GetPrefixChar(user)); } - + /* Now it's the same idea, except for the target. If they're ulined make sure they get a higher level than the sender can */ if (ServerInstance->ULine(target->server) || ServerInstance->ULine(target->nick.c_str())) { @@ -148,9 +148,9 @@ class RemoveBase { tlevel = chartolevel(channel->GetPrefixChar(target)); } - + hasnokicks = (ServerInstance->Modules->Find("m_nokicks.so") && channel->IsModeSet('Q')); - + /* We support the +Q channel mode via. the m_nokicks module, if the module is loaded and the mode is set then disallow the /remove */ if ((!IS_LOCAL(user)) || (!supportnokicks || !hasnokicks || (ulevel == ULINE))) { @@ -165,7 +165,7 @@ class RemoveBase // but you can do this, nenolod -brain std::string reasonparam("No reason given"); - + /* If a reason is given, use it */ if(parameters.size() > 2) { @@ -212,7 +212,7 @@ class CommandRemove : public Command, public RemoveBase syntax = " []"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); } - + CmdResult Handle (const std::vector& parameters, User *user) { return RemoveBase::Handle(parameters, user, false); @@ -241,8 +241,8 @@ class ModuleRemove : public Module CommandRemove* mycommand; CommandFpart* mycommand2; bool supportnokicks; - - + + public: ModuleRemove(InspIRCd* Me) : Module(Me) @@ -261,22 +261,22 @@ class ModuleRemove : public Module { output.append(" REMOVE"); } - + virtual void OnRehash(User* user, const std::string&) { ConfigReader conf(ServerInstance); supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0); } - + virtual ~ModuleRemove() { } - + virtual Version GetVersion() { return Version(1, 2, 1, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleRemove) diff --git a/src/modules/m_restrictbanned.cpp b/src/modules/m_restrictbanned.cpp index d40549167..6068c5279 100644 --- a/src/modules/m_restrictbanned.cpp +++ b/src/modules/m_restrictbanned.cpp @@ -24,11 +24,11 @@ class ModuleRestrictBanned : public Module Implementation eventlist[] = { I_OnLocalTopicChange, I_OnUserPreNick, I_OnUserPreNotice, I_OnUserPreMessage }; ServerInstance->Modules->Attach(eventlist, this, 4); } - + virtual ~ModuleRestrictBanned() { } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); @@ -75,7 +75,7 @@ class ModuleRestrictBanned : public Module { return CheckRestricted(user, channel, "change the topic"); } - + virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreNotice(user,dest,target_type,text,status,exempt_list); diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index c0409168f..7b229687f 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -17,7 +17,7 @@ class ModuleRestrictChans : public Module { - + std::map allowchans; @@ -39,7 +39,7 @@ class ModuleRestrictChans : public Module ModuleRestrictChans(InspIRCd* Me) : Module(Me) { - + ReadConfig(); Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -50,7 +50,7 @@ class ModuleRestrictChans : public Module ReadConfig(); } - + virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { irc::string x = cname; @@ -66,11 +66,11 @@ class ModuleRestrictChans : public Module } return 0; } - + virtual ~ModuleRestrictChans() { } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index eb2026203..5670286b8 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -18,13 +18,13 @@ class ModuleRestrictMsg : public Module { - + public: - + ModuleRestrictMsg(InspIRCd* Me) : Module(Me) { - + Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -60,7 +60,7 @@ class ModuleRestrictMsg : public Module virtual ~ModuleRestrictMsg() { } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp index eed343243..007a89f09 100644 --- a/src/modules/m_ripemd160.cpp +++ b/src/modules/m_ripemd160.cpp @@ -25,7 +25,7 @@ * The RIPEMD-160 software is freely available for use under the terms and * conditions described hereunder, which shall be deemed to be accepted by * any user of the software and applicable on any use of the software: - * + * * 1. K.U.Leuven Department of Electrical Engineering-ESAT/COSIC shall for * all purposes be considered the owner of the RIPEMD-160 software and of * all copyright, trade secret, patent or other intellectual property @@ -39,9 +39,9 @@ * circumstances K.U.Leuven R&D will be held liable for any deficiency, * fault or other mishappening with regard to the use or performance of * the software. - * 3. User agrees to give due credit to K.U.Leuven in scientific publications - * or communications in relation with the use of the RIPEMD-160 software - * as follows: RIPEMD-160 software written by Antoon Bosselaers, + * 3. User agrees to give due credit to K.U.Leuven in scientific publications + * or communications in relation with the use of the RIPEMD-160 software + * as follows: RIPEMD-160 software written by Antoon Bosselaers, * available at http://www.esat.kuleuven.be/~cosicart/ps/AB-9601/. * */ @@ -80,12 +80,12 @@ typedef uint32_t dword; #define ROL(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* the five basic functions F(), G() and H() */ -#define F(x, y, z) ((x) ^ (y) ^ (z)) -#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define F(x, y, z) ((x) ^ (y) ^ (z)) +#define G(x, y, z) (((x) & (y)) | (~(x) & (z))) #define H(x, y, z) (((x) | ~(y)) ^ (z)) -#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define J(x, y, z) ((x) ^ ((y) | ~(z))) - + /* the ten basic operations FF() through III() */ #define FF(a, b, c, d, e, x, s) {\ @@ -200,7 +200,7 @@ class ModuleRIPEMD160 : public Module FF(cc, dd, ee, aa, bb, X[13], 7); FF(bb, cc, dd, ee, aa, X[14], 9); FF(aa, bb, cc, dd, ee, X[15], 8); - + /* round 2 */ GG(ee, aa, bb, cc, dd, X[ 7], 7); GG(dd, ee, aa, bb, cc, X[ 4], 6); @@ -218,7 +218,7 @@ class ModuleRIPEMD160 : public Module GG(bb, cc, dd, ee, aa, X[14], 7); GG(aa, bb, cc, dd, ee, X[11], 13); GG(ee, aa, bb, cc, dd, X[ 8], 12); - + /* round 3 */ HH(dd, ee, aa, bb, cc, X[ 3], 11); HH(cc, dd, ee, aa, bb, X[10], 13); @@ -236,7 +236,7 @@ class ModuleRIPEMD160 : public Module HH(aa, bb, cc, dd, ee, X[11], 12); HH(ee, aa, bb, cc, dd, X[ 5], 7); HH(dd, ee, aa, bb, cc, X[12], 5); - + /* round 4 */ II(cc, dd, ee, aa, bb, X[ 1], 11); II(bb, cc, dd, ee, aa, X[ 9], 12); @@ -292,7 +292,7 @@ class ModuleRIPEMD160 : public Module JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6); /* parallel round 2 */ - III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); + III(eee, aaa, bbb, ccc, ddd, X[ 6], 9); III(ddd, eee, aaa, bbb, ccc, X[11], 13); III(ccc, ddd, eee, aaa, bbb, X[ 3], 15); III(bbb, ccc, ddd, eee, aaa, X[ 7], 7); @@ -327,7 +327,7 @@ class ModuleRIPEMD160 : public Module HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7); HHH(ddd, eee, aaa, bbb, ccc, X[13], 5); - /* parallel round 4 */ + /* parallel round 4 */ GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15); GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5); GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8); diff --git a/src/modules/m_rpc_json.cpp b/src/modules/m_rpc_json.cpp index 1c472aa17..861aa86b0 100644 --- a/src/modules/m_rpc_json.cpp +++ b/src/modules/m_rpc_json.cpp @@ -31,9 +31,9 @@ class JsonException : public std::exception : _what(swhat) { } - + virtual ~JsonException() throw() { } - + virtual const char *what() const throw() { return _what.c_str(); @@ -43,7 +43,7 @@ class JsonException : public std::exception class ModuleRpcJson : public Module { private: - + public: ModuleRpcJson(InspIRCd *Me) : Module(Me) { @@ -51,52 +51,52 @@ class ModuleRpcJson : public Module Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleRpcJson() { ServerInstance->Modules->UnpublishInterface("RPC", this); } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_SERVICEPROVIDER | VF_VENDOR, API_VERSION); } - - + + virtual void OnEvent(Event *event) { if (event->GetEventID() == "httpd_url") { HTTPRequest *req = (HTTPRequest*) event->GetData(); - + if ((req->GetURI() == "/rpc/json") || (req->GetURI() == "/rpc/json/")) { std::stringstream data; - + RPCValue *reqobj = NULL; - + try { reqobj = this->JSONParse(req->GetPostData()); - + if (!reqobj || (reqobj->GetType() != RPCObject)) throw JsonException("RPC requests must be in the form of a single object"); - + RPCValue *method = reqobj->GetObject("method"); if (!method || method->GetType() != RPCString) throw JsonException("RPC requests must have a 'method' string field"); - + RPCValue *params = reqobj->GetObject("params"); if (!params || params->GetType() != RPCArray) throw JsonException("RPC requests must have a 'params' array field"); - + RPCRequest modreq("json", method->GetString(), params); Event mev((char*) &modreq, this, "RPCMethod"); mev.Send(ServerInstance); - + if (!modreq.claimed) throw JsonException("Unrecognized method"); - + if (!modreq.error.empty()) { data << "{\"result\":null,\"error\":\"" << modreq.error << "\""; @@ -107,14 +107,14 @@ class ModuleRpcJson : public Module this->JSONSerialize(modreq.result, data); data << ",\"error\":null"; } - + if (reqobj->GetObject("id")) { data << ",\"id\":"; this->JSONSerialize(reqobj->GetObject("id"), data); } data << "}"; - + delete reqobj; reqobj = NULL; } @@ -124,23 +124,23 @@ class ModuleRpcJson : public Module delete reqobj; data << "{\"result\":null,\"error\":\"" << e.what() << "\"}"; } - + HTTPDocument response(req->sock, &data, 200); response.headers.SetHeader("X-Powered-By", "m_rpc_json.so"); response.headers.SetHeader("Content-Type", "application/json"); response.headers.SetHeader("Connection", "Keep-Alive"); - + Request rreq((char*) &response, (Module*) this, event->GetSource()); rreq.Send(); } } } - + void AttachToParent(RPCValue *parent, RPCValue *child, const std::string &key = "") { if (!parent || !child) return; - + if (parent->GetType() == RPCArray) parent->ArrayAdd(child); else if (parent->GetType() == RPCObject) @@ -148,14 +148,14 @@ class ModuleRpcJson : public Module else throw JsonException("Cannot add a value to a non-container"); } - + void AttachToParentReset(RPCValue *parent, RPCValue *&child, std::string &key) { AttachToParent(parent, child, key); child = NULL; key.clear(); } - + RPCValue *JSONParse(const std::string &data) { bool pisobject = false; @@ -165,7 +165,7 @@ class ModuleRpcJson : public Module std::string pvkey; RPCValue *aparent = NULL; RPCValue *value = NULL; - + for (std::string::const_iterator i = data.begin(); i != data.end(); i++) { if (instring) @@ -174,29 +174,29 @@ class ModuleRpcJson : public Module if (*i == '"') { instring = false; - + if (pisobject && vkey.empty()) vkey = stmp; else value = new RPCValue(stmp); - + stmp.clear(); } else stmp += *i; - + continue; } - + if ((*i == ' ') || (*i == '\t') || (*i == '\r') || (*i == '\n')) continue; - + if (*i == '{') { // Begin object if ((value) || (pisobject && vkey.empty())) throw JsonException("Unexpected begin object token ('{')"); - + RPCValue *nobj = new RPCValue(RPCObject, aparent); aparent = nobj; pvkey = vkey; @@ -208,14 +208,14 @@ class ModuleRpcJson : public Module // End object if ((!aparent) || (!pisobject) || (!vkey.empty() && !value)) throw JsonException("Unexpected end object token ('}')"); - + // End value if (value) AttachToParentReset(aparent, value, vkey); - + if (!aparent->parent) return aparent; - + value = aparent; aparent = aparent->parent; vkey = pvkey; @@ -227,7 +227,7 @@ class ModuleRpcJson : public Module // Begin string if (value) throw JsonException("Unexpected begin string token ('\"')"); - + instring = true; } else if (*i == ':') @@ -239,7 +239,7 @@ class ModuleRpcJson : public Module { if ((!aparent) || (!value) || ((pisobject) && (vkey.empty()))) throw JsonException("Unexpected value seperator token (',')"); - + AttachToParentReset(aparent, value, vkey); } else if (*i == '[') @@ -247,7 +247,7 @@ class ModuleRpcJson : public Module // Begin array if ((value) || (pisobject && vkey.empty())) throw JsonException("Unexpected begin array token ('[')"); - + RPCValue *nar = new RPCValue(RPCArray, aparent); aparent = nar; pvkey = vkey; @@ -259,13 +259,13 @@ class ModuleRpcJson : public Module // End array (also an end value delimiter) if (!aparent || pisobject) throw JsonException("Unexpected end array token (']')"); - + if (value) AttachToParentReset(aparent, value, vkey); - + if (!aparent->parent) return aparent; - + value = aparent; aparent = aparent->parent; vkey = pvkey; @@ -294,36 +294,36 @@ class ModuleRpcJson : public Module { std::string ds = std::string(i, data.end()); char *eds = NULL; - + errno = 0; double v = strtod(ds.c_str(), &eds); - + if (errno != 0) throw JsonException("Error parsing numeric value"); - + value = new RPCValue(v); - + i += eds - ds.c_str() - 1; } else throw JsonException("Unknown data in value portion"); } } - + if (instring) throw JsonException("Unterminated string"); - + if (aparent && pisobject) throw JsonException("Unterminated object"); else if (aparent && !pisobject) throw JsonException("Unterminated array"); - + if (value) return value; else throw JsonException("No JSON data found"); } - + void JSONSerialize(RPCValue *value, std::stringstream &re) { int ac; diff --git a/src/modules/m_rpctest.cpp b/src/modules/m_rpctest.cpp index 673955a0d..0ff938041 100644 --- a/src/modules/m_rpctest.cpp +++ b/src/modules/m_rpctest.cpp @@ -23,30 +23,30 @@ class ModuleRPCTest : public Module { private: - + public: ModuleRPCTest(InspIRCd *Me) : Module(Me) { Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 1); } - + virtual ~ModuleRPCTest() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); } - - + + virtual void OnEvent(Event *ev) { if (ev->GetEventID() == "RPCMethod") { RPCRequest *req = (RPCRequest*) ev->GetData(); - + if (req->method == "test.echo") { req->claimed = true; @@ -55,7 +55,7 @@ class ModuleRPCTest : public Module req->error = "Insufficient parameters"; return; } - + req->result->SetString(req->parameters->GetArray(0)->GetString()); } } diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 9bcc78806..f719b9e87 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -45,7 +45,7 @@ class ModuleSafeList : public Module Implementation eventlist[] = { I_OnBufferFlushed, I_OnPreCommand, I_OnCleanup, I_OnUserQuit, I_On005Numeric, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 6); } - + virtual ~ModuleSafeList() { } @@ -58,30 +58,30 @@ class ModuleSafeList : public Module ServerNameSize = strlen(ServerInstance->Config->ServerName) + 4; global_listing = 0; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); } - + /* * OnPreCommand() * Intercept the LIST command. - */ + */ virtual int OnPreCommand(std::string &command, std::vector ¶meters, User *user, bool validated, const std::string &original_line) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) return 0; - + if (command == "LIST") { return this->HandleList(parameters, user); } return 0; } - + /* * HandleList() * Handle (override) the LIST command. @@ -102,7 +102,7 @@ class ModuleSafeList : public Module /* First, let's check if the user is currently /list'ing */ ListData *ld; user->GetExt("safelist_cache", ld); - + if (ld) { /* user is already /list'ing, we don't want to do shit. */ @@ -142,7 +142,7 @@ class ModuleSafeList : public Module user->Shrink("safelist_last"); } - + /* * start at channel 0! ;) */ diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index c320287e1..72fdd3e08 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -93,21 +93,21 @@ class ModuleSajoin : public Module ModuleSajoin(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSajoin(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSajoin() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleSajoin) diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 67b30b3ec..8b5e94c5f 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -69,16 +69,16 @@ class ModuleSaMode : public Module ModuleSaMode(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSamode(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSaMode() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 83d7fabd4..9adaff40c 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -76,21 +76,21 @@ class ModuleSanick : public Module ModuleSanick(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSanick(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSanick() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleSanick) diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 40a4c54e5..05fe5ffdc 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -98,21 +98,21 @@ class ModuleSapart : public Module ModuleSapart(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSapart(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSapart() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleSapart) diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 91e792c8b..00f8cfba2 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -37,13 +37,13 @@ class CommandSaquit : public Command user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); return CMD_FAILURE; } - + ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+parameters[1]); - + // Pass the command on, so the client's server can quit it properly. if (!IS_LOCAL(dest)) return CMD_SUCCESS; - + ServerInstance->Users->QuitUser(dest, parameters[1]); return CMD_LOCALONLY; } @@ -63,21 +63,21 @@ class ModuleSaquit : public Module ModuleSaquit(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSaquit(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSaquit() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleSaquit) diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 1ad51b164..96130d039 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -188,7 +188,7 @@ class ModuleSASL : public Module { CommandAuthenticate* sasl; public: - + ModuleSASL(InspIRCd* Me) : Module(Me) { diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 356a1a93e..0d04a13ae 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -27,11 +27,11 @@ class ModuleSecureList : public Module Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); } - + virtual ~ModuleSecureList() { } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_VENDOR,API_VERSION); @@ -48,18 +48,18 @@ class ModuleSecureList : public Module WaitTime = MyConf->ReadInteger("securelist", "waittime", "60", 0, true); delete MyConf; } - + /* * OnPreCommand() * Intercept the LIST command. - */ + */ virtual int OnPreCommand(std::string &command, std::vector ¶meters, User *user, bool validated, const std::string &original_line) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) return 0; - + if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!IS_OPER(user))) { /* Normally wouldnt be allowed here, are they exempt? */ @@ -91,5 +91,5 @@ class ModuleSecureList : public Module } }; - + MODULE_INIT(ModuleSecureList) diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 2ea856db2..bc6c68864 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -21,7 +21,7 @@ static bool kludgeme = false; */ class Channel_r : public ModeHandler { - + public: Channel_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_CHANNEL, false) { } @@ -45,7 +45,7 @@ class Channel_r : public ModeHandler */ class User_r : public ModeHandler { - + public: User_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_USER, false) { } @@ -96,7 +96,7 @@ class Channel_M : public SimpleChannelModeHandler */ class ModuleServices : public Module { - + Channel_r* m1; Channel_R* m2; Channel_M* m3; @@ -106,7 +106,7 @@ class ModuleServices : public Module ModuleServices(InspIRCd* Me) : Module(Me) { - + m1 = new Channel_r(ServerInstance); m2 = new Channel_R(ServerInstance); m3 = new Channel_M(ServerInstance); @@ -118,7 +118,7 @@ class ModuleServices : public Module { throw ModuleException("Could not add user and channel modes!"); } - + kludgeme = false; Implementation eventlist[] = { I_OnWhois, I_OnUserPostNick, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, 5); @@ -148,7 +148,7 @@ class ModuleServices : public Module kludgeme = false; } } - + virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { if (!IS_LOCAL(user)) @@ -186,12 +186,12 @@ class ModuleServices : public Module } return 0; } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreMessage(user,dest,target_type,text,status, exempt_list); } - + virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { if (chan) @@ -228,7 +228,7 @@ class ModuleServices : public Module delete m4; delete m5; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index db9d90de4..4a3e0c48b 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -42,14 +42,14 @@ class AChannel_M : public SimpleChannelModeHandler class ModuleServicesAccount : public Module { - + AChannel_R* m1; AChannel_M* m2; AUser_R* m3; public: ModuleServicesAccount(InspIRCd* Me) : Module(Me) { - + m1 = new AChannel_R(ServerInstance); m2 = new AChannel_M(ServerInstance); m3 = new AUser_R(ServerInstance); @@ -83,11 +83,11 @@ class ModuleServicesAccount : public Module return 0; user->GetExt("accountname", account); - + if (target_type == TYPE_CHANNEL) { Channel* c = (Channel*)dest; - + if ((c->IsModeSet('M')) && (!account)) { if ((ServerInstance->ULine(user->nick.c_str())) || (ServerInstance->ULine(user->server))) @@ -104,7 +104,7 @@ class ModuleServicesAccount : public Module if (target_type == TYPE_USER) { User* u = (User*)dest; - + if ((u->modes['R'-65]) && (!account)) { if ((ServerInstance->ULine(user->nick.c_str())) || (ServerInstance->ULine(user->server))) @@ -120,17 +120,17 @@ class ModuleServicesAccount : public Module } return 0; } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreMessage(user, dest, target_type, text, status, exempt_list); } - + virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { std::string *account; user->GetExt("accountname", account); - + if (chan) { if (chan->IsModeSet('R')) @@ -150,7 +150,7 @@ class ModuleServicesAccount : public Module } return 0; } - + // Whenever the linking module wants to send out data, but doesnt know what the data // represents (e.g. it is metadata, added to a User or Channel by a module) then // this method is called. We should use the ProtoSendMetaData function after we've @@ -215,9 +215,9 @@ class ModuleServicesAccount : public Module { // check if its our metadata key, and its associated with a user if ((target_type == TYPE_USER) && (extname == "accountname")) - { + { User* dest = (User*)target; - + /* logging them out? */ if (extdata.empty()) { @@ -262,7 +262,7 @@ class ModuleServicesAccount : public Module delete m2; delete m3; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 2c724500f..3aafda237 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -38,13 +38,13 @@ class ServProtectMode : public ModeHandler class ModuleServProtectMode : public Module { - + ServProtectMode* bm; public: ModuleServProtectMode(InspIRCd* Me) : Module(Me) { - + bm = new ServProtectMode(ServerInstance); if (!ServerInstance->Modes->AddMode(bm)) throw ModuleException("Could not add new modes!"); @@ -52,13 +52,13 @@ class ModuleServProtectMode : public Module ServerInstance->Modules->Attach(eventlist, this, 4); } - + virtual ~ModuleServProtectMode() { ServerInstance->Modes->DelMode(bm); delete bm; } - + virtual Version GetVersion() { return Version(1,2,0,0,VF_COMMON,API_VERSION); diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index ba2cc4f45..b84f11acf 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -69,7 +69,7 @@ class ModuleSetHost : public Module public: ModuleSetHost(InspIRCd* Me) : Module(Me) - { + { OnRehash(NULL,""); mycommand = new CommandSethost(ServerInstance, hostmap); ServerInstance->AddCommand(mycommand); @@ -94,12 +94,12 @@ class ModuleSetHost : public Module virtual ~ModuleSetHost() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleSetHost) diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 6577ebbb3..c910dfe92 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -34,19 +34,19 @@ class CommandSetident : public Command user->WriteServ("NOTICE %s :*** SETIDENT: Ident must be specified", user->nick.c_str()); return CMD_FAILURE; } - + if (parameters[0].size() > ServerInstance->Config->Limits.IdentMax) { user->WriteServ("NOTICE %s :*** SETIDENT: Ident is too long", user->nick.c_str()); return CMD_FAILURE; } - + if (!ServerInstance->IsIdent(parameters[0].c_str())) { user->WriteServ("NOTICE %s :*** SETIDENT: Invalid characters in ident", user->nick.c_str()); return CMD_FAILURE; } - + user->ChangeIdent(parameters[0].c_str()); ServerInstance->SNO->WriteToSnoMask('A', "%s used SETIDENT to change their ident to '%s'", user->nick.c_str(), user->ident.c_str()); @@ -58,25 +58,25 @@ class CommandSetident : public Command class ModuleSetIdent : public Module { CommandSetident* mycommand; - + public: ModuleSetIdent(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSetident(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSetIdent() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 89e8c9a17..b6da3529c 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -54,16 +54,16 @@ class ModuleSetIdle : public Module ModuleSetIdle(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSetidle(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSetIdle() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 8c35c2be2..4df0a2c5c 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -34,13 +34,13 @@ class CommandSetname : public Command user->WriteServ("NOTICE %s :*** SETNAME: GECOS must be specified", user->nick.c_str()); return CMD_FAILURE; } - + if (parameters[0].size() > ServerInstance->Config->Limits.MaxGecos) { user->WriteServ("NOTICE %s :*** SETNAME: GECOS too long", user->nick.c_str()); return CMD_FAILURE; } - + if (user->ChangeName(parameters[0].c_str())) { ServerInstance->SNO->WriteToSnoMask('A', "%s used SETNAME to change their GECOS to %s", user->nick.c_str(), parameters[0].c_str()); @@ -59,21 +59,21 @@ class ModuleSetName : public Module ModuleSetName(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandSetname(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleSetName() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleSetName) diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp index aee1cb12a..e79aa4ab0 100644 --- a/src/modules/m_sha256.cpp +++ b/src/modules/m_sha256.cpp @@ -159,7 +159,7 @@ class ModuleSHA256 : public Module { int j; sub_block = message + ((i - 1) << 6); - + for (j = 0; j < 16; j++) PACK32(&sub_block[j << 2], &w[j]); for (j = 16; j < 64; j++) @@ -183,7 +183,7 @@ class ModuleSHA256 : public Module ctx->h[j] += wv[j]; } } - + void SHA256Update(SHA256Context *ctx, unsigned char *message, unsigned int len) { /* @@ -205,7 +205,7 @@ class ModuleSHA256 : public Module unsigned int tmp_len = SHA256_BLOCK_SIZE - ctx->len; unsigned int rem_len = len < tmp_len ? len : tmp_len; - + memcpy(&ctx->block[ctx->len], message, rem_len); if (ctx->len + len < SHA256_BLOCK_SIZE) { @@ -222,7 +222,7 @@ class ModuleSHA256 : public Module ctx->len = rem_len; ctx->tot_len += (block_nb + 1) << 6; } - + void SHA256Final(SHA256Context *ctx, unsigned char *digest) { unsigned int block_nb = (1 + ((SHA256_BLOCK_SIZE - 9) < (ctx->len % SHA256_BLOCK_SIZE))); @@ -235,7 +235,7 @@ class ModuleSHA256 : public Module for (int i = 0 ; i < 8; i++) UNPACK32(ctx->h[i], &digest[i << 2]); } - + void SHA256(const char *src, char *dest, int len, const char* hxc, const unsigned int* ikey = NULL) { // Generate the hash diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index a66ea2f98..05f70b4c4 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -51,14 +51,14 @@ class SeeWhois : public ModeHandler class ModuleShowwhois : public Module { - + SeeWhois* sw; public: ModuleShowwhois(InspIRCd* Me) : Module(Me) { - + sw = new SeeWhois(ServerInstance); if (!ServerInstance->Modes->AddMode(sw)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index cd777340a..56d4be808 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -174,9 +174,9 @@ class ModuleShun : public Module virtual int OnStats(char symbol, User* user, string_list& out) { // XXX write me -//format << Srv->Config->ServerName << " 223 " << user->nick << " :" << iter->banmask << " " << iter->set_on << " " << iter->length << " " << -//iter->set_by << " " << iter->reason; - +//format << Srv->Config->ServerName << " 223 " << user->nick << " :" << iter->banmask << " " << iter->set_on << " " << iter->length << " " << +//iter->set_by << " " << iter->reason; + return 0; } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 310f2d95a..cdd968212 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -72,16 +72,16 @@ class CommandSVSSilence : public Command */ if (!ServerInstance->ULine(user->server)) return CMD_FAILURE; - + User *u = ServerInstance->FindNick(parameters[0]); if (!u) return CMD_FAILURE; - + if (IS_LOCAL(u)) { ServerInstance->Parser->CallHandler("SILENCE", std::vector(++parameters.begin(), parameters.end()), u); } - + return CMD_SUCCESS; } }; @@ -129,13 +129,13 @@ class CommandSilence : public Command if (parameters.size() > 1) { pattern = CompilePattern(parameters[1].c_str()); } - + if (!mask.length()) { // 'SILENCE +' or 'SILENCE -', assume *!*@* mask = "*!*@*"; } - + ModeParser::CleanMask(mask); if (action == '-') @@ -219,7 +219,7 @@ class CommandSilence : public Command case 'c': p |= SILENCE_CHANNEL; break; - case 'i': + case 'i': p |= SILENCE_INVITE; break; case 'n': @@ -271,7 +271,7 @@ class ModuleSilence : public Module CommandSVSSilence *cmdsvssilence; unsigned int maxsilence; public: - + ModuleSilence(InspIRCd* Me) : Module(Me), maxsilence(32) { @@ -401,7 +401,7 @@ class ModuleSilence : public Module virtual ~ModuleSilence() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index b7f2ad420..b9bca3109 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -66,7 +66,7 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque &par User* u = Instance->FindNick(prefix); Utils->DoOneToAllButSender(prefix, "ADDLINE", params, u ? u->server : prefix); TreeServer *remoteserver = Utils->FindServer(u ? u->server : prefix); - + if (!remoteserver->bursting) { Instance->XLines->ApplyLines(); diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 9a45b8131..8037907d0 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -188,7 +188,7 @@ bool TreeSocket::Capab(const std::deque ¶ms) if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (Instance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(Instance->Config->AllowHalfop)))) reason = "We don't both have halfop support enabled/disabled identically"; - + /* Challenge response, store their challenge for our password */ std::map::iterator n = this->CapKeys.find("CHALLENGE"); if (Utils->ChallengeResponse && (n != this->CapKeys.end()) && (Instance->Modules->Find("m_sha256.so"))) diff --git a/src/modules/m_spanningtree/delline.cpp b/src/modules/m_spanningtree/delline.cpp index 1b8630f66..e8c398f6b 100644 --- a/src/modules/m_spanningtree/delline.cpp +++ b/src/modules/m_spanningtree/delline.cpp @@ -32,7 +32,7 @@ bool TreeSocket::DelLine(const std::string &prefix, std::deque &par if (user) setter = user->nick; else - { + { TreeServer* t = Utils->FindServer(prefix); if (t) setter = t->GetName().c_str(); diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 33f92235a..b891443ea 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -73,7 +73,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p if (params.size() > 3) params[params.size() - 1] = ":" + params[params.size() - 1]; - + Utils->DoOneToAllButSender(source,"FJOIN",params,source); if (!TS) @@ -151,7 +151,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p /* Advance past the comma, to the nick */ usr++; - + /* Check the user actually exists */ who = this->Instance->FindUUID(usr); if (who) @@ -233,4 +233,4 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque } return true; } - + diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index 4ad6658b8..564bef796 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -145,4 +145,4 @@ bool TreeSocket::ComparePass(const std::string &ours, const std::string &theirs) else /* Straight string compare of plaintext */ return ours == theirs; -} +} diff --git a/src/modules/m_spanningtree/kill.cpp b/src/modules/m_spanningtree/kill.cpp index 3fca0a0cb..b8413942d 100644 --- a/src/modules/m_spanningtree/kill.cpp +++ b/src/modules/m_spanningtree/kill.cpp @@ -24,7 +24,7 @@ bool TreeSocket::RemoteKill(const std::string &prefix, std::deque ¶ms) -{ +{ if (params.size() != 2) return true; @@ -32,7 +32,7 @@ bool TreeSocket::RemoteKill(const std::string &prefix, std::deque & if (who) { - /* Prepend kill source, if we don't have one */ + /* Prepend kill source, if we don't have one */ if (*(params[1].c_str()) != '[') { params[1] = "[" + prefix + "] Killed (" + params[1] +")"; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index b91d76836..9688cfb7d 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -155,10 +155,10 @@ void ModuleSpanningTree::HandleLusers(const std::vector& parameters if (ServerInstance->Users->UnregisteredUserCount()) user->WriteNumeric(253, "%s %d :unknown connections",user->nick.c_str(),ServerInstance->Users->UnregisteredUserCount()); - + if (ServerInstance->ChannelCount()) user->WriteNumeric(254, "%s %ld :channels formed",user->nick.c_str(),ServerInstance->ChannelCount()); - + user->WriteNumeric(255, "%s :I have %d clients and %d servers",user->nick.c_str(),ServerInstance->Users->LocalUserCount(),ulined_local_count ? this->CountLocalServs() - ulined_local_count : this->CountLocalServs()); user->WriteNumeric(265, "%s :Current Local Users: %d Max: %d",user->nick.c_str(),ServerInstance->Users->LocalUserCount(),max_local); user->WriteNumeric(266, "%s :Current Global Users: %d Max: %d",user->nick.c_str(),n_users,max_global); @@ -221,7 +221,7 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime) // ... if we can find a proper route to them if (tsock) { - tsock->WriteLine(std::string(":") + ServerInstance->Config->GetSID() + " PING " + + tsock->WriteLine(std::string(":") + ServerInstance->Config->GetSID() + " PING " + ServerInstance->Config->GetSID() + " " + s->GetID()); s->LastPingMsec = ts; } @@ -394,10 +394,10 @@ void ModuleSpanningTree::RemoteMessage(User* user, const char* format, ...) else ServerInstance->PI->SendUserNotice(user, text); } - + SendingRemoteMessage = false; } - + int ModuleSpanningTree::HandleConnect(const std::vector& parameters, User* user) { for (std::vector::iterator x = Utils->LinkBlocks.begin(); x < Utils->LinkBlocks.end(); x++) @@ -731,7 +731,7 @@ void ModuleSpanningTree::OnAddLine(User* user, XLine *x) return; char data[MAXBUF]; - snprintf(data,MAXBUF,"%s %s %s %lu %lu :%s", x->type.c_str(), x->Displayable(), + snprintf(data,MAXBUF,"%s %s %s %lu %lu :%s", x->type.c_str(), x->Displayable(), ServerInstance->Config->ServerName, (unsigned long)x->set_time, (unsigned long)x->duration, x->reason); std::deque params; params.push_back(data); diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 793a3cf9a..2e7aab25f 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -132,7 +132,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) { modes.append("b"); params.append(" ").append(b->data); - linesize += size; + linesize += size; } if ((params.length() >= Instance->Config->Limits.MaxModes) || (currsize > 350)) { diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index a33b77da4..5531f9c0e 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -35,15 +35,15 @@ int TreeSocket::DoCollision(User *u, time_t remotets, const std::string &remotei * These days, we have UID. And, so what we do is, force nick change client(s) * involved according to timestamp rules. * - * RULES: - * user@ip equal: - * Force nick change on OLDER timestamped client - * user@ip differ: - * Force nick change on NEWER timestamped client - * TS EQUAL: - * FNC both. - * - * This stops abusive use of collisions, simplifies problems with loops, and so on. + * RULES: + * user@ip equal: + * Force nick change on OLDER timestamped client + * user@ip differ: + * Force nick change on NEWER timestamped client + * TS EQUAL: + * FNC both. + * + * This stops abusive use of collisions, simplifies problems with loops, and so on. * -- w00t */ bool bChangeLocal = true; diff --git a/src/modules/m_spanningtree/override_admin.cpp b/src/modules/m_spanningtree/override_admin.cpp index 2122a3a24..a15cba93c 100644 --- a/src/modules/m_spanningtree/override_admin.cpp +++ b/src/modules/m_spanningtree/override_admin.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index 01423b60a..229997e5b 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -12,7 +12,7 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "wildcard.h" @@ -28,19 +28,19 @@ const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current) time_t secs_up = ServerInstance->Time() - Current->age; return (" [Up: " + TimeToStr(secs_up) + " Lag: " + (Current->rtt == 0 ? "<1" : ConvToStr(Current->rtt)) + "ms]"); } - + // WARNING: NOT THREAD SAFE - DONT GET ANY SMART IDEAS. void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, char matrix[128][128], float &totusers, float &totservers) { ServerInstance->Logs->Log("map",DEBUG,"ShowMap depth %d totusers %0.2f totservers %0.2f", depth, totusers, totservers); if (line < 128) - { + { for (int t = 0; t < depth; t++) { ServerInstance->Logs->Log("map",DEBUG,"Zero to depth"); matrix[line][t] = ' '; } - + // For Aligning, we need to work out exactly how deep this thing is, and produce // a 'Spacer' String to compensate. char spacer[40]; @@ -51,7 +51,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha else { spacer[5] = '\0'; - } + } float percent; char text[128]; diff --git a/src/modules/m_spanningtree/override_modules.cpp b/src/modules/m_spanningtree/override_modules.cpp index 0a1dd2d3d..b06634a4d 100644 --- a/src/modules/m_spanningtree/override_modules.cpp +++ b/src/modules/m_spanningtree/override_modules.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" diff --git a/src/modules/m_spanningtree/override_motd.cpp b/src/modules/m_spanningtree/override_motd.cpp index 3a1182973..b312769c7 100644 --- a/src/modules/m_spanningtree/override_motd.cpp +++ b/src/modules/m_spanningtree/override_motd.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp index 02833464f..cacbc51a6 100644 --- a/src/modules/m_spanningtree/override_squit.cpp +++ b/src/modules/m_spanningtree/override_squit.cpp @@ -12,14 +12,14 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" +#include "xline.h" +#include "transport.h" #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp index ab50f7656..6c66e2d2b 100644 --- a/src/modules/m_spanningtree/override_stats.cpp +++ b/src/modules/m_spanningtree/override_stats.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" @@ -30,7 +30,7 @@ #include "m_spanningtree/treesocket.h" #include "m_spanningtree/rconnect.h" #include "m_spanningtree/rsquit.h" - + /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ int ModuleSpanningTree::HandleStats(const std::vector& parameters, User* user) diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp index b0a37b7be..0f6a1bef6 100644 --- a/src/modules/m_spanningtree/override_time.cpp +++ b/src/modules/m_spanningtree/override_time.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" @@ -30,7 +30,7 @@ #include "m_spanningtree/treesocket.h" #include "m_spanningtree/rconnect.h" #include "m_spanningtree/rsquit.h" - + /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ int ModuleSpanningTree::HandleTime(const std::vector& parameters, User* user) @@ -43,7 +43,7 @@ int ModuleSpanningTree::HandleTime(const std::vector& parameters, U // we dont' override for local server if (found == Utils->TreeRoot) return 0; - + std::deque params; params.push_back(found->GetName()); params.push_back(user->uuid); diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index 5d9705a87..a957ee174 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" @@ -30,7 +30,7 @@ #include "m_spanningtree/treesocket.h" #include "m_spanningtree/rconnect.h" #include "m_spanningtree/rsquit.h" - + /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ int ModuleSpanningTree::HandleRemoteWhois(const std::vector& parameters, User* user) diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index c485afe59..d63fff686 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" @@ -68,7 +68,7 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const std::ve ServerInstance->Logs->Log("m_spanningtree",DEBUG,"TRANSLATION: %s - type is %d", parameters[j].c_str(), translate_to); ServerInstance->Parser->TranslateUIDs(translate_to, parameters[j], target); - + if (j == (parameters.size() - 1)) params.push_back(":" + target); else diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index e27de1dbd..631a20557 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -12,15 +12,15 @@ */ /* $ModDesc: Provides a spanning tree server link protocol */ - + #include "inspircd.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" #include "wildcard.h" -#include "xline.h" -#include "transport.h" - +#include "xline.h" +#include "transport.h" + #include "m_spanningtree/timesynctimer.h" #include "m_spanningtree/resolvers.h" #include "m_spanningtree/main.h" diff --git a/src/modules/m_spanningtree/privmsg.cpp b/src/modules/m_spanningtree/privmsg.cpp index cd49001a5..a68590048 100644 --- a/src/modules/m_spanningtree/privmsg.cpp +++ b/src/modules/m_spanningtree/privmsg.cpp @@ -39,7 +39,7 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string } Channel* channel = Instance->FindChan(target); - + if (channel) { if (messagetype == "PRIVMSG") @@ -60,7 +60,7 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string else { User* user = Instance->FindNick(target); - + if (user) { if (messagetype == "PRIVMSG") diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 26785fd39..5a6a9f301 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -74,22 +74,22 @@ bool TreeSocket::ProcessLine(std::string &line) Instance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str()); this->Split(line.c_str(),params); - + if (params.empty()) return true; - + if ((params[0][0] == ':') && (params.size() > 1)) { prefix = params[0].substr(1); params.pop_front(); - + if (prefix.empty()) { this->SendError("BUG (?) Empty prefix recieved."); return false; } } - + command = params[0].c_str(); params.pop_front(); @@ -313,8 +313,8 @@ bool TreeSocket::ProcessLine(std::string &line) /* * Now, check for (and parse) commands as appropriate. -- w - */ - + */ + /* Find the server that this command originated from, used in the handlers below */ TreeServer *ServerSource = Utils->FindServer(prefix); @@ -501,7 +501,7 @@ bool TreeSocket::ProcessLine(std::string &line) this->Instance->SNO->WriteToSnoMask('l', "WTF: Got BURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); return false; } - + ServerSource->bursting = true; return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params); } @@ -512,7 +512,7 @@ bool TreeSocket::ProcessLine(std::string &line) this->Instance->SNO->WriteToSnoMask('l', "WTF: Got ENDBURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); return false; } - + ServerSource->FinishBurst(); return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params); } @@ -534,10 +534,10 @@ bool TreeSocket::ProcessLine(std::string &line) return false; } } - + // Insert into the parser this->Instance->SendMode(modelist, this->Instance->FakeClient); - + // Pass out to the network return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params); } @@ -587,7 +587,7 @@ bool TreeSocket::ProcessLine(std::string &line) } } } - + // its a user std::vector strparams(params.begin(), params.end()); @@ -664,7 +664,7 @@ void TreeSocket::OnClose() if (!quitserver.empty()) { Utils->Creator->RemoteMessage(NULL,"Connection to '\2%s\2' failed.",quitserver.c_str()); - time_t server_uptime = Instance->Time() - this->age; + time_t server_uptime = Instance->Time() - this->age; if (server_uptime) Utils->Creator->RemoteMessage(NULL,"Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index f36d2b05c..32255b576 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -137,10 +137,10 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque &pa Instance->Users->AddGlobalClone(_new); bool dosend = true; - + if ((this->Utils->quiet_bursts && remoteserver->bursting) || this->Instance->SilentULine(_new->server)) dosend = false; - + if (dosend) this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]", _new->server, _new->nick.c_str(), _new->ident.c_str(), _new->host.c_str(), _new->GetIPString(), _new->fullname.c_str()); diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index b5f0cde6a..c43cee956 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -33,17 +33,17 @@ class ModuleSpy : public Module return 0; } - void Prioritize() - { + void Prioritize() + { /* To ensure that we get priority over namesx and delayjoin for names list generation */ Module* list[] = { ServerInstance->Modules->Find("m_namesx.so"), ServerInstance->Modules->Find("m_delayjoin.so") }; ServerInstance->Modules->SetPriority(this, I_OnUserList, PRIO_BEFORE, list, 2); } - + virtual ~ModuleSpy() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); diff --git a/src/modules/m_ssl_dummy.cpp b/src/modules/m_ssl_dummy.cpp index 143e1199d..5a8a0e884 100644 --- a/src/modules/m_ssl_dummy.cpp +++ b/src/modules/m_ssl_dummy.cpp @@ -17,21 +17,21 @@ class ModuleSSLDummy : public Module { - + char* dummy; public: - + ModuleSSLDummy(InspIRCd* Me) : Module(Me) { - + Implementation eventlist[] = { I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnWhois }; ServerInstance->Modules->Attach(eventlist, this, 3); } - + virtual ~ModuleSSLDummy() { } - + virtual Version GetVersion() { return Version(1, 0, 0, 0, VF_VENDOR, API_VERSION); @@ -46,7 +46,7 @@ class ModuleSSLDummy : public Module ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str()); } } - + virtual void OnSyncUserMetaData(User* user, Module* proto, void* opaque, const std::string &extname, bool displayable) { // check if the linking module wants to know about OUR metadata @@ -61,7 +61,7 @@ class ModuleSSLDummy : public Module } } } - + virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata) { // check if its our metadata key, and its associated with a user diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 5a0298b41..f720e6147 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -65,14 +65,14 @@ class SSLMode : public ModeHandler class ModuleSSLModes : public Module { - + SSLMode* sslm; - + public: ModuleSSLModes(InspIRCd* Me) : Module(Me) { - + sslm = new SSLMode(ServerInstance); if (!ServerInstance->Modes->AddMode(sslm)) @@ -98,7 +98,7 @@ class ModuleSSLModes : public Module return 1; } } - + return 0; } @@ -107,7 +107,7 @@ class ModuleSSLModes : public Module ServerInstance->Modes->DelMode(sslm); delete sslm; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 420e2e6e2..9fec3dcad 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -37,7 +37,7 @@ class ModuleStripColor : public Module bool AllowChanOps; ChannelStripColor *csc; UserStripColor *usc; - + public: ModuleStripColor(InspIRCd* Me) : Module(Me) { @@ -58,7 +58,7 @@ class ModuleStripColor : public Module delete usc; delete csc; } - + virtual void ReplaceLine(std::string &sentence) { /* refactor this completely due to SQUIT bug since the old code would strip last char and replace with \0 --peavey */ @@ -78,7 +78,7 @@ class ModuleStripColor : public Module } else seq = 0; - + if (seq || ((*i == 2) || (*i == 15) || (*i == 22) || (*i == 21) || (*i == 31))) { if (i != sentence.begin()) @@ -131,17 +131,17 @@ class ModuleStripColor : public Module return 0; } - + virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } - + }; MODULE_INIT(ModuleStripColor) diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index c1c7e8421..b90e452bf 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -109,7 +109,7 @@ class CommandSvshold : public Command // parameters[0] = w00t // parameters[1] = 1h3m2s // parameters[2] = Registered nickname - + /* Already exists? */ if (HoldMap.find(parameters[0].c_str()) != HoldMap.end()) { @@ -119,7 +119,7 @@ class CommandSvshold : public Command unsigned long length = ServerInstance->Duration(parameters[1]); std::string reason = (parameters.size() > 2) ? parameters[2] : "No reason supplied"; - + SVSHold* S = new SVSHold(parameters[0], user->nick, ServerInstance->Time(), length, reason); SVSHolds.push_back(S); HoldMap[parameters[0].c_str()] = S; @@ -156,7 +156,7 @@ bool SVSHoldComp(const SVSHold* ban1, const SVSHold* ban2) class ModuleSVSHold : public Module { CommandSvshold *mycommand; - + public: ModuleSVSHold(InspIRCd* Me) : Module(Me) @@ -167,11 +167,11 @@ class ModuleSVSHold : public Module ServerInstance->Modules->Attach(eventlist, this, 4); } - + virtual int OnStats(char symbol, User* user, string_list &results) { ExpireBans(); - + if(symbol == 'S') { for(SVSHoldlist::iterator iter = SVSHolds.begin(); iter != SVSHolds.end(); iter++) @@ -180,14 +180,14 @@ class ModuleSVSHold : public Module results.push_back(std::string(ServerInstance->Config->ServerName)+" 210 "+user->nick+" "+(*iter)->nickname.c_str()+" "+(*iter)->set_by+" "+ConvToStr((*iter)->set_on)+" "+ConvToStr((*iter)->length)+" "+ConvToStr(remaining)+" :"+(*iter)->reason); } } - + return 0; } virtual int OnUserPreNick(User *user, const std::string &newnick) { ExpireBans(); - + /* check SVSHolds in here, and apply as necessary. */ SVSHoldMap::iterator n = HoldMap.find(assign(newnick)); if (n != HoldMap.end()) @@ -197,7 +197,7 @@ class ModuleSVSHold : public Module } return 0; } - + virtual void OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable) { for(SVSHoldMap::iterator iter = HoldMap.begin(); iter != HoldMap.end(); iter++) @@ -227,7 +227,7 @@ class ModuleSVSHold : public Module virtual ~ModuleSVSHold() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION); @@ -235,9 +235,9 @@ class ModuleSVSHold : public Module std::string EncodeSVSHold(const SVSHold* ban) { - std::ostringstream stream; + std::ostringstream stream; stream << ban->nickname << " " << ban->set_by << " " << ban->set_on << " " << ban->length << " :" << ban->reason; - return stream.str(); + return stream.str(); } SVSHold* DecodeSVSHold(const std::string &data) diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index c2ac8bef1..df959147a 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -19,7 +19,7 @@ */ class CommandSwhois : public Command { - + public: CommandSwhois (InspIRCd* Instance) : Command(Instance,"SWHOIS","o",2) { @@ -31,13 +31,13 @@ class CommandSwhois : public Command CmdResult Handle(const std::vector ¶meters, User* user) { User* dest = ServerInstance->FindNick(parameters[0]); - + if (!dest) { user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } - + std::string* text; dest->GetExt("swhois", text); @@ -47,7 +47,7 @@ class CommandSwhois : public Command if (!ServerInstance->ULine(user->server)) // Ulines set SWHOISes silently ServerInstance->SNO->WriteToSnoMask('A', "%s used SWHOIS to set %s's extra whois from '%s' to '%s'", user->nick.c_str(), dest->nick.c_str(), text->c_str(), parameters[0].c_str()); - + dest->Shrink("swhois"); delete text; } @@ -56,7 +56,7 @@ class CommandSwhois : public Command // Ulines set SWHOISes silently ServerInstance->SNO->WriteToSnoMask('A', "%s used SWHOIS to set %s's extra whois to '%s'", user->nick.c_str(), dest->nick.c_str(), parameters[0].c_str()); } - + text = new std::string(parameters[0]); dest->Extend("swhois", text); @@ -67,7 +67,7 @@ class CommandSwhois : public Command * -- Brain */ ServerInstance->PI->SendMetaData(dest, TYPE_USER, "swhois", *text); - + // If it's an empty swhois, unset it (not ideal, but ok) if (text->empty()) { @@ -83,13 +83,13 @@ class CommandSwhois : public Command class ModuleSWhois : public Module { CommandSwhois* mycommand; - + ConfigReader* Conf; - + public: ModuleSWhois(InspIRCd* Me) : Module(Me) { - + Conf = new ConfigReader(ServerInstance); mycommand = new CommandSwhois(ServerInstance); ServerInstance->AddCommand(mycommand); @@ -202,31 +202,31 @@ class ModuleSWhois : public Module dest->Extend("swhois", text); } } - + virtual void OnPostCommand(const std::string &command, const std::vector ¶ms, User *user, CmdResult result, const std::string &original_line) { if ((command != "OPER") || (result != CMD_SUCCESS)) return; - + std::string swhois; - + for (int i = 0; i < Conf->Enumerate("oper"); i++) { std::string name = Conf->ReadValue("oper", "name", i); - + if (name == params[0]) { swhois = Conf->ReadValue("oper", "swhois", i); break; } } - + if (!swhois.length()) { for (int i = 0; i < Conf->Enumerate("type"); i++) { std::string type = Conf->ReadValue("type", "name", i); - + if (type == user->oper) { swhois = Conf->ReadValue("type", "swhois", i); @@ -241,10 +241,10 @@ class ModuleSWhois : public Module user->Shrink("swhois"); delete old; } - + if (!swhois.length()) return; - + std::string *text = new std::string(swhois); user->Extend("swhois", text); ServerInstance->PI->SendMetaData(user, TYPE_USER, "swhois", *text); @@ -254,7 +254,7 @@ class ModuleSWhois : public Module { delete Conf; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_taxonomy.cpp b/src/modules/m_taxonomy.cpp index 4102737ac..516af20c3 100644 --- a/src/modules/m_taxonomy.cpp +++ b/src/modules/m_taxonomy.cpp @@ -60,7 +60,7 @@ class ModuleTaxonomy : public Module ModuleTaxonomy(InspIRCd* Me) : Module(Me) { - + // Create a new command newcommand = new CommandTaxonomy(ServerInstance, this, claimed); ServerInstance->AddCommand(newcommand); diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index a2eda3112..dbf7fc076 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -113,14 +113,14 @@ class ModuleTimedBans : public Module ModuleTimedBans(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandTban(ServerInstance); ServerInstance->AddCommand(mycommand); TimedBanList.clear(); Implementation eventlist[] = { I_OnDelBan, I_OnBackgroundTimer }; ServerInstance->Modules->Attach(eventlist, this, 2); } - + virtual ~ModuleTimedBans() { TimedBanList.clear(); @@ -183,7 +183,7 @@ class ModuleTimedBans : public Module } } } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index 79f9dff3c..31bd67e17 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -17,7 +17,7 @@ /* $ModDesc: Provides /tline command used to test who a mask matches */ /** Handle /TLINE - */ + */ class CommandTline : public Command { public: @@ -57,7 +57,7 @@ class CommandTline : public Command else user->WriteServ( "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against no user(s).", user->nick.c_str(), n_counted, parameters[0].c_str()); - return CMD_LOCALONLY; + return CMD_LOCALONLY; } }; @@ -68,7 +68,7 @@ class ModuleTLine : public Module ModuleTLine(InspIRCd* Me) : Module(Me) { - + newcommand = new CommandTline(ServerInstance); ServerInstance->AddCommand(newcommand); @@ -78,7 +78,7 @@ class ModuleTLine : public Module virtual ~ModuleTLine() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR,API_VERSION); diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index e2144febc..882acefc9 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -20,7 +20,7 @@ class ModuleUHNames : public Module { CUList nl; public: - + ModuleUHNames(InspIRCd* Me) : Module(Me) { diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index d87caea9d..1761f354c 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -16,7 +16,7 @@ #include "inspircd.h" /** Handle /UNINVITE - */ + */ class CommandUninvite : public Command { public: @@ -31,9 +31,9 @@ class CommandUninvite : public Command { User* u = ServerInstance->FindNick(parameters[0]); Channel* c = ServerInstance->FindChan(parameters[1]); - + if ((!c) || (!u)) - { + { if (!c) { user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[1].c_str()); @@ -42,9 +42,9 @@ class CommandUninvite : public Command { user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); } - + return CMD_FAILURE; - } + } if (c->modes[CM_INVITEONLY]) { @@ -86,16 +86,16 @@ class ModuleUninvite : public Module ModuleUninvite(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandUninvite(ServerInstance); ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleUninvite() { } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index d7c5792e8..36d9014d9 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -53,7 +53,7 @@ class ModuleUserIP : public Module ModuleUserIP(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandUserip(ServerInstance); ServerInstance->AddCommand(mycommand); Implementation eventlist[] = { I_On005Numeric }; @@ -65,16 +65,16 @@ class ModuleUserIP : public Module { output = output + std::string(" USERIP"); } - + virtual ~ModuleUserIP() { } - + virtual Version GetVersion() { return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleUserIP) diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index ecc67b19e..406891740 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -60,7 +60,7 @@ class ModuleVHost : public Module private: CommandVhost* mycommand; - + public: ModuleVHost(InspIRCd* Me) : Module(Me) { @@ -68,7 +68,7 @@ class ModuleVHost : public Module ServerInstance->AddCommand(mycommand); } - + virtual ~ModuleVHost() { } @@ -78,7 +78,7 @@ class ModuleVHost : public Module { return Version(1,2,0,1,VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleVHost) diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 62949e48a..bbda1f593 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -49,7 +49,7 @@ * * KEY: Brain ---> Watched by: Boo, w00t, Om * KEY: Boo ---> Watched by: Brain, w00t - * + * * This is used when we want to tell all the users that are watching someone that * they are now available or no longer available. For example, if the hash was * populated as shown above, then when Brain signs on, messages are sent to Boo, w00t @@ -114,16 +114,16 @@ class CommandSVSWatch : public Command { if (!ServerInstance->ULine(user->server)) return CMD_FAILURE; - + User *u = ServerInstance->FindNick(parameters[0]); if (!u) return CMD_FAILURE; - + if (IS_LOCAL(u)) { ServerInstance->Parser->CallHandler("WATCH", parameters, u); } - + return CMD_SUCCESS; } }; @@ -373,7 +373,7 @@ class Modulewatch : public Module CommandWatch* mycommand; CommandSVSWatch *sw; unsigned int maxwatch; - + public: Modulewatch(InspIRCd* Me) : Module(Me), maxwatch(32) @@ -457,7 +457,7 @@ class Modulewatch : public Module if (n != i2->second.end()) /* I'm no longer watching you... */ i2->second.erase(n); - + if (!i2->second.size()) whos_watching_me->erase(user->nick.c_str()); } @@ -545,19 +545,19 @@ class Modulewatch : public Module } } } - } + } virtual void On005Numeric(std::string &output) { // we don't really have a limit... output = output + " WATCH=" + ConvToStr(maxwatch); } - + virtual ~Modulewatch() { delete whos_watching_me; } - + virtual Version GetVersion() { return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index fa4d67d59..3255030e3 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -235,7 +235,7 @@ class ModuleXLineDB : public Module return true; } - + virtual Version GetVersion() { diff --git a/src/modules/m_xmlsocket.cpp b/src/modules/m_xmlsocket.cpp index ea8485172..0e29cb993 100644 --- a/src/modules/m_xmlsocket.cpp +++ b/src/modules/m_xmlsocket.cpp @@ -97,7 +97,7 @@ class ModuleXMLSocket : public Module } } - virtual void OnCleanup(int target_type, void* item) + virtual void OnCleanup(int target_type, void* item) { if(target_type == TYPE_USER) { -- 2.39.2