diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-26 00:58:31 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-26 00:58:31 +0000 |
commit | b6f5d703b010fa5e4cd1d082ea70fe0cc27fb9e9 (patch) | |
tree | a4968276af8ce4ab6d5281af8355cbab96b67934 /src/modules | |
parent | 566a3fe5ca4cf41e17b529a7c288aeecf6dda8de (diff) |
Major code tidyup (-W) - expect a few belches
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1190 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_sql.cpp | 16 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 36 | ||||
-rw-r--r-- | src/modules/m_antibottler.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_park.cpp | 6 |
4 files changed, 31 insertions, 29 deletions
diff --git a/src/modules/extra/m_sql.cpp b/src/modules/extra/m_sql.cpp index 45421e334..dd0cbdc1d 100644 --- a/src/modules/extra/m_sql.cpp +++ b/src/modules/extra/m_sql.cpp @@ -56,7 +56,9 @@ class SQLConnection this->pass = thispass; this->db = thisdb; this->id = myid; + unsigned int timeout = 1; mysql_init(&connection); + mysql_options(&connection,MYSQL_OPT_CONNECT_TIMEOUT,(char*)&timeout); } // This method connects to the database using the credentials supplied to the constructor, and returns @@ -187,18 +189,18 @@ class ModuleSQL : public Module } } - void LoadDatabases(ConfigReader* Conf) + void LoadDatabases(ConfigReader* ThisConf) { Srv->Log(DEFAULT,"SQL: Loading database settings"); Connections.clear(); Srv->Log(DEBUG,"Cleared connections"); - for (int j =0; j < Conf->Enumerate("database"); j++) + for (int j =0; j < ThisConf->Enumerate("database"); j++) { - std::string db = Conf->ReadValue("database","name",j); - std::string user = Conf->ReadValue("database","username",j); - std::string pass = Conf->ReadValue("database","password",j); - std::string host = Conf->ReadValue("database","hostname",j); - std::string id = Conf->ReadValue("database","id",j); + std::string db = ThisConf->ReadValue("database","name",j); + std::string user = ThisConf->ReadValue("database","username",j); + std::string pass = ThisConf->ReadValue("database","password",j); + std::string host = ThisConf->ReadValue("database","hostname",j); + std::string id = ThisConf->ReadValue("database","id",j); Srv->Log(DEBUG,"Read database settings"); if ((db != "") && (host != "") && (user != "") && (id != "") && (pass != "")) { diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 55343e96d..035012650 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -100,26 +100,26 @@ class ModuleSQLLog : public Module delete query; if (nid < 1) { - SQLRequest* query = new SQLRequest(SQL_COUNT,dbid,"INSERT INTO ircd_log_actors VALUES('','"+nick+"')"); - Request queryrequest((char*)query, this, SQLModule); - SQLResult* result = (SQLResult*)queryrequest.Send(); - if (result->GetType() == SQL_ERROR) + SQLRequest* query2 = new SQLRequest(SQL_COUNT,dbid,"INSERT INTO ircd_log_actors VALUES('','"+nick+"')"); + Request queryrequest2((char*)query2, this, SQLModule); + SQLResult* result2 = (SQLResult*)queryrequest2.Send(); + if (result2->GetType() == SQL_ERROR) { - Srv->Log(DEFAULT,"SQL log error: " + result->GetError()); + Srv->Log(DEFAULT,"SQL log error: " + result2->GetError()); } - if (result) + if (result2) delete result; - if (query) - delete query; + if (query2) + delete query2; nid = InsertNick(nick); } return nid; } - void InsertEntry(long category,long nickid,long hostid,long sourceid,unsigned long date) + void InsertEntry(unsigned long category,unsigned long nickid,unsigned long hostid,unsigned long sourceid,unsigned long date) { char querybuffer[MAXBUF]; - snprintf(querybuffer,MAXBUF,"INSERT INTO ircd_log VALUES('',%d,%d,%d,%d,%lu)",category,nickid,hostid,sourceid,date); + snprintf(querybuffer,MAXBUF,"INSERT INTO ircd_log VALUES('',%lu,%lu,%lu,%lu,%lu)",(unsigned long)category,(unsigned long)nickid,(unsigned long)hostid,(unsigned long)sourceid,(unsigned long)date); SQLRequest* query = new SQLRequest(SQL_COUNT,dbid,querybuffer); Request queryrequest((char*)query, this, SQLModule); SQLResult* result = (SQLResult*)queryrequest.Send(); @@ -160,17 +160,17 @@ class ModuleSQLLog : public Module delete query; if (hid < 1) { - SQLRequest* query = new SQLRequest(SQL_COUNT,dbid,"INSERT INTO ircd_log_hosts VALUES('','"+host+"')"); - Request queryrequest((char*)query, this, SQLModule); - SQLResult* result = (SQLResult*)queryrequest.Send(); - if (result->GetType() == SQL_ERROR) + SQLRequest* query2 = new SQLRequest(SQL_COUNT,dbid,"INSERT INTO ircd_log_hosts VALUES('','"+host+"')"); + Request queryrequest2((char*)query2, this, SQLModule); + SQLResult* result2 = (SQLResult*)queryrequest2.Send(); + if (result2->GetType() == SQL_ERROR) { - Srv->Log(DEFAULT,"SQL log error: " + result->GetError()); + Srv->Log(DEFAULT,"SQL log error: " + result2->GetError()); } if (result) - delete result; + delete result2; if (query) - delete query; + delete query2; hid = InsertHost(host); } return hid; @@ -185,7 +185,7 @@ class ModuleSQLLog : public Module long nickid = InsertNick(nick); long sourceid = InsertNick(source); long hostid = InsertHost(host); - InsertEntry(category,nickid,hostid,sourceid,time(NULL)); + InsertEntry((unsigned)category,(unsigned)nickid,(unsigned)hostid,(unsigned)sourceid,(unsigned long)time(NULL)); } virtual void OnOper(userrec* user) diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index 78db8f67c..fb85bb7b1 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -63,7 +63,7 @@ class ModuleAntiBottler : public Module } // Bug Fix (#14) -- FCS if (!strlen(data)) return; - char *user = strtok(data," "); + strtok(data," "); if (!strlen(data)) return; char *ident = strtok(NULL," "); if (!strlen(data)) return; diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 4407426b8..123a4dbe2 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -68,8 +68,8 @@ void handle_park(char **parameters, int pcnt, userrec *user) { awaylog* aw; char msg[MAXBUF]; - long key = abs(random() * 12345); - snprintf(msg,MAXBUF,"You are now parked. To unpark use /UNPARK %s %d",user->nick,key); + unsigned long key = abs(random() * 12345); + snprintf(msg,MAXBUF,"You are now parked. To unpark use /UNPARK %s %lu",user->nick,key); Srv->UserToPseudo(user,std::string(msg)); aw = new awaylog; user->Extend("park_awaylog",(char*)aw); @@ -84,7 +84,7 @@ void handle_park(char **parameters, int pcnt, userrec *user) void handle_parkstats(char **parameters, int pcnt, userrec *user) { char status[MAXBUF]; - snprintf(status,MAXBUF,"NOTICE %s :There are a total of %d parked clients on this server, with a maximum of %d parked sessions allowed per user.",user->nick,pinfo.size(),ConcurrentParks); + snprintf(status,MAXBUF,"NOTICE %s :There are a total of %lu parked clients on this server, with a maximum of %lu parked sessions allowed per user.",user->nick,(unsigned long)pinfo.size(),(unsigned long)ConcurrentParks); Srv->SendServ(user->fd,status); } |