From c32c3c99a1e1d395c88e901de200c21b9ca1e84f Mon Sep 17 00:00:00 2001 From: "Robin Burchell w00t@inspircd.org" Date: Tue, 30 Sep 2008 18:45:10 +0000 Subject: Made all protocol modules able to be compiled via mostly constifying strings. Due to the above, also had to constify strings in many other areas. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1202 5417fbe8-f217-4b02-8779-1006273d7864 --- src/protocol/inspircd11.c | 253 ++++++++++++++++++++++------------------------ 1 file changed, 123 insertions(+), 130 deletions(-) (limited to 'src/protocol/inspircd11.c') diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index ea272697c..32a87608a 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -393,10 +393,10 @@ static int has_messagefloodmod = 0; static int has_banexceptionmod = 0; static int has_inviteexceptionmod = 0; -void inspircd_set_umode(User * user, int ac, char **av) +void inspircd_set_umode(User * user, int ac, const char **av) { int add = 1; /* 1 if adding modes, 0 if deleting */ - char *modes = av[0]; + const char *modes = av[0]; ac--; @@ -523,19 +523,19 @@ void moduleAddIRCDMsgs(void) { /* *INDENT-ON* */ -void inspircd_cmd_svsadmin(char *server, int set) +void inspircd_cmd_svsadmin(const char *server, int set) { /* Not Supported by this IRCD */ } -void InspIRCd::cmd_remove_akill(const char *user, const char *host) +void InspIRCdProto::cmd_remove_akill(const char *user, const char *host) { send_cmd(s_OperServ, "GLINE %s@%s", user, host); } void -inspircd_cmd_topic(char *whosets, char *chan, char *whosetit, - char *topic, time_t when) +inspircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) { send_cmd(whosets, "FTOPIC %s %lu %s :%s", chan, (unsigned long int) when, whosetit, topic); @@ -547,14 +547,14 @@ void inspircd_cmd_vhost_off(User * u) } void -inspircd_cmd_akill(char *user, char *host, char *who, time_t when, - time_t expires, char *reason) +inspircd_cmd_akill(const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) { send_cmd(ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who, (long int) when, (long int) 86400 * 2, reason); } -void inspircd_cmd_svskill(char *source, char *user, char *buf) +void inspircd_cmd_svskill(const char *source, const char *user, const char *buf) { if (!buf || !source || !user) return; @@ -562,7 +562,7 @@ void inspircd_cmd_svskill(char *source, char *user, char *buf) send_cmd(source, "KILL %s :%s", user, buf); } -void inspircd_cmd_svsmode(User * u, int ac, char **av) +void inspircd_cmd_svsmode(User * u, int ac, const char **av) { /* This was originally done using this: send_cmd(s_NickServ, "MODE %s %s%s%s", u->nick, av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); @@ -572,29 +572,29 @@ void inspircd_cmd_svsmode(User * u, int ac, char **av) } -void inspircd_cmd_372(char *source, char *msg) +void inspircd_cmd_372(const char *source, const char *msg) { send_cmd(ServerName, "372 %s :- %s", source, msg); } -void inspircd_cmd_372_error(char *source) +void inspircd_cmd_372_error(const char *source) { send_cmd(ServerName, "422 %s :- MOTD file not found! Please " "contact your IRC administrator.", source); } -void inspircd_cmd_375(char *source) +void inspircd_cmd_375(const char *source) { send_cmd(ServerName, "375 %s :- %s Message of the Day", source, ServerName); } -void inspircd_cmd_376(char *source) +void inspircd_cmd_376(const char *source) { send_cmd(ServerName, "376 %s :End of /MOTD command.", source); } -void inspircd_cmd_nick(char *nick, char *name, char *modes) +void inspircd_cmd_nick(const char *nick, const char *name, const char *modes) { /* :test.chatspike.net NICK 1133519355 Brain synapse.brainbox.winbot.co.uk netadmin.chatspike.net ~brain +xwsioS 10.0.0.2 :Craig Edwards */ send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s", @@ -605,14 +605,14 @@ void inspircd_cmd_nick(char *nick, char *name, char *modes) } void -inspircd_cmd_guest_nick(char *nick, char *user, char *host, - char *real, char *modes) +inspircd_cmd_guest_nick(const char *nick, const char *user, const char *host, + const char *real, const char *modes) { send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s", (long int) time(NULL), nick, host, host, user, modes, real); } -void inspircd_cmd_mode(char *source, char *dest, char *buf) +void inspircd_cmd_mode(const char *source, const char *dest, const char *buf) { Channel *c; if (!buf) { @@ -623,12 +623,12 @@ void inspircd_cmd_mode(char *source, char *dest, char *buf) send_cmd(source ? source : s_OperServ, "FMODE %s %u %s", dest, (unsigned int)((c) ? c->creation_time : time(NULL)), buf); } -int anope_event_version(char *source, int ac, char **av) +int anope_event_version(const char *source, int ac, const char **av) { return MOD_CONT; } -int anope_event_idle(char *source, int ac, char **av) +int anope_event_idle(const char *source, int ac, const char **av) { if (ac == 1) { send_cmd(av[0], "IDLE %s %ld 0", source, (long int) time(NULL)); @@ -636,10 +636,10 @@ int anope_event_idle(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_ftopic(char *source, int ac, char **av) +int anope_event_ftopic(const char *source, int ac, const char **av) { /* :source FTOPIC channel ts setby :topic */ - char *temp; + const char *temp; if (ac < 4) return MOD_CONT; temp = av[1]; /* temp now holds ts */ @@ -649,14 +649,14 @@ int anope_event_ftopic(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_opertype(char *source, int ac, char **av) +int anope_event_opertype(const char *source, int ac, const char **av) { /* opertype is equivalent to mode +o because servers dont do this directly */ User *u; u = finduser(source); if (u && !is_oper(u)) { - char *newav[2]; + const char *newav[2]; newav[0] = source; newav[1] = "+o"; return anope_event_mode(source, 2, newav); @@ -664,9 +664,9 @@ int anope_event_opertype(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_fmode(char *source, int ac, char **av) +int anope_event_fmode(const char *source, int ac, const char **av) { - char *newav[25]; + const char *newav[25]; int n, o; Channel *c; @@ -703,9 +703,9 @@ int anope_event_fmode(char *source, int ac, char **av) return anope_event_mode(source, ac - 1, newav); } -int anope_event_fjoin(char *source, int ac, char **av) +int anope_event_fjoin(const char *source, int ac, const char **av) { - char *newav[10]; + const char *newav[10]; /* value used for myStrGetToken */ int curtoken = 0; @@ -763,15 +763,15 @@ int anope_event_fjoin(char *source, int ac, char **av) } void -inspircd_cmd_bot_nick(char *nick, char *user, char *host, char *real, - char *modes) +inspircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) { send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s", (long int) time(NULL), nick, host, host, user, modes, real); send_cmd(nick, "OPERTYPE Bot"); } -void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf) +void inspircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) { if (buf) { send_cmd(source, "KICK %s %s :%s", chan, user, buf); @@ -780,7 +780,7 @@ void inspircd_cmd_kick(char *source, char *chan, char *user, char *buf) } } -void inspircd_cmd_notice_ops(char *source, char *dest, char *buf) +void inspircd_cmd_notice_ops(const char *source, const char *dest, const char *buf) { if (!buf) { return; @@ -790,7 +790,7 @@ void inspircd_cmd_notice_ops(char *source, char *dest, char *buf) } -void inspircd_cmd_notice(char *source, char *dest, char *buf) +void inspircd_cmd_notice(const char *source, const char *dest, const char *buf) { if (!buf) { return; @@ -803,12 +803,12 @@ void inspircd_cmd_notice(char *source, char *dest, char *buf) } } -void inspircd_cmd_notice2(char *source, char *dest, char *msg) +void inspircd_cmd_notice2(const char *source, const char *dest, const char *msg) { send_cmd(source, "NOTICE %s :%s", dest, msg); } -void inspircd_cmd_privmsg(char *source, char *dest, char *buf) +void inspircd_cmd_privmsg(const char *source, const char *dest, const char *buf) { if (!buf) { return; @@ -817,28 +817,28 @@ void inspircd_cmd_privmsg(char *source, char *dest, char *buf) send_cmd(source, "PRIVMSG %s :%s", dest, buf); } -void inspircd_cmd_privmsg2(char *source, char *dest, char *msg) +void inspircd_cmd_privmsg2(const char *source, const char *dest, const char *msg) { send_cmd(source, "PRIVMSG %s :%s", dest, msg); } -void inspircd_cmd_serv_notice(char *source, char *dest, char *msg) +void inspircd_cmd_serv_notice(const char *source, const char *dest, const char *msg) { send_cmd(source, "NOTICE $%s :%s", dest, msg); } -void inspircd_cmd_serv_privmsg(char *source, char *dest, char *msg) +void inspircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) { send_cmd(source, "PRIVMSG $%s :%s", dest, msg); } -void inspircd_cmd_bot_chan_mode(char *nick, char *chan) +void inspircd_cmd_bot_chan_mode(const char *nick, const char *chan) { anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); } -void inspircd_cmd_351(char *source) +void inspircd_cmd_351(const char *source) { send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", source, version_number, ServerName, ircd->name, version_flags, @@ -846,7 +846,7 @@ void inspircd_cmd_351(char *source) } /* QUIT */ -void inspircd_cmd_quit(char *source, char *buf) +void inspircd_cmd_quit(const char *source, const char *buf) { if (buf) { send_cmd(source, "QUIT :%s", buf); @@ -863,32 +863,32 @@ void inspircd_cmd_protoctl() static char currentpass[1024]; /* PASS */ -void inspircd_cmd_pass(char *pass) +void inspircd_cmd_pass(const char *pass) { strncpy(currentpass, pass, 1024); } /* SERVER services-dev.chatspike.net password 0 :Description here */ -void inspircd_cmd_server(char *servname, int hop, char *descript) +void inspircd_cmd_server(const char *servname, int hop, const char *descript) { send_cmd(ServerName, "SERVER %s %s %d :%s", servname, currentpass, hop, descript); } /* PONG */ -void inspircd_cmd_pong(char *servname, char *who) +void inspircd_cmd_pong(const char *servname, const char *who) { send_cmd(servname, "PONG %s", who); } /* JOIN */ -void inspircd_cmd_join(char *user, char *channel, time_t chantime) +void inspircd_cmd_join(const char *user, const char *channel, time_t chantime) { send_cmd(user, "JOIN %s", channel); } /* UNSQLINE */ -void inspircd_cmd_unsqline(char *user) +void inspircd_cmd_unsqline(const char *user) { if (!user) { return; @@ -897,7 +897,7 @@ void inspircd_cmd_unsqline(char *user) } /* CHGHOST */ -void inspircd_cmd_chghost(char *nick, char *vhost) +void inspircd_cmd_chghost(const char *nick, const char *vhost) { if (has_chghostmod == 1) { if (!nick || !vhost) { @@ -910,7 +910,7 @@ void inspircd_cmd_chghost(char *nick, char *vhost) } /* CHGIDENT */ -void inspircd_cmd_chgident(char *nick, char *vIdent) +void inspircd_cmd_chgident(const char *nick, const char *vIdent) { if (has_chgidentmod == 1) { if (!nick || !vIdent || !*vIdent) { @@ -923,7 +923,7 @@ void inspircd_cmd_chgident(char *nick, char *vIdent) } /* INVITE */ -void inspircd_cmd_invite(char *source, char *chan, char *nick) +void inspircd_cmd_invite(const char *source, const char *chan, const char *nick) { if (!source || !chan || !nick) { return; @@ -933,7 +933,7 @@ void inspircd_cmd_invite(char *source, char *chan, char *nick) } /* PART */ -void inspircd_cmd_part(char *nick, char *chan, char *buf) +void inspircd_cmd_part(const char *nick, const char *chan, const char *buf) { if (!nick || !chan) { return; @@ -947,7 +947,7 @@ void inspircd_cmd_part(char *nick, char *chan, char *buf) } /* 391 */ -void inspircd_cmd_391(char *source, char *timestr) +void inspircd_cmd_391(const char *source, const char *timestr) { if (!timestr) { return; @@ -956,7 +956,7 @@ void inspircd_cmd_391(char *source, char *timestr) } /* 250 */ -void inspircd_cmd_250(char *buf) +void inspircd_cmd_250(const char *buf) { if (!buf) { return; @@ -966,7 +966,7 @@ void inspircd_cmd_250(char *buf) } /* 307 */ -void inspircd_cmd_307(char *buf) +void inspircd_cmd_307(const char *buf) { if (!buf) { return; @@ -976,7 +976,7 @@ void inspircd_cmd_307(char *buf) } /* 311 */ -void inspircd_cmd_311(char *buf) +void inspircd_cmd_311(const char *buf) { if (!buf) { return; @@ -986,7 +986,7 @@ void inspircd_cmd_311(char *buf) } /* 312 */ -void inspircd_cmd_312(char *buf) +void inspircd_cmd_312(const char *buf) { if (!buf) { return; @@ -996,7 +996,7 @@ void inspircd_cmd_312(char *buf) } /* 317 */ -void inspircd_cmd_317(char *buf) +void inspircd_cmd_317(const char *buf) { if (!buf) { return; @@ -1006,7 +1006,7 @@ void inspircd_cmd_317(char *buf) } /* 219 */ -void inspircd_cmd_219(char *source, char *letter) +void inspircd_cmd_219(const char *source, const char *letter) { if (!source) { return; @@ -1021,7 +1021,7 @@ void inspircd_cmd_219(char *source, char *letter) } /* 401 */ -void inspircd_cmd_401(char *source, char *who) +void inspircd_cmd_401(const char *source, const char *who) { if (!source || !who) { return; @@ -1030,7 +1030,7 @@ void inspircd_cmd_401(char *source, char *who) } /* 318 */ -void inspircd_cmd_318(char *source, char *who) +void inspircd_cmd_318(const char *source, const char *who) { if (!source || !who) { return; @@ -1040,7 +1040,7 @@ void inspircd_cmd_318(char *source, char *who) } /* 242 */ -void inspircd_cmd_242(char *buf) +void inspircd_cmd_242(const char *buf) { if (!buf) { return; @@ -1050,7 +1050,7 @@ void inspircd_cmd_242(char *buf) } /* 243 */ -void inspircd_cmd_243(char *buf) +void inspircd_cmd_243(const char *buf) { if (!buf) { return; @@ -1060,7 +1060,7 @@ void inspircd_cmd_243(char *buf) } /* 211 */ -void inspircd_cmd_211(char *buf) +void inspircd_cmd_211(const char *buf) { if (!buf) { return; @@ -1070,7 +1070,7 @@ void inspircd_cmd_211(char *buf) } /* GLOBOPS */ -void inspircd_cmd_global(char *source, char *buf) +void inspircd_cmd_global(const char *source, const char *buf) { if (!buf) { return; @@ -1080,7 +1080,7 @@ void inspircd_cmd_global(char *source, char *buf) } /* SQLINE */ -void inspircd_cmd_sqline(char *mask, char *reason) +void inspircd_cmd_sqline(const char *mask, const char *reason) { if (!mask || !reason) { return; @@ -1091,7 +1091,7 @@ void inspircd_cmd_sqline(char *mask, char *reason) } /* SQUIT */ -void inspircd_cmd_squit(char *servname, char *message) +void inspircd_cmd_squit(const char *servname, const char *message) { if (!servname || !message) { return; @@ -1101,12 +1101,12 @@ void inspircd_cmd_squit(char *servname, char *message) } /* SVSO */ -void inspircd_cmd_svso(char *source, char *nick, char *flag) +void inspircd_cmd_svso(const char *source, const char *nick, const char *flag) { } /* NICK */ -void inspircd_cmd_chg_nick(char *oldnick, char *newnick) +void inspircd_cmd_chg_nick(const char *oldnick, const char *newnick) { if (!oldnick || !newnick) { return; @@ -1116,7 +1116,7 @@ void inspircd_cmd_chg_nick(char *oldnick, char *newnick) } /* SVSNICK */ -void inspircd_cmd_svsnick(char *source, char *guest, time_t when) +void inspircd_cmd_svsnick(const char *source, const char *guest, time_t when) { if (!source || !guest) { return; @@ -1128,7 +1128,7 @@ void inspircd_cmd_svsnick(char *source, char *guest, time_t when) /* Functions that use serval cmd functions */ -void inspircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost) +void inspircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) { if (!nick) { return; @@ -1162,7 +1162,7 @@ void inspircd_cmd_connect(int servernum) /* Events */ -int anope_event_ping(char *source, int ac, char **av) +int anope_event_ping(const char *source, int ac, const char **av) { if (ac < 1) return MOD_CONT; @@ -1171,7 +1171,7 @@ int anope_event_ping(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_436(char *source, int ac, char **av) +int anope_event_436(const char *source, int ac, const char **av) { if (ac < 1) return MOD_CONT; @@ -1180,7 +1180,7 @@ int anope_event_436(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_away(char *source, int ac, char **av) +int anope_event_away(const char *source, int ac, const char **av) { if (!source) { return MOD_CONT; @@ -1191,7 +1191,7 @@ int anope_event_away(char *source, int ac, char **av) /* Taken from hybrid.c, topic syntax is identical */ -int anope_event_topic(char *source, int ac, char **av) +int anope_event_topic(const char *source, int ac, const char **av) { Channel *c = findchan(av[0]); time_t topic_time = time(NULL); @@ -1227,7 +1227,7 @@ int anope_event_topic(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_squit(char *source, int ac, char **av) +int anope_event_squit(const char *source, int ac, const char **av) { if (ac != 2) return MOD_CONT; @@ -1235,7 +1235,7 @@ int anope_event_squit(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_rsquit(char *source, int ac, char **av) +int anope_event_rsquit(const char *source, int ac, const char **av) { if (ac < 1 || ac > 3) return MOD_CONT; @@ -1249,7 +1249,7 @@ int anope_event_rsquit(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_quit(char *source, int ac, char **av) +int anope_event_quit(const char *source, int ac, const char **av) { if (ac != 1) return MOD_CONT; @@ -1258,7 +1258,7 @@ int anope_event_quit(char *source, int ac, char **av) } -int anope_event_mode(char *source, int ac, char **av) +int anope_event_mode(const char *source, int ac, const char **av) { if (ac < 2) return MOD_CONT; @@ -1280,7 +1280,7 @@ int anope_event_mode(char *source, int ac, char **av) } -int anope_event_kill(char *source, int ac, char **av) +int anope_event_kill(const char *source, int ac, const char **av) { if (ac != 2) return MOD_CONT; @@ -1289,7 +1289,7 @@ int anope_event_kill(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_kick(char *source, int ac, char **av) +int anope_event_kick(const char *source, int ac, const char **av) { if (ac != 3) return MOD_CONT; @@ -1298,7 +1298,7 @@ int anope_event_kick(char *source, int ac, char **av) } -int anope_event_join(char *source, int ac, char **av) +int anope_event_join(const char *source, int ac, const char **av) { if (ac != 2) return MOD_CONT; @@ -1306,7 +1306,7 @@ int anope_event_join(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_motd(char *source, int ac, char **av) +int anope_event_motd(const char *source, int ac, const char **av) { if (!source) { return MOD_CONT; @@ -1316,7 +1316,7 @@ int anope_event_motd(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_setname(char *source, int ac, char **av) +int anope_event_setname(const char *source, int ac, const char **av) { User *u; @@ -1331,11 +1331,11 @@ int anope_event_setname(char *source, int ac, char **av) return MOD_CONT; } - change_user_realname(u, av[0]); + u->SetRealname(av[0]); return MOD_CONT; } -int anope_event_chgname(char *source, int ac, char **av) +int anope_event_chgname(const char *source, int ac, const char **av) { User *u; @@ -1350,11 +1350,11 @@ int anope_event_chgname(char *source, int ac, char **av) return MOD_CONT; } - change_user_realname(u, av[0]); + u->SetRealname(av[0]); return MOD_CONT; } -int anope_event_setident(char *source, int ac, char **av) +int anope_event_setident(const char *source, int ac, const char **av) { User *u; @@ -1369,11 +1369,11 @@ int anope_event_setident(char *source, int ac, char **av) return MOD_CONT; } - change_user_username(u, av[0]); + u->SetIdent(av[0]); return MOD_CONT; } -int anope_event_chgident(char *source, int ac, char **av) +int anope_event_chgident(const char *source, int ac, const char **av) { User *u; @@ -1388,11 +1388,11 @@ int anope_event_chgident(char *source, int ac, char **av) return MOD_CONT; } - change_user_username(u, av[1]); + u->SetIdent(av[1]); return MOD_CONT; } -int anope_event_sethost(char *source, int ac, char **av) +int anope_event_sethost(const char *source, int ac, const char **av) { User *u; @@ -1407,12 +1407,12 @@ int anope_event_sethost(char *source, int ac, char **av) return MOD_CONT; } - change_user_host(u, av[0]); + u->SetDisplayedHost(av[0]); return MOD_CONT; } -int anope_event_nick(char *source, int ac, char **av) +int anope_event_nick(const char *source, int ac, const char **av) { User *user; struct in_addr addy; @@ -1444,7 +1444,7 @@ int anope_event_nick(char *source, int ac, char **av) } -int anope_event_chghost(char *source, int ac, char **av) +int anope_event_chghost(const char *source, int ac, const char **av) { User *u; @@ -1459,12 +1459,12 @@ int anope_event_chghost(char *source, int ac, char **av) return MOD_CONT; } - change_user_host(u, av[0]); + u->SetDisplayedHost(av[0]); return MOD_CONT; } /* EVENT: SERVER */ -int anope_event_server(char *source, int ac, char **av) +int anope_event_server(const char *source, int ac, const char **av) { if (!stricmp(av[1], "1")) { uplink = sstrdup(av[0]); @@ -1474,7 +1474,7 @@ int anope_event_server(char *source, int ac, char **av) } -int anope_event_privmsg(char *source, int ac, char **av) +int anope_event_privmsg(const char *source, int ac, const char **av) { if (ac != 2) return MOD_CONT; @@ -1482,7 +1482,7 @@ int anope_event_privmsg(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_part(char *source, int ac, char **av) +int anope_event_part(const char *source, int ac, const char **av) { if (ac < 1 || ac > 2) return MOD_CONT; @@ -1490,7 +1490,7 @@ int anope_event_part(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_whois(char *source, int ac, char **av) +int anope_event_whois(const char *source, int ac, const char **av) { if (source && ac >= 1) { m_whois(source, av[0]); @@ -1498,10 +1498,9 @@ int anope_event_whois(char *source, int ac, char **av) return MOD_CONT; } -int anope_event_capab(char *source, int ac, char **av) +int anope_event_capab(const char *source, int ac, const char **av) { int argc; - char **argv; CBModeInfo *cbmi; if (strcasecmp(av[0], "START") == 0) { @@ -1612,13 +1611,7 @@ int anope_event_capab(char *source, int ac, char **av) * fine. It's ugly, but it works.... */ argc = 6; - argv = scalloc(argc, sizeof(char *)); - argv[0] = "NOQUIT"; - argv[1] = "SSJ3"; - argv[2] = "NICK2"; - argv[3] = "VL"; - argv[4] = "TLKEXT"; - argv[5] = "UNCONNECT"; + const char *argv[] = {"NOQUIT", "SSJ3", "NICK2", "VL", "TLKEXT", "UNCONNECT"}; capab_parse(argc, argv); } @@ -1626,51 +1619,51 @@ int anope_event_capab(char *source, int ac, char **av) } /* SVSHOLD - set */ -void inspircd_cmd_svshold(char *nick) +void inspircd_cmd_svshold(const char *nick) { send_cmd(s_OperServ, "SVSHOLD %s %ds :%s", nick, NSReleaseTimeout, "Being held for registered user"); } /* SVSHOLD - release */ -void inspircd_cmd_release_svshold(char *nick) +void inspircd_cmd_release_svshold(const char *nick) { send_cmd(s_OperServ, "SVSHOLD %s", nick); } /* UNSGLINE */ -void inspircd_cmd_unsgline(char *mask) +void inspircd_cmd_unsgline(const char *mask) { /* Not Supported by this IRCD */ } /* UNSZLINE */ -void inspircd_cmd_unszline(char *mask) +void inspircd_cmd_unszline(const char *mask) { send_cmd(s_OperServ, "ZLINE %s", mask); } /* SZLINE */ -void inspircd_cmd_szline(char *mask, char *reason, char *whom) +void inspircd_cmd_szline(const char *mask, const char *reason, const char *whom) { send_cmd(ServerName, "ADDLINE Z %s %s %ld 0 :%s", mask, whom, (long int) time(NULL), reason); } /* SGLINE */ -void inspircd_cmd_sgline(char *mask, char *reason) +void inspircd_cmd_sgline(const char *mask, const char *reason) { /* Not Supported by this IRCD */ } -void inspircd_cmd_unban(char *name, char *nick) +void inspircd_cmd_unban(const char *name, const char *nick) { /* Not Supported by this IRCD */ } /* SVSMODE channel modes */ -void inspircd_cmd_svsmode_chan(char *name, char *mode, char *nick) +void inspircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) { /* Not Supported by this IRCD */ } @@ -1678,7 +1671,7 @@ void inspircd_cmd_svsmode_chan(char *name, char *mode, char *nick) /* SVSMODE +d */ /* sent if svid is something weird */ -void inspircd_cmd_svid_umode(char *nick, time_t ts) +void inspircd_cmd_svid_umode(const char *nick, time_t ts) { if (debug) alog("debug: common_svsmode(0)"); @@ -1694,29 +1687,29 @@ void inspircd_cmd_nc_change(User * u) } /* SVSMODE +r */ -void inspircd_cmd_svid_umode2(User * u, char *ts) +void inspircd_cmd_svid_umode2(User * u, const char *ts) { if (debug) alog("debug: common_svsmode(2)"); common_svsmode(u, "+r", NULL); } -void inspircd_cmd_svid_umode3(User * u, char *ts) +void inspircd_cmd_svid_umode3(User * u, const char *ts) { /* not used */ } -void inspircd_cmd_svsjoin(char *source, char *nick, char *chan, char *param) +void inspircd_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) { send_cmd(source, "SVSJOIN %s %s", nick, chan); } -void inspircd_cmd_svspart(char *source, char *nick, char *chan) +void inspircd_cmd_svspart(const char *source, const char *nick, const char *chan) { send_cmd(source, "SVSPART %s %s", nick, chan); } -void inspircd_cmd_swhois(char *source, char *who, char *mask) +void inspircd_cmd_swhois(const char *source, const char *who, const char *mask) { /* Not used currently */ } @@ -1727,22 +1720,22 @@ void inspircd_cmd_eob() } -int anope_event_rehash(char *source, int ac, char **av) +int anope_event_rehash(const char *source, int ac, const char **av) { return MOD_CONT; } -int anope_event_credits(char *source, int ac, char **av) +int anope_event_credits(const char *source, int ac, const char **av) { return MOD_CONT; } -int anope_event_admin(char *source, int ac, char **av) +int anope_event_admin(const char *source, int ac, const char **av) { return MOD_CONT; } -int inspircd_flood_mode_check(char *value) +int inspircd_flood_mode_check(const char *value) { char *dp, *end; @@ -1756,7 +1749,7 @@ int inspircd_flood_mode_check(char *value) } } -void inspircd_cmd_jupe(char *jserver, char *who, char *reason) +void inspircd_cmd_jupe(const char *jserver, const char *who, const char *reason) { char rbuf[256]; @@ -1770,23 +1763,23 @@ void inspircd_cmd_jupe(char *jserver, char *who, char *reason) } /* GLOBOPS - to handle old WALLOPS */ -void inspircd_cmd_global_legacy(char *source, char *fmt) +void inspircd_cmd_global_legacy(const char *source, const char *fmt) { send_cmd(source ? source : s_OperServ, "GLOBOPS :%s", fmt); } -int inspircd_valid_nick(char *nick) +int inspircd_valid_nick(const char *nick) { return 1; } -int inspircd_valid_chan(char *chan) +int inspircd_valid_chan(const char *chan) { return 1; } -void inspircd_cmd_ctcp(char *source, char *dest, char *buf) +void inspircd_cmd_ctcp(const char *source, const char *dest, const char *buf) { char *s; -- cgit