fixed some indentation and spacing in modules

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9888 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
pippijn 2008-06-11 11:35:23 +00:00
parent 62ac378bfb
commit d185decae9
165 changed files with 1162 additions and 1164 deletions

View File

@ -133,7 +133,7 @@ class ModuleFilterPCRE : public FilterBase
}
virtual void OnRehash(User* user, const std::string &parameter)
{
{
ConfigReader MyConf(ServerInstance);
for (int index = 0; index < MyConf.Enumerate("keyword"); index++)

View File

@ -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 &parameter)
{
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)

View File

@ -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 &parameter)
{
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<User*>(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)

View File

@ -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();

View File

@ -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)

View File

@ -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 <database> 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)
{

View File

@ -25,7 +25,7 @@
class CoreExport RLine : public XLine
{
public:
public:
/** Create a R-Line.
* @param s_time The set time

View File

@ -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)

View File

@ -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");

View File

@ -304,7 +304,7 @@ class ModuleSQLLog : public Module
{
return Version(1,2,0,1,VF_VENDOR,API_VERSION);
}
};
MODULE_INIT(ModuleSQLLog)

View File

@ -106,7 +106,7 @@ public:
virtual void OnRehash(User* user, const std::string &parameter)
{
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)

View File

@ -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 <class T> 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)

View File

@ -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);

View File

@ -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();
listenports.clear();
clientactive = 0;
sslports.clear();
for(int index = 0; index < Conf.Enumerate("bind"); index++)
{
// For each <bind> 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);
for(int index = 0; index < Conf.Enumerate("bind"); index++)
{
// For each <bind> 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));
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);
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());
}
}
}
}
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)

View File

@ -31,8 +31,8 @@ class cmd_fingerprint : public Command
{
this->source = "m_ssl_oper_cert.so";
syntax = "<nickname>";
}
}
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
{
User* target = ServerInstance->FindNick(parameters[0]);
@ -115,7 +115,7 @@ class ModuleOperSSLCert : public Module
virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
{
irc::string cmd = command.c_str();
if ((cmd == "OPER") && (validated))
{
char TheHost[MAXBUF];

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -27,7 +27,7 @@ class HTTPHeaders : public classbase
protected:
std::map<std::string,std::string> 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<std::string,std::string>::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<std::string,std::string>::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<std::string,std::string>::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;

View File

@ -19,7 +19,7 @@ class ModuleAbbreviation : public Module
{
public:
ModuleAbbreviation(InspIRCd* Me)
: Module(Me)
{

View File

@ -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 &parameter)
{
ReadAliases();

View File

@ -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)

View File

@ -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;
}

View File

@ -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;

View File

@ -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'))

View File

@ -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);

View File

@ -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<unsigned>(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<Channel*>(item);
BanRedirectList* redirects;
if(chan->GetExt("banredirects", redirects))
{
irc::modestacker modestack(ServerInstance, false);
StringDeque stackresult;
std::vector<std::string> 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");

View File

@ -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 &parameter)
{
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)

View File

@ -31,7 +31,7 @@ class ModuleBlockCAPS : public Module
unsigned int minlen;
char capsmap[256];
public:
ModuleBlockCAPS(InspIRCd* Me) : Module(Me)
{
OnRehash(NULL,"");

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -171,7 +171,7 @@ class ModuleCBan : public Module
{
ServerInstance->XLines->UnregisterFactory(f);
}
virtual int OnStats(char symbol, User* user, string_list &results)
{
return 0;

View File

@ -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 &parameter)
{
/*
@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -69,7 +69,7 @@ class FounderProtectBase
std::vector<std::string> mode_junk;
mode_junk.push_back(channel->name);
irc::modestacker modestack(MyInstance, false);
std::deque<std::string> stackresult;
std::deque<std::string> 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);

View File

@ -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)

View File

@ -28,7 +28,7 @@ class CommandChghost : public Command
syntax = "<nick> <newhost>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
CmdResult Handle(const std::vector<std::string> &parameters, 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 &parameter)
{
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)

View File

@ -26,7 +26,7 @@ class CommandChgident : public Command
syntax = "<nick> <newident>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
CmdResult Handle(const std::vector<std::string> &parameters, 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)

View File

@ -26,7 +26,7 @@ class CommandChgname : public Command
syntax = "<nick> <newname>";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
CmdResult Handle(const std::vector<std::string> &parameters, 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)

View File

@ -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.
*/

View File

@ -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)

View File

@ -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;
}
};

View File

@ -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);

View File

@ -20,7 +20,7 @@ class ModuleConnJoin : public Module
private:
std::string JoinChan;
std::vector<std::string> Joinchans;
int tokenize(const std::string &str, std::vector<std::string> &tokens)
{

View File

@ -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))

View File

@ -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 &param)
{
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<std::string> &parameters, 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)

View File

@ -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);

View File

@ -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;

View File

@ -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<std::string> &parameters, 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);

View File

@ -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)

View File

@ -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<std::string> 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()

View File

@ -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'))

View File

@ -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 &param)
{
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)
{
/* <badchan:redirect> 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 */

View File

@ -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<DNSBLConfEntry*>::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;
}
};

View File

@ -21,7 +21,7 @@ typedef std::map<std::string,FilterResult*> filter_t;
class ModuleFilter : public FilterBase
{
filter_t filters;
public:
@ -31,7 +31,7 @@ class ModuleFilter : public FilterBase
OnRehash(NULL,"");
}
virtual ~ModuleFilter()
{
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -48,7 +48,7 @@ class CommandHelpop : public Command
user->WriteServ("NOTICE %s :HELPOP topic index", user->nick.c_str());
for (std::map<irc::string, std::string>::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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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 = "<html><head></head><body>Server error "+ConvToStr(response)+": "+Response(response)+"<br>"+
"<small>Powered by <a href='http://www.inspircd.org'>InspIRCd</a></small></body></html>";
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();
}

View File

@ -38,7 +38,7 @@ class HTTPACL : public Extensible
class ModuleHTTPAccessList : public Module
{
std::string stylesheet;
bool changed;
std::vector<HTTPACL> 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")
{

View File

@ -20,7 +20,7 @@
class ModuleHttpStats : public Module
{
std::string stylesheet;
bool changed;

View File

@ -20,7 +20,7 @@
class ModuleHttpStats : public Module
{
std::string stylesheet;
bool changed;
@ -155,7 +155,7 @@ class ModuleHttpStats : public Module
}
data << "</userlist><serverlist>";
ProtoServerList sl;
ServerInstance->PI->GetServerList(sl);

View File

@ -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 &param)
{
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

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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 &parameter, 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<User*> 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);

View File

@ -26,7 +26,7 @@ class CommandKnock : public Command
syntax = "<channel> <reason>";
TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
}
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
{
Channel* c = ServerInstance->FindChan(parameters[0]);

View File

@ -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;

View File

@ -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);

View File

@ -19,7 +19,7 @@
class ModuleNamesX : public Module
{
public:
ModuleNamesX(InspIRCd* Me)
: Module(Me)
{

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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'))

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -54,7 +54,7 @@ class ModuleOperjoin : public Module
virtual void OnRehash(User* user, const std::string &parameter)
{
ConfigReader* conf = new ConfigReader(ServerInstance);
operChan = conf->ReadValue("operjoin", "channel", 0);
override = conf->ReadFlag("operjoin", "override", "0", 0);
operChans.clear();

View File

@ -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<std::string> &parameters, 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)

View File

@ -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 <type:modes>,

View File

@ -74,7 +74,7 @@ class ModuleOpermotd : public Module
opermotd = new FileReader(ServerInstance, filename);
delete conf;
}
ModuleOpermotd(InspIRCd* Me)
: Module(Me)
{

View File

@ -20,7 +20,7 @@ typedef std::map<std::string,std::string> 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 &parameter)
{
// 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);

View File

@ -65,7 +65,7 @@ class CommandMkpasswd : public Command
class ModuleOperHash : public Module
{
CommandMkpasswd* mycommand;
hashymodules hashers; /* List of modules which implement HashRequest */
std::deque<std::string> 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");

View File

@ -50,7 +50,7 @@ class ModulePermanentChannels : public Module
{
PermChannel *p;
public:
ModulePermanentChannels(InspIRCd* Me) : Module(Me)
{
p = new PermChannel(ServerInstance);

View File

@ -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 &param)
{
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...");

View File

@ -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;
}

View File

@ -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)

View File

@ -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 &parameter, 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);

Some files were not shown because too many files have changed in this diff Show More