summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp18
-rw-r--r--src/modules.cpp56
-rw-r--r--src/xline.cpp24
3 files changed, 77 insertions, 21 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index bd2c57983..94635e609 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -2362,7 +2362,7 @@ void handle_hash(char token,char* params,serverrec* source,serverrec* reply, cha
char* create_time = strtok(NULL," ");
char* duration = strtok(NULL," :");
char* reason = strtok(NULL,"\r\n");
- add_gline(atoi(duration),who,reason,mask);
+ add_gline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask);
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
gline_set_creation_time(mask,atoi(create_time));
@@ -2384,7 +2384,7 @@ void handle_dot(char token,char* params,serverrec* source,serverrec* reply, char
char* who = strtok(NULL," ");
if (mask)
{
- if (del_gline(mask))
+ if (del_gline((const char*)mask))
{
if (who)
{
@@ -2403,7 +2403,7 @@ void handle_add_sqline(char token,char* params,serverrec* source,serverrec* repl
char* create_time = strtok(NULL," ");
char* duration = strtok(NULL," :");
char* reason = strtok(NULL,"\r\n");
- add_qline(atoi(duration),who,reason,mask);
+ add_qline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask);
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
qline_set_creation_time(mask,atoi(create_time));
@@ -2426,7 +2426,7 @@ void handle_del_sqline(char token,char* params,serverrec* source,serverrec* repl
char* who = strtok(NULL," ");
if (mask)
{
- if (del_qline(mask))
+ if (del_qline((const char*)mask))
{
if (who)
{
@@ -2445,7 +2445,7 @@ void handle_add_szline(char token,char* params,serverrec* source,serverrec* repl
char* create_time = strtok(NULL," ");
char* duration = strtok(NULL," :");
char* reason = strtok(NULL,"\r\n");
- add_zline(atoi(duration),who,reason,mask);
+ add_zline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask);
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
zline_set_creation_time(mask,atoi(create_time));
@@ -2468,7 +2468,7 @@ void handle_del_szline(char token,char* params,serverrec* source,serverrec* repl
char* who = strtok(NULL," ");
if (mask)
{
- if (del_zline(mask))
+ if (del_zline((const char*)mask))
{
if (who)
{
@@ -3150,14 +3150,14 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv)
}
}
-long duration(char* str)
+long duration(const char* str)
{
char n_field[MAXBUF];
long total = 0;
- char* str_end = str + strlen(str);
+ const char* str_end = str + strlen(str);
n_field[0] = 0;
- for (char* i = str; i < str_end; i++)
+ for (char* i = (char*)str; i < str_end; i++)
{
// if we have digits, build up a string for the value in n_field,
// up to 10 digits in size.
diff --git a/src/modules.cpp b/src/modules.cpp
index 1fa2300c8..5d75ea20d 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -615,6 +615,62 @@ bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
}
+void Server::AddGLine(long duration, std::string source, std::string reason, std::string hostmask)
+{
+ add_gline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
+}
+
+void Server::AddQLine(long duration, std::string source, std::string reason, std::string nickname)
+{
+ add_qline(duration, source.c_str(), reason.c_str(), nickname.c_str());
+}
+
+void Server::AddZLine(long duration, std::string source, std::string reason, std::string ipaddr)
+{
+ add_zline(duration, source.c_str(), reason.c_str(), ipaddr.c_str());
+}
+
+void Server::AddKLine(long duration, std::string source, std::string reason, std::string hostmask)
+{
+ add_kline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
+}
+
+void Server::AddELine(long duration, std::string source, std::string reason, std::string hostmask)
+{
+ add_eline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
+}
+
+bool Server::DelGLine(std::string hostmask)
+{
+ del_gline(hostmask.c_str());
+}
+
+bool Server::DelQLine(std::string nickname)
+{
+ del_qline(nickname.c_str());
+}
+
+bool Server::DelZLine(std::string ipaddr)
+{
+ del_zline(ipaddr.c_str());
+}
+
+bool Server::DelKLine(std::string hostmask)
+{
+ del_kline(hostmask.c_str());
+}
+
+bool Server::DelELine(std::string hostmask)
+{
+ del_eline(hostmask.c_str());
+}
+
+long Server::CalcDuration(std::string delta)
+{
+ return duration(delta.c_str());
+}
+
+
ConfigReader::ConfigReader()
{
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);
diff --git a/src/xline.cpp b/src/xline.cpp
index 443d28087..716153b0c 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -235,7 +235,7 @@ void read_xline_defaults()
// adds a g:line
-void add_gline(long duration, char* source, char* reason, char* hostmask)
+void add_gline(long duration, const char* source,const char* reason,const char* hostmask)
{
del_gline(hostmask);
GLine item;
@@ -250,7 +250,7 @@ void add_gline(long duration, char* source, char* reason, char* hostmask)
// adds an e:line (exception to bans)
-void add_eline(long duration, char* source, char* reason, char* hostmask)
+void add_eline(long duration, const char* source, const char* reason, const char* hostmask)
{
del_eline(hostmask);
ELine item;
@@ -265,7 +265,7 @@ void add_eline(long duration, char* source, char* reason, char* hostmask)
// adds a q:line
-void add_qline(long duration, char* source, char* reason, char* nickname)
+void add_qline(long duration, const char* source, const char* reason, const char* nickname)
{
del_qline(nickname);
QLine item;
@@ -281,7 +281,7 @@ void add_qline(long duration, char* source, char* reason, char* nickname)
// adds a z:line
-void add_zline(long duration, char* source, char* reason, char* ipaddr)
+void add_zline(long duration, const char* source, const char* reason, const char* ipaddr)
{
del_zline(ipaddr);
ZLine item;
@@ -297,7 +297,7 @@ void add_zline(long duration, char* source, char* reason, char* ipaddr)
// adds a k:line
-void add_kline(long duration, char* source, char* reason, char* hostmask)
+void add_kline(long duration, const char* source, const char* reason, const char* hostmask)
{
del_kline(hostmask);
KLine item;
@@ -312,7 +312,7 @@ void add_kline(long duration, char* source, char* reason, char* hostmask)
// deletes a g:line, returns true if the line existed and was removed
-bool del_gline(char* hostmask)
+bool del_gline(const char* hostmask)
{
for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
{
@@ -327,7 +327,7 @@ bool del_gline(char* hostmask)
// deletes a e:line, returns true if the line existed and was removed
-bool del_eline(char* hostmask)
+bool del_eline(const char* hostmask)
{
for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++)
{
@@ -342,7 +342,7 @@ bool del_eline(char* hostmask)
// deletes a q:line, returns true if the line existed and was removed
-bool del_qline(char* nickname)
+bool del_qline(const char* nickname)
{
for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
{
@@ -355,7 +355,7 @@ bool del_qline(char* nickname)
return false;
}
-bool qline_make_global(char* nickname)
+bool qline_make_global(const char* nickname)
{
for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
{
@@ -368,7 +368,7 @@ bool qline_make_global(char* nickname)
return false;
}
-bool zline_make_global(char* ipaddr)
+bool zline_make_global(const char* ipaddr)
{
for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
{
@@ -413,7 +413,7 @@ void sync_xlines(serverrec* serv, char* tcp_host)
// deletes a z:line, returns true if the line existed and was removed
-bool del_zline(char* ipaddr)
+bool del_zline(const char* ipaddr)
{
for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
{
@@ -428,7 +428,7 @@ bool del_zline(char* ipaddr)
// deletes a k:line, returns true if the line existed and was removed
-bool del_kline(char* hostmask)
+bool del_kline(const char* hostmask)
{
for (std::vector<KLine>::iterator i = klines.begin(); i != klines.end(); i++)
{