* @param text A printf-style format string which builds the output line without prefix
* @param ... Zero or more POD types
*/
- void WriteChannel(User* user, char* text, ...);
+ void WriteChannel(User* user, const char* text, ...);
/** Write to a channel, from a user, using std::string for text
* @param user User whos details to prefix the line with
* @param text A printf-style format string which builds the output line without prefix
* @param ... Zero or more POD type
*/
- void WriteAllExceptSender(User* user, bool serversource, char status, char* text, ...);
+ void WriteAllExceptSender(User* user, bool serversource, char status, const char* text, ...);
/** Write to all users on a channel except a list of users, using va_args for text
* @param user User whos details to prefix the line with, and to omit from receipt of the message
* @param text A printf-style format string which builds the output line without prefix
* @param ... Zero or more POD type
*/
- void WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, char* text, ...);
+ void WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const char* text, ...);
/** Write to all users on a channel except a specific user, using std::string for text.
* Internally, this calls WriteAllExcept().
/** Initialize with a bool */
ValueItem(bool value);
/** Initialize with a char pointer */
- ValueItem(char* value);
+ ValueItem(const char* value);
/** Change value to a char pointer */
- void Set(char* value);
- /** Change value to a const char pointer */
void Set(const char* val);
/** Change value to an int */
void Set(int value);
struct InitialConfig
{
/** Tag name */
- char* tag;
+ const char* tag;
/** Value name */
- char* value;
+ const char* value;
/** Default, if not defined */
- char* default_value;
+ const char* default_value;
/** Value containers */
ValueContainerBase* val;
/** Data types */
/** Tag name */
const char* tag;
/** One or more items within tag */
- char* items[18];
+ const char* items[18];
/** One or more defaults for items within tags */
- char* items_default[18];
+ const char* items_default[18];
/** One or more data types */
int datatype[18];
/** Initialization function */
/** Check that there is only one of each configuration item
*/
- bool CheckOnce(char* tag);
+ bool CheckOnce(const char* tag);
public:
/** The last error string, or NULL
*/
- char *err;
+ const char *err;
public:
/** This constructor loads the module using dlopen()
/** Get the last error from dlopen() or dlsym().
* @return The last error string, or NULL if no error has occured.
*/
- char* LastError()
+ const char* LastError()
{
return err;
}
* @param addr The address to bind to (IP only)
* @return True if the port was bound successfully
*/
- bool BindSocket(int sockfd, int port, char* addr, bool dolisten = true);
+ bool BindSocket(int sockfd, int port, const char* addr, bool dolisten = true);
/** Adds a server name to the list of servers we've seen
* @param The servername to add
* into a char* array which can be up to
* 16 kilobytes in length.
*/
- virtual char* Read();
+ virtual const char* Read();
/**
* Returns the IP address associated with
* sent the request to. It is up to your module to know what this data is and
* how to deal with it.
*/
- char* Send();
+ const char* Send();
};
* may be able to use for pre-determined purposes (e.g. the results of an SQL query, etc).
* @param request The Request class being received
*/
- virtual char* OnRequest(Request* request);
+ virtual const char* OnRequest(Request* request);
/** Called whenever a password check is to be made. Replaces the old OldOperCompare API.
* The password field (from the config file) is in 'password' and is to be compared against
* @param text The text format string to send
* @param ... The format arguments
*/
- void ServerNoticeAll(char* text, ...);
+ void ServerNoticeAll(const char* text, ...);
/** Send a server message (PRIVMSG) to all local users
* @param text The text format string to send
* @param ... The format arguments
*/
- void ServerPrivmsgAll(char* text, ...);
+ void ServerPrivmsgAll(const char* text, ...);
/** Send text to all users with a specific set of modes
* @param modes The modes to check against, without a +, e.g. 'og'
* @param text The text format string to send
* @param ... Format arguments
*/
- void SendAll(const char* command, char* text, ...);
+ void SendAll(const char* command, const char* text, ...);
/** Compile a channel list for this user, and send it to the user 'source'
* Used internally by WHOIS
return this->GetUserCounter();
}
-void Channel::WriteChannel(User* user, char* text, ...)
+void Channel::WriteChannel(User* user, const char* text, ...)
{
char textbuffer[MAXBUF];
va_list argsPtr;
/* write formatted text from a source user to all users on a channel except
* for the sender (for privmsg etc) */
-void Channel::WriteAllExceptSender(User* user, bool serversource, char status, char* text, ...)
+void Channel::WriteAllExceptSender(User* user, bool serversource, char status, const char* text, ...)
{
char textbuffer[MAXBUF];
va_list argsPtr;
this->WriteAllExceptSender(user, serversource, status, std::string(textbuffer));
}
-void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, char* text, ...)
+void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const char* text, ...)
{
char textbuffer[MAXBUF];
va_list argsPtr;
#include "wildcard.h"
#include "commands/cmd_modules.h"
-char* itab[] = {
+const char* itab[] = {
"OnUserConnect", "OnUserQuit", "OnUserDisconnect", "OnUserJoin", "OnUserPart", "OnRehash", "OnServerRaw",
"OnUserPreJoin", "OnUserPreKick", "OnUserKick", "OnOper", "OnInfo", "OnWhois", "OnUserPreInvite",
"OnUserInvite", "OnUserPreMessage", "OnUserPreNotice", "OnUserPreNick", "OnUserMessage", "OnUserNotice", "OnMode",
#include "wildcard.h"
#include "commands/cmd_who.h"
-static char *get_first_visible_channel(User *u)
+static const char *get_first_visible_channel(User *u)
{
UCListIter i = u->chans.begin();
if (i != u->chans.end())
user->WriteServ("005 %s %s", user->nick, line->c_str());
}
-bool ServerConfig::CheckOnce(char* tag)
+bool ServerConfig::CheckOnce(const char* tag)
{
int count = ConfValueEnum(this->config_data, tag);
errstr.clear();
/* These tags MUST occur and must ONLY occur once in the config file */
- static char* Once[] = { "server", "admin", "files", "power", "options", NULL };
+ static const char* Once[] = { "server", "admin", "files", "power", "options", NULL };
/* These tags can occur ONCE or not at all */
InitialConfig Values[] = {
v = n.str();
}
-ValueItem::ValueItem(char* value)
-{
- v = value;
-}
-
-void ValueItem::Set(char* value)
+ValueItem::ValueItem(const char* value)
{
v = value;
}
return this->IP;
}
-char* BufferedSocket::Read()
+const char* BufferedSocket::Read()
{
if (!Instance->SE->BoundsCheckFd(this))
return NULL;
return this->dest;
}
-char* Request::Send()
+const char* Request::Send()
{
if (this->dest)
{
int Module::OnChangeLocalUserGECOS(User*, const std::string&) { return 0; }
int Module::OnLocalTopicChange(User*, Channel*, const std::string&) { return 0; }
void Module::OnEvent(Event*) { return; }
-char* Module::OnRequest(Request*) { return NULL; }
+const char* Module::OnRequest(Request*) { return NULL; }
int Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { return 0; }
void Module::OnGlobalOper(User*) { }
void Module::OnPostConnect(User*) { }
ServerInstance->Log(DEBUG,"module not found, load it!!");
}
- char* OnRequest(Request* req)
+ virtual const char* OnRequest(Request* req)
{
HTTPClientResponse* resp = (HTTPClientResponse*)req;
if(!strcmp(resp->GetId(), HTTP_CLIENT_RESPONSE))
return ++currid;
}
- char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLREQID, request->GetId()) == 0)
{
ServerInstance->Timers->AddTimer(retimer);
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLREQID, request->GetId()) == 0)
{
}
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLRESID, request->GetId()) == 0)
{
ReadConf();
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLREQID, request->GetId()) == 0)
{
ReadConfig();
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLRESID, request->GetId()) == 0)
{
}
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if (strcmp(SQLRESID, request->GetId()) == 0)
{
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLUTILAU, request->GetId()) == 0)
{
output.append(" SSL=" + sslports);
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
ISHRequest* ISR = (ISHRequest*)request;
if (strcmp("IS_NAME", request->GetId()) == 0)
}
else if (strcmp("IS_HOOK", request->GetId()) == 0)
{
- char* ret = "OK";
+ const char* ret = "OK";
try
{
- ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? "OK" : NULL;
}
catch (ModuleException &e)
{
}
else if (strcmp("IS_UNHOOK", request->GetId()) == 0)
{
- return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? "OK" : NULL;
}
else if (strcmp("IS_HSDONE", request->GetId()) == 0)
{
if (ISR->Sock->GetFd() < 0)
- return (char*)"OK";
+ return "OK";
issl_session* session = &sessions[ISR->Sock->GetFd()];
- return (session->status == ISSL_HANDSHAKING_READ || session->status == ISSL_HANDSHAKING_WRITE) ? NULL : (char*)"OK";
+ return (session->status == ISSL_HANDSHAKING_READ || session->status == ISSL_HANDSHAKING_WRITE) ? NULL : "OK";
}
else if (strcmp("IS_ATTACH", request->GetId()) == 0)
{
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
ISHRequest* ISR = (ISHRequest*)request;
if (strcmp("IS_NAME", request->GetId()) == 0)
}
else if (strcmp("IS_HOOK", request->GetId()) == 0)
{
- char* ret = "OK";
+ const char* ret = "OK";
try
{
- ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? "OK" : NULL;
}
catch (ModuleException &e)
{
}
else if (strcmp("IS_UNHOOK", request->GetId()) == 0)
{
- return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? "OK" : NULL;
}
else if (strcmp("IS_HSDONE", request->GetId()) == 0)
{
if (ISR->Sock->GetFd() < 0)
- return (char*)"OK";
+ return "OK";
issl_session* session = &sessions[ISR->Sock->GetFd()];
- return (session->status == ISSL_HANDSHAKING) ? NULL : (char*)"OK";
+ return (session->status == ISSL_HANDSHAKING) ? NULL : "OK";
}
else if (strcmp("IS_ATTACH", request->GetId()) == 0)
{
}
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLRESID, request->GetId()) == 0)
{
/* Handle BufferedSocketHook API requests */
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
ISHRequest* ISR = (ISHRequest*)request;
if (strcmp("IS_NAME", request->GetId()) == 0)
be->DoRehash();
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
ListModeRequest* LM = (ListModeRequest*)request;
if (strcmp("LM_CHECKLIST", request->GetId()) == 0)
}
- char* OnRequest(Request *req)
+ virtual const char* OnRequest(Request *req)
{
HTTPClientRequest *httpreq = (HTTPClientRequest *)req;
if (!strcmp(httpreq->GetId(), HTTP_CLIENT_REQUEST))
bool HTTPSocket::OnDataReady()
{
Instance->Log(DEBUG,"HTTPSocket::OnDataReady() for %s", url.url.c_str());
- char *sdata = this->Read();
+ const char *sdata = this->Read();
if (!sdata)
return false;
virtual bool OnDataReady()
{
- char* data = this->Read();
+ const char* data = this->Read();
/* Check that the data read is a valid pointer and it has some content */
if (!data || !*data)
ServerInstance->Modules->Attach(eventlist, this, 1);
}
- char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
claimed = true;
HTTPDocument* doc = (HTTPDocument*)request->GetData();
this->changed = true;
}
- char* OnRequest(Request* request)
+ const char* OnRequest(Request* request)
{
return NULL;
}
return 0;
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
ListModeRequest* LM = (ListModeRequest*)request;
if (strcmp("LM_CHECKLIST", request->GetId()) == 0)
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
HashRequest* MD5 = (HashRequest*)request;
int rlen;
bool done;
public:
- ProxySocket(InspIRCd *Server, User* u, const std::string &bindip, int port, char *cstr, int mclen, char *rstr, int mrlen)
+ ProxySocket(InspIRCd *Server, User* u, const std::string &bindip, int port, const char *cstr, int mclen, const char *rstr, int mrlen)
{
user = u;
ServerInstance = Server;
}
- virtual char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
HashRequest* SHA = (HashRequest*)request;
if (strcmp("KEY", request->GetId()) == 0)
*/
bool TreeSocket::OnDataReady()
{
- char* data = this->Read();
+ const char* data = this->Read();
/* Check that the data read is a valid pointer and it has some content */
if (data && *data)
{
* It can only bind to IP addresses, if you wish to bind to hostnames
* you should first resolve them using class 'Resolver'.
*/
-bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten)
+bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten)
{
/* We allocate 2 of these, because sockaddr_in6 is larger than sockaddr (ugh, hax) */
sockaddr* servaddr = new sockaddr[2];
int ret, size;
if (*addr == '*')
- *addr = 0;
+ addr = "";
#ifdef IPV6
if (*addr)
return (this->local_users.size() - this->UnregisteredUserCount());
}
-void UserManager::ServerNoticeAll(char* text, ...)
+void UserManager::ServerNoticeAll(const char* text, ...)
{
if (!text)
return;
}
}
-void UserManager::ServerPrivmsgAll(char* text, ...)
+void UserManager::ServerPrivmsgAll(const char* text, ...)
{
if (!text)
return;
return true;
}
-void User::SendAll(const char* command, char* text, ...)
+void User::SendAll(const char* command, const char* text, ...)
{
char textbuffer[MAXBUF];
char formatbuffer[MAXBUF];