STL namespace fixes

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@176 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
randomdan 2003-07-22 21:56:38 +00:00
parent e1cc6b33f4
commit 61b45c935d
16 changed files with 217 additions and 216 deletions

View File

@ -53,15 +53,15 @@ class InviteItem : public HostItem
/** Holds a complete ban list /** Holds a complete ban list
*/ */
typedef vector<BanItem> BanList; typedef std::vector<BanItem> BanList;
/** Holds a complete exempt list /** Holds a complete exempt list
*/ */
typedef vector<ExemptItem> ExemptList; typedef std::vector<ExemptItem> ExemptList;
/** Holds a complete invite list /** Holds a complete invite list
*/ */
typedef vector<InviteItem> InviteList; typedef std::vector<InviteItem> InviteList;
/** Holds all relevent information for a channel. /** Holds all relevent information for a channel.
* This class represents a channel, and contains its name, modes, time created, topic, topic set time, * This class represents a channel, and contains its name, modes, time created, topic, topic set time,
@ -135,11 +135,11 @@ class chanrec : public classbase
/** Sets or unsets a custom mode in the channels info /** Sets or unsets a custom mode in the channels info
*/ */
SetCustomMode(char mode,bool mode_on); void SetCustomMode(char mode,bool mode_on);
/** Sets or unsets the parameterrs for a custom mode in a channels info /** Sets or unsets the parameterrs for a custom mode in a channels info
*/ */
SetCustomModeParam(char mode,char* parameter,bool mode_on); void SetCustomModeParam(char mode,char* parameter,bool mode_on);
/** Creates a channel record and initialises it with default values /** Creates a channel record and initialises it with default values
*/ */

View File

@ -5,7 +5,7 @@
#include "inspircd_config.h" #include "inspircd_config.h"
#include "base.h" #include "base.h"
#include <string> #include <string>
#include <map.h> #include <map>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#include <netdb.h> #include <netdb.h>

View File

@ -10,13 +10,13 @@
// include the common header files // include the common header files
#include <typeinfo> #include <typeinfo>
#include <iostream.h> #include <iostream>
#include <string> #include <string>
#include <deque> #include <deque>
#include "users.h" #include "users.h"
#include "channels.h" #include "channels.h"
typedef deque<string> file_cache; typedef std::deque<std::string> file_cache;
void WriteOpers(char* text, ...); void WriteOpers(char* text, ...);
void log(int level, char *text, ...); void log(int level, char *text, ...);
@ -31,14 +31,15 @@ void WriteCommon(userrec *u, char* text, ...);
void WriteCommonExcept(userrec *u, char* text, ...); void WriteCommonExcept(userrec *u, char* text, ...);
void WriteWallOps(userrec *source, char* text, ...); void WriteWallOps(userrec *source, char* text, ...);
int isnick(const char *n); int isnick(const char *n);
userrec* Find(string nick); userrec* Find(std::string nick);
chanrec* FindChan(const char* chan); chanrec* FindChan(const char* chan);
char* cmode(userrec *user, chanrec *chan); char* cmode(userrec *user, chanrec *chan);
string getservername(); std::string getservername();
string getnetworkname(); std::string getnetworkname();
string getadminname(); std::string getadminname();
string getadminemail(); std::string getadminemail();
string getadminnick(); std::string getadminnick();
void readfile(file_cache &F, const char* fname); void readfile(file_cache &F, const char* fname);
int ModeDefiend(char c, int i);
#endif #endif

View File

@ -46,7 +46,7 @@
#define SPARSE 40 #define SPARSE 40
#define NONE 50 #define NONE 50
typedef deque<string> file_cache; typedef std::deque<std::string> file_cache;
/* prototypes */ /* prototypes */
int InspIRCd(void); int InspIRCd(void);
@ -69,14 +69,16 @@ void WriteCommon(userrec *u, char* text, ...);
void WriteCommonExcept(userrec *u, char* text, ...); void WriteCommonExcept(userrec *u, char* text, ...);
void WriteWallOps(userrec *source, char* text, ...); void WriteWallOps(userrec *source, char* text, ...);
int isnick(const char *n); int isnick(const char *n);
userrec* Find(string nick); userrec* Find(std::string nick);
chanrec* FindChan(const char* chan); chanrec* FindChan(const char* chan);
char* cmode(userrec *user, chanrec *chan); char* cmode(userrec *user, chanrec *chan);
string getservername(); std::string getservername();
string getserverdesc(); std::string getserverdesc();
string getnetworkname(); std::string getnetworkname();
string getadminname(); std::string getadminname();
string getadminemail(); std::string getadminemail();
string getadminnick(); std::string getadminnick();
void readfile(file_cache &F, const char* fname); void readfile(file_cache &F, const char* fname);
bool ModeDefined(char c, int i);
bool ModeDefinedOn(char c, int i);
bool ModeDefinedOff(char c, int i);

View File

@ -25,7 +25,7 @@
/** Low level definition of a FileReader classes file cache area /** Low level definition of a FileReader classes file cache area
*/ */
typedef deque<string> file_cache; typedef std::deque<std::string> file_cache;
typedef file_cache string_list; typedef file_cache string_list;
// This #define allows us to call a method in all // This #define allows us to call a method in all
@ -56,8 +56,8 @@ class Version : public classbase
class Admin : public classbase class Admin : public classbase
{ {
public: public:
const string Name, Email, Nick; const std::string Name, Email, Nick;
Admin(string name,string email,string nick); Admin(std::string name, std::string email, std::string nick);
}; };
/** Base class for all InspIRCd modules /** Base class for all InspIRCd modules
@ -137,7 +137,7 @@ class Module : public classbase
* the string parameter "raw". If you do this, after your function exits it will immediately be * the string parameter "raw". If you do this, after your function exits it will immediately be
* cut down to 510 characters plus a carriage return and linefeed. * cut down to 510 characters plus a carriage return and linefeed.
*/ */
virtual void OnServerRaw(string &raw, bool inbound); virtual void OnServerRaw(std::string &raw, bool inbound);
/** Called whenever an extended mode is to be processed. /** Called whenever an extended mode is to be processed.
* The type parameter is MT_SERVER, MT_CLIENT or MT_CHANNEL, dependent on where the mode is being * The type parameter is MT_SERVER, MT_CLIENT or MT_CHANNEL, dependent on where the mode is being
@ -172,39 +172,39 @@ class Server : public classbase
/** Sends text to all opers. /** Sends text to all opers.
* This method sends a server notice to all opers with the usermode +s. * This method sends a server notice to all opers with the usermode +s.
*/ */
virtual void SendOpers(string s); virtual void SendOpers(std::string s);
/** Writes a log string. /** Writes a log string.
* This method writes a line of text to the log. If the level given is lower than the * This method writes a line of text to the log. If the level given is lower than the
* level given in the configuration, this command has no effect. * level given in the configuration, this command has no effect.
*/ */
virtual void Log(int level, string s); virtual void Log(int level, std::string s);
/** Sends a line of text down a TCP/IP socket. /** Sends a line of text down a TCP/IP socket.
* This method writes a line of text to an established socket, cutting it to 510 characters * This method writes a line of text to an established socket, cutting it to 510 characters
* plus a carriage return and linefeed if required. * plus a carriage return and linefeed if required.
*/ */
virtual void Send(int Socket, string s); virtual void Send(int Socket, std::string s);
/** Sends text from the server to a socket. /** Sends text from the server to a socket.
* This method writes a line of text to an established socket, with the servername prepended * This method writes a line of text to an established socket, with the servername prepended
* as used by numerics (see RFC 1459) * as used by numerics (see RFC 1459)
*/ */
virtual void SendServ(int Socket, string s); virtual void SendServ(int Socket, std::string s);
/** Sends text from a user to a socket. /** Sends text from a user to a socket.
* This method writes a line of text to an established socket, with the given user's nick/ident * This method writes a line of text to an established socket, with the given user's nick/ident
* /host combination prepended, as used in PRIVSG etc commands (see RFC 1459) * /host combination prepended, as used in PRIVSG etc commands (see RFC 1459)
*/ */
virtual void SendFrom(int Socket, userrec* User, string s); virtual void SendFrom(int Socket, userrec* User, std::string s);
/** Sends text from a user to another user. /** Sends text from a user to another user.
* This method writes a line of text to a user, with a user's nick/ident * This method writes a line of text to a user, with a user's nick/ident
* /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459) * /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459)
*/ */
virtual void SendTo(userrec* Source, userrec* Dest, string s); virtual void SendTo(userrec* Source, userrec* Dest, std::string s);
/** Sends text from a user to a channel (mulicast). /** Sends text from a user to a channel (mulicast).
* This method writes a line of text to a channel, with the given user's nick/ident * This method writes a line of text to a channel, with the given user's nick/ident
* /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the * /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the
* IncludeSender flag is set, then the text is also sent back to the user from which * IncludeSender flag is set, then the text is also sent back to the user from which
* it originated, as seen in MODE (see RFC 1459). * it originated, as seen in MODE (see RFC 1459).
*/ */
virtual void SendChannel(userrec* User, chanrec* Channel, string s,bool IncludeSender); virtual void SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender);
/** Returns true if two users share a common channel. /** Returns true if two users share a common channel.
* This method is used internally by the NICK and QUIT commands, and the Server::SendCommon * This method is used internally by the NICK and QUIT commands, and the Server::SendCommon
* method. * method.
@ -217,36 +217,36 @@ class Server : public classbase
* back to the user from which it originated, as seen in NICK (see RFC 1459). Otherwise, it * back to the user from which it originated, as seen in NICK (see RFC 1459). Otherwise, it
* is only sent to the other recipients, as seen in QUIT. * is only sent to the other recipients, as seen in QUIT.
*/ */
virtual void SendCommon(userrec* User, string text,bool IncludeSender); virtual void SendCommon(userrec* User, std::string text,bool IncludeSender);
/** Sends a WALLOPS message. /** Sends a WALLOPS message.
* This method writes a WALLOPS message to all users with the +w flag, originating from the * This method writes a WALLOPS message to all users with the +w flag, originating from the
* specified user. * specified user.
*/ */
virtual void SendWallops(userrec* User, string text); virtual void SendWallops(userrec* User, std::string text);
/** Returns true if a nick is valid. /** Returns true if a nick is valid.
* Nicks for unregistered connections will return false. * Nicks for unregistered connections will return false.
*/ */
virtual bool IsNick(string nick); virtual bool IsNick(std::string nick);
/** Attempts to look up a nick and return a pointer to it. /** Attempts to look up a nick and return a pointer to it.
* This function will return NULL if the nick does not exist. * This function will return NULL if the nick does not exist.
*/ */
virtual userrec* FindNick(string nick); virtual userrec* FindNick(std::string nick);
/** Attempts to look up a channel and return a pointer to it. /** Attempts to look up a channel and return a pointer to it.
* This function will return NULL if the channel does not exist. * This function will return NULL if the channel does not exist.
*/ */
virtual chanrec* FindChannel(string channel); virtual chanrec* FindChannel(std::string channel);
/** Attempts to look up a user's privilages on a channel. /** Attempts to look up a user's privilages on a channel.
* This function will return a string containing either @, %, +, or an empty string, * This function will return a string containing either @, %, +, or an empty string,
* representing the user's privilages upon the channel you specify. * representing the user's privilages upon the channel you specify.
*/ */
virtual string ChanMode(userrec* User, chanrec* Chan); virtual std::string ChanMode(userrec* User, chanrec* Chan);
/** Returns the server name of the server where the module is loaded. /** Returns the server name of the server where the module is loaded.
*/ */
virtual string GetServerName(); virtual std::string GetServerName();
/** Returns the network name, global to all linked servers. /** Returns the network name, global to all linked servers.
*/ */
virtual string GetNetworkName(); virtual std::string GetNetworkName();
/** Returns the information of the server as returned by the /ADMIN command. /** Returns the information of the server as returned by the /ADMIN command.
* See the Admin class for further information of the return value. The members * See the Admin class for further information of the return value. The members
* Admin::Nick, Admin::Email and Admin::Name contain the information for the * Admin::Nick, Admin::Email and Admin::Name contain the information for the
@ -285,7 +285,7 @@ class ConfigReader : public classbase
protected: protected:
/** The filename of the configuration file, as set by the constructor. /** The filename of the configuration file, as set by the constructor.
*/ */
string fname; std::string fname;
public: public:
/** Default constructor. /** Default constructor.
* This constructor initialises the ConfigReader class to read the inspircd.conf file * This constructor initialises the ConfigReader class to read the inspircd.conf file
@ -295,7 +295,7 @@ class ConfigReader : public classbase
/** Overloaded constructor. /** Overloaded constructor.
* This constructor initialises the ConfigReader class to read a user-specified config file * This constructor initialises the ConfigReader class to read a user-specified config file
*/ */
ConfigReader(string filename); // read a module-specific config ConfigReader(std::string filename); // read a module-specific config
/** Default destructor. /** Default destructor.
* This method destroys the ConfigReader class. * This method destroys the ConfigReader class.
*/ */
@ -304,14 +304,14 @@ class ConfigReader : public classbase
* This method retrieves a value from the config file. Where multiple copies of the tag * This method retrieves a value from the config file. Where multiple copies of the tag
* exist in the config file, index indicates which of the values to retrieve. * exist in the config file, index indicates which of the values to retrieve.
*/ */
string ReadValue(string tag, string name, int index); std::string ReadValue(std::string tag, std::string name, int index);
/** Counts the number of times a given tag appears in the config file. /** Counts the number of times a given tag appears in the config file.
* This method counts the number of times a tag appears in a config file, for use where * This method counts the number of times a tag appears in a config file, for use where
* there are several tags of the same kind, e.g. with opers and connect types. It can be * there are several tags of the same kind, e.g. with opers and connect types. It can be
* used with the index value of ConfigReader::ReadValue to loop through all copies of a * used with the index value of ConfigReader::ReadValue to loop through all copies of a
* multiple instance tag. * multiple instance tag.
*/ */
int Enumerate(string tag); int Enumerate(std::string tag);
/** Returns true if a config file is valid. /** Returns true if a config file is valid.
* This method is unimplemented and will always return true. * This method is unimplemented and will always return true.
*/ */
@ -339,7 +339,7 @@ class FileReader : public classbase
* and other methods to be called. If the file could not be loaded, FileReader::FileSize * and other methods to be called. If the file could not be loaded, FileReader::FileSize
* returns 0. * returns 0.
*/ */
FileReader(string filename); FileReader(std::string filename);
/** Default destructor. /** Default destructor.
* This deletes the memory allocated to the file. * This deletes the memory allocated to the file.
*/ */
@ -349,12 +349,12 @@ class FileReader : public classbase
* and other methods to be called. If the file could not be loaded, FileReader::FileSize * and other methods to be called. If the file could not be loaded, FileReader::FileSize
* returns 0. * returns 0.
*/ */
void LoadFile(string filename); void LoadFile(std::string filename);
/** Retrieve one line from the file. /** Retrieve one line from the file.
* This method retrieves one line from the text file. If an empty non-NULL string is returned, * This method retrieves one line from the text file. If an empty non-NULL string is returned,
* the index was out of bounds, or the line had no data on it. * the index was out of bounds, or the line had no data on it.
*/ */
string GetLine(int x); std::string GetLine(int x);
/** Returns the size of the file in lines. /** Returns the size of the file in lines.
* This method returns the number of lines in the read file. If it is 0, no lines have been * This method returns the number of lines in the read file. If it is 0, no lines have been
* read into memory, either because the file is empty or it does not exist, or cannot be * read into memory, either because the file is empty or it does not exist, or cannot be

View File

@ -6,7 +6,7 @@
#include "inspircd_config.h" #include "inspircd_config.h"
#include "connection.h" #include "connection.h"
#include <string> #include <string>
#include <map.h> #include <map>
#ifndef __SERVERS_H__ #ifndef __SERVERS_H__
#define __SERVERS_H__ #define __SERVERS_H__
@ -58,7 +58,7 @@ class serverrec : public connection
typedef map<string, serverrec*> server_list; typedef std::map<std::string, serverrec*> server_list;
#endif #endif

View File

@ -41,13 +41,13 @@ class ConnectClass : public classbase
/** Holds a complete list of all channels to which a user has been invited and has not yet joined. /** Holds a complete list of all channels to which a user has been invited and has not yet joined.
*/ */
typedef vector<Invited> InvitedList; typedef std::vector<Invited> InvitedList;
/** Holds a complete list of all allow and deny tags from the configuration file (connection classes) /** Holds a complete list of all allow and deny tags from the configuration file (connection classes)
*/ */
typedef vector<ConnectClass> ClassVector; typedef std::vector<ConnectClass> ClassVector;
/** Holds all information about a user /** Holds all information about a user
* This class stores all information about a user connected to the irc server. Everything about a * This class stores all information about a user connected to the irc server. Everything about a

View File

@ -14,11 +14,11 @@ chanrec::chanrec()
topiclock = noexternal = inviteonly = moderated = secret = c_private = false; topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
} }
chanrec::SetCustomMode(char mode,bool mode_on) void chanrec::SetCustomMode(char mode,bool mode_on)
{ {
} }
chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on) void chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on)
{ {
} }

View File

@ -7,8 +7,8 @@
#include "inspircd.h" #include "inspircd.h"
#include "modules.h" #include "modules.h"
extern vector<Module*> modules; extern std::vector<Module*> modules;
extern vector<ircd_module*> factory; extern std::vector<ircd_module*> factory;
extern int MODCOUNT; extern int MODCOUNT;

View File

@ -47,7 +47,7 @@ bool DLLManager::GetSymbol(
DLLFactoryBase::DLLFactoryBase( DLLFactoryBase::DLLFactoryBase(
const char *fname, const char *fname,
const char *factory=0 const char *factory
) : DLLManager(fname) ) : DLLManager(fname)
{ {
// try get the factory function if there is no error yet // try get the factory function if there is no error yet

View File

@ -28,8 +28,8 @@
#include <cstdio> #include <cstdio>
#include <time.h> #include <time.h>
#include <string> #include <string>
#include <hash_map.h> #include <hash_map>
#include <map.h> #include <map>
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <errno.h> #include <errno.h>
@ -70,7 +70,9 @@ extern vector<ircd_module*> factory;
extern int MODCOUNT; extern int MODCOUNT;
template<> struct hash<in_addr> namespace __gnu_cxx
{
template<> struct __gnu_cxx::hash<in_addr>
{ {
size_t operator()(const struct in_addr &a) const size_t operator()(const struct in_addr &a) const
{ {
@ -80,7 +82,7 @@ template<> struct hash<in_addr>
} }
}; };
template<> struct hash<string> template<> struct __gnu_cxx::hash<string>
{ {
size_t operator()(const string &s) const size_t operator()(const string &s) const
{ {
@ -91,7 +93,7 @@ template<> struct hash<string>
return strhash(a); return strhash(a);
} }
}; };
}
struct StrHashComp struct StrHashComp
@ -124,10 +126,10 @@ struct InAddr_HashComp
}; };
typedef hash_map<string, userrec*, hash<string>, StrHashComp> user_hash; typedef __gnu_cxx::hash_map<std::string, userrec*, __gnu_cxx::hash<string>, StrHashComp> user_hash;
typedef hash_map<string, chanrec*, hash<string>, StrHashComp> chan_hash; typedef __gnu_cxx::hash_map<std::string, chanrec*, __gnu_cxx::hash<string>, StrHashComp> chan_hash;
typedef hash_map<in_addr,string*, hash<in_addr>, InAddr_HashComp> address_cache; typedef __gnu_cxx::hash_map<in_addr,string*, __gnu_cxx::hash<in_addr>, InAddr_HashComp> address_cache;
typedef deque<command_t> command_table; typedef std::deque<command_t> command_table;
serverrec* me[32]; serverrec* me[32];
server_list* servers; server_list* servers;
@ -208,32 +210,32 @@ void chop(char* str)
} }
string getservername() std::string getservername()
{ {
return ServerName; return ServerName;
} }
string getserverdesc() std::string getserverdesc()
{ {
return ServerDesc; return ServerDesc;
} }
string getnetworkname() std::string getnetworkname()
{ {
return Network; return Network;
} }
string getadminname() std::string getadminname()
{ {
return AdminName; return AdminName;
} }
string getadminemail() std::string getadminemail()
{ {
return AdminEmail; return AdminEmail;
} }
string getadminnick() std::string getadminnick()
{ {
return AdminNick; return AdminNick;
} }
@ -245,7 +247,6 @@ void log(int level,char *text, ...)
FILE *f; FILE *f;
time_t rawtime; time_t rawtime;
struct tm * timeinfo; struct tm * timeinfo;
if (level < LogLevel) if (level < LogLevel)
return; return;
@ -1648,6 +1649,7 @@ void process_modes(char **parameters,userrec* user,chanrec *chan,int status, int
{ {
log(DEBUG,"process_modes: modechar: %c",modelist[ptr]); log(DEBUG,"process_modes: modechar: %c",modelist[ptr]);
char modechar = modelist[ptr];
switch (modelist[ptr]) switch (modelist[ptr])
{ {
case '-': case '-':
@ -1909,11 +1911,11 @@ void process_modes(char **parameters,userrec* user,chanrec *chan,int status, int
{ {
if (modules[i]->OnExtendedMode(user,chan,modechar,MT_CHANNEL,mdir,p)) if (modules[i]->OnExtendedMode(user,chan,modechar,MT_CHANNEL,mdir,p))
{ {
strcat(outlist,modelist[ptr]); char app[] = {modechar, 0};
strcat(outlist, app);
chan->SetCustomMode(modelist[ptr],mdir); chan->SetCustomMode(modelist[ptr],mdir);
// include parameters in output if mode has them // include parameters in output if mode has them
if ((ModeDefinedOn(modelist[ptr],MT_CHANNEL)>0) || if ((ModeDefinedOn(modelist[ptr],MT_CHANNEL)>0) || (ModeDefinedOff(modelist[ptr],MT_CHANNEL)>0))
(ModeDefinedOff(modelist[ptr],MT_CHANNEL)>0))
{ {
chan->SetCustomModeParam(modelist[ptr],parameters[param],mdir); chan->SetCustomModeParam(modelist[ptr],parameters[param],mdir);
strcpy(outpars[pc++],parameters[param++]); strcpy(outpars[pc++],parameters[param++]);
@ -3013,7 +3015,7 @@ void handle_quit(char **parameters, int pcnt, userrec *user)
void handle_who(char **parameters, int pcnt, userrec *user) void handle_who(char **parameters, int pcnt, userrec *user)
{ {
chanrec* Ptr = null; chanrec* Ptr = NULL;
/* theres more to do here, but for now just close the socket */ /* theres more to do here, but for now just close the socket */
if (pcnt == 1) if (pcnt == 1)
@ -4078,6 +4080,7 @@ int InspIRCd(void)
/* setup select call */ /* setup select call */
FD_ZERO(&selectFds); FD_ZERO(&selectFds);
log(DEBUG,"InspIRCd: startup: zero selects"); log(DEBUG,"InspIRCd: startup: zero selects");
log(VERBOSE,"InspIRCd: startup: portCount = %d", portCount);
for (count = 0; count < portCount; count++) for (count = 0; count < portCount; count++)
{ {
@ -4245,4 +4248,3 @@ int InspIRCd(void)
close (incomingSockfd); close (incomingSockfd);
} }

View File

@ -6,7 +6,7 @@
#include <typeinfo> #include <typeinfo>
#include <iostream.h> #include <iostream>
#include "globals.h" #include "globals.h"
#include "modules.h" #include "modules.h"
#include "inspircd_io.h" #include "inspircd_io.h"
@ -21,10 +21,10 @@ public:
bool default_on; bool default_on;
int params_when_on; int params_when_on;
int params_when_off; int params_when_off;
void SetInfo(char mc, int ty, bool d_on, int p_on, int p_off) : modechar(mc), type(ty), default_on(d_on), params_when_on(p_on), params_when_off(p_off) { }; ExtMode(char mc, int ty, bool d_on, int p_on, int p_off) : modechar(mc), type(ty), default_on(d_on), params_when_on(p_on), params_when_off(p_off) { };
}; };
typedef vector<ExtMode> ExtModeList; typedef std::vector<ExtMode> ExtModeList;
typedef ExtModeList::iterator ExtModeListIter; typedef ExtModeList::iterator ExtModeListIter;
ExtModeList EMode; ExtModeList EMode;
@ -71,9 +71,7 @@ int ModeDefinedOff(char modechar, int type)
// returns true if an extended mode character is in use // returns true if an extended mode character is in use
bool AddExtendedMode(char modechar, int type, bool default_on, int params_on, int params_off) bool AddExtendedMode(char modechar, int type, bool default_on, int params_on, int params_off)
{ {
ExtMode Mode; EMode.push_back( ExtMode (modechar,type,default_on,params_on,params_off));
Mode.SetInfo(modechar,type,default_on,params_on,params_off);
EMode.push_back(Mode);
return true; return true;
} }
@ -84,7 +82,7 @@ Version::Version(int major, int minor, int revision, int build) : Major(major),
// admin is a simple class for holding a server's administrative info // admin is a simple class for holding a server's administrative info
Admin::Admin(string name, string email, string nick) : Name(name), Email(email), Nick(nick) { }; Admin::Admin(std::string name, std::string email, std::string nick) : Name(name), Email(email), Nick(nick) { };
// //
// Announce to the world that the Module base // Announce to the world that the Module base
@ -100,7 +98,7 @@ void Module::OnUserPart(userrec* user, chanrec* channel) { }
void Module::OnPacketTransmit(char *p) { } void Module::OnPacketTransmit(char *p) { }
void Module::OnPacketReceive(char *p) { } void Module::OnPacketReceive(char *p) { }
void Module::OnRehash() { } void Module::OnRehash() { }
void Module::OnServerRaw(string &raw, bool inbound) { } void Module::OnServerRaw(std::string &raw, bool inbound) { }
bool Module::OnExtendedMode(userrec* user, chanrec* chan, char modechar, int type, bool mode_on, string_list &params) { } bool Module::OnExtendedMode(userrec* user, chanrec* chan, char modechar, int type, bool mode_on, string_list &params) { }
Version Module::GetVersion() { return Version(1,0,0,0); } Version Module::GetVersion() { return Version(1,0,0,0); }
@ -116,37 +114,37 @@ Server::~Server()
{ {
} }
void Server::SendOpers(string s) void Server::SendOpers(std::string s)
{ {
WriteOpers("%s",s.c_str()); WriteOpers("%s",s.c_str());
} }
void Server::Log(int level, string s) void Server::Log(int level, std::string s)
{ {
log(level,"%s",s.c_str()); log(level,"%s",s.c_str());
} }
void Server::Send(int Socket, string s) void Server::Send(int Socket, std::string s)
{ {
Write(Socket,"%s",s.c_str()); Write(Socket,"%s",s.c_str());
} }
void Server::SendServ(int Socket, string s) void Server::SendServ(int Socket, std::string s)
{ {
WriteServ(Socket,"%s",s.c_str()); WriteServ(Socket,"%s",s.c_str());
} }
void Server::SendFrom(int Socket, userrec* User, string s) void Server::SendFrom(int Socket, userrec* User, std::string s)
{ {
WriteFrom(Socket,User,"%s",s.c_str()); WriteFrom(Socket,User,"%s",s.c_str());
} }
void Server::SendTo(userrec* Source, userrec* Dest, string s) void Server::SendTo(userrec* Source, userrec* Dest, std::string s)
{ {
WriteTo(Source,Dest,"%s",s.c_str()); WriteTo(Source,Dest,"%s",s.c_str());
} }
void Server::SendChannel(userrec* User, chanrec* Channel, string s,bool IncludeSender) void Server::SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender)
{ {
if (IncludeSender) if (IncludeSender)
{ {
@ -163,7 +161,7 @@ bool Server::CommonChannels(userrec* u1, userrec* u2)
return (common_channels(u1,u2) != 0); return (common_channels(u1,u2) != 0);
} }
void Server::SendCommon(userrec* User, string text,bool IncludeSender) void Server::SendCommon(userrec* User, std::string text,bool IncludeSender)
{ {
if (IncludeSender) if (IncludeSender)
{ {
@ -175,38 +173,37 @@ void Server::SendCommon(userrec* User, string text,bool IncludeSender)
} }
} }
void Server::SendWallops(userrec* User, string text) void Server::SendWallops(userrec* User, std::string text)
{ {
WriteWallOps(User,"%s",text.c_str()); WriteWallOps(User,"%s",text.c_str());
} }
bool Server::IsNick(string nick) bool Server::IsNick(std::string nick)
{ {
return (isnick(nick.c_str()) != 0); return (isnick(nick.c_str()) != 0);
} }
userrec* Server::FindNick(string nick) userrec* Server::FindNick(std::string nick)
{ {
return Find(nick); return Find(nick);
} }
chanrec* Server::FindChannel(string channel) chanrec* Server::FindChannel(std::string channel)
{ {
return FindChan(channel.c_str()); return FindChan(channel.c_str());
} }
string Server::ChanMode(userrec* User, chanrec* Chan) std::string Server::ChanMode(userrec* User, chanrec* Chan)
{ {
string mode = cmode(User,Chan); return cmode(User,Chan);
return mode;
} }
string Server::GetServerName() std::string Server::GetServerName()
{ {
return getservername(); return getservername();
} }
string Server::GetNetworkName() std::string Server::GetNetworkName()
{ {
return getnetworkname(); return getnetworkname();
} }
@ -234,18 +231,17 @@ ConfigReader::~ConfigReader()
} }
ConfigReader::ConfigReader(string filename) : fname(filename) { }; ConfigReader::ConfigReader(std::string filename) : fname(filename) { };
string ConfigReader::ReadValue(string tag, string name, int index) std::string ConfigReader::ReadValue(std::string tag, std::string name, int index)
{ {
char val[MAXBUF]; char val[MAXBUF];
ReadConf(fname.c_str(),tag.c_str(),name.c_str(),index,val); ReadConf(fname.c_str(),tag.c_str(),name.c_str(),index,val);
string s = val; return val;
return s;
} }
int ConfigReader::Enumerate(string tag) int ConfigReader::Enumerate(std::string tag)
{ {
return EnumConf(fname.c_str(),tag.c_str()); return EnumConf(fname.c_str(),tag.c_str());
} }
@ -257,7 +253,7 @@ bool ConfigReader::Verify()
} }
FileReader::FileReader(string filename) FileReader::FileReader(std::string filename)
{ {
file_cache c; file_cache c;
readfile(c,filename.c_str()); readfile(c,filename.c_str());
@ -268,7 +264,7 @@ FileReader::FileReader()
{ {
} }
void FileReader::LoadFile(string filename) void FileReader::LoadFile(std::string filename)
{ {
file_cache c; file_cache c;
readfile(c,filename.c_str()); readfile(c,filename.c_str());
@ -279,7 +275,7 @@ FileReader::~FileReader()
{ {
} }
string FileReader::GetLine(int x) std::string FileReader::GetLine(int x)
{ {
if ((x<0) || (x>fc.size())) if ((x<0) || (x>fc.size()))
return ""; return "";
@ -292,8 +288,8 @@ int FileReader::FileSize()
} }
vector<Module*> modules(255); std::vector<Module*> modules(255);
vector<ircd_module*> factory(255); std::vector<ircd_module*> factory(255);
int MODCOUNT = -1; int MODCOUNT = -1;

View File

@ -32,13 +32,13 @@ class ModuleCloaking : public Module
{ {
if (strstr(user->dhost,".")) if (strstr(user->dhost,"."))
{ {
string a = strstr(user->dhost,"."); std::string a = strstr(user->dhost,".");
char ra[64]; char ra[64];
long seed,s2; long seed,s2;
memcpy(&seed,user->dhost,sizeof(long)); memcpy(&seed,user->dhost,sizeof(long));
memcpy(&s2,a.c_str(),sizeof(long)); memcpy(&s2,a.c_str(),sizeof(long));
sprintf(ra,"%.8X",seed*s2*strlen(user->host)); sprintf(ra,"%.8X",seed*s2*strlen(user->host));
string b = Srv->GetNetworkName() + "-" + ra + a; std::string b = Srv->GetNetworkName() + "-" + ra + a;
Srv->Log(DEBUG,"cloak: allocated "+b); Srv->Log(DEBUG,"cloak: allocated "+b);
strcpy(user->dhost,b.c_str()); strcpy(user->dhost,b.c_str());
} }

View File

@ -44,7 +44,7 @@ class ModuleFoobar : public Module
{ {
// method called when a user connects // method called when a user connects
string b = user->nick; std::string b = user->nick;
Srv->Log(DEBUG,"Foobar: User connecting: " + b); Srv->Log(DEBUG,"Foobar: User connecting: " + b);
} }
@ -52,7 +52,7 @@ class ModuleFoobar : public Module
{ {
// method called when a user disconnects // method called when a user disconnects
string b = user->nick; std::string b = user->nick;
Srv->Log(DEBUG,"Foobar: User quitting: " + b); Srv->Log(DEBUG,"Foobar: User quitting: " + b);
} }
@ -60,8 +60,8 @@ class ModuleFoobar : public Module
{ {
// method called when a user joins a channel // method called when a user joins a channel
string c = channel->name; std::string c = channel->name;
string b = user->nick; std::string b = user->nick;
Srv->Log(DEBUG,"Foobar: User " + b + " joined " + c); Srv->Log(DEBUG,"Foobar: User " + b + " joined " + c);
} }
@ -69,8 +69,8 @@ class ModuleFoobar : public Module
{ {
// method called when a user parts a channel // method called when a user parts a channel
string c = channel->name; std::string c = channel->name;
string b = user->nick; std::string b = user->nick;
Srv->Log(DEBUG,"Foobar: User " + b + " parted " + c); Srv->Log(DEBUG,"Foobar: User " + b + " parted " + c);
} }

View File

@ -17,9 +17,9 @@ class ModuleRandQuote : public Module
ConfigReader *conf; ConfigReader *conf;
FileReader *quotes; FileReader *quotes;
string q_file; std::string q_file;
string prefix; std::string prefix;
string suffix; std::string suffix;
public: public:
ModuleRandQuote() ModuleRandQuote()
@ -48,7 +48,7 @@ class ModuleRandQuote : public Module
virtual void OnUserConnect(userrec* user) virtual void OnUserConnect(userrec* user)
{ {
string str; std::string str;
int fsize; int fsize;
char buf[MAXBUF]; char buf[MAXBUF];

View File

@ -13,7 +13,7 @@ void Delete(char* str,int pos)
void Insert(char* substr,char* str,int pos) void Insert(char* substr,char* str,int pos)
{ {
string a = str; std::string a = str;
a.insert(pos,substr); a.insert(pos,substr);
strcpy(str,a.c_str()); strcpy(str,a.c_str());
} }