diff options
| author | Adam <Adam@anope.org> | 2010-08-27 13:44:30 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-08-27 13:44:30 -0400 |
| commit | 73fb94c55344b6ad788c925bf13325236402891f (patch) | |
| tree | 48ac3308448b8494074d8e6c326adf75ddbacdc0 /modules/protocol | |
| parent | ea9b945830166ff237799460aba6236e4132a075 (diff) | |
Added an Anope::string::is_pos_number_only function to use everywhere we convertTo unsigned values, and
fixed the mail delay error message to give the correct time.
Diffstat (limited to 'modules/protocol')
| -rw-r--r-- | modules/protocol/bahamut.cpp | 8 | ||||
| -rw-r--r-- | modules/protocol/inspircd11.cpp | 10 | ||||
| -rw-r--r-- | modules/protocol/inspircd12.cpp | 8 | ||||
| -rw-r--r-- | modules/protocol/inspircd20.cpp | 12 | ||||
| -rw-r--r-- | modules/protocol/ratbox.cpp | 14 | ||||
| -rw-r--r-- | modules/protocol/unreal32.cpp | 14 |
6 files changed, 33 insertions, 33 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 9c3e107a4..5ac8ff065 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -307,7 +307,7 @@ class BahamutIRCdProto : public IRCDProto int anope_event_sjoin(const Anope::string &source, int ac, const char **av) { Channel *c = findchan(av[1]); - time_t ts = Anope::string(av[0]).is_number_only() ? convertTo<time_t>(av[0]) : 0; + time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0; bool keep_their_modes = false; if (!c) @@ -456,7 +456,7 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) if (ac != 2) { - user = do_nick(source, av[0], av[4], av[5], av[6], av[9], Anope::string(av[2]).is_number_only() ? convertTo<time_t>(av[2]) : 0, Anope::string(av[8]).is_number_only() ? convertTo<uint32>(av[8]) : 0, "", ""); + user = do_nick(source, av[0], av[4], av[5], av[6], av[9], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, Anope::string(av[8]).is_pos_number_only() ? convertTo<uint32>(av[8]) : 0, "", ""); if (user) { UserSetInternalModes(user, 1, &av[3]); @@ -472,7 +472,7 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) } } else - do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0, 0, "", ""); + do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0, 0, "", ""); return MOD_CONT; } @@ -540,7 +540,7 @@ int anope_event_436(const Anope::string &source, int ac, const char **av) /* EVENT : SERVER */ int anope_event_server(const Anope::string &source, int ac, const char **av) { - do_server(source, av[0], Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); + do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); return MOD_CONT; } diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index cc2c99fa6..453be6965 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -372,7 +372,7 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av) /* Checking the TS for validity to avoid desyncs */ if ((c = findchan(av[0]))) { - time_t ts = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; if (c->creation_time > ts) /* Our TS is bigger, we should lower it */ c->creation_time = ts; @@ -403,7 +403,7 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av) int anope_event_fjoin(const Anope::string &source, int ac, const char **av) { Channel *c = findchan(av[0]); - time_t ts = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; bool keep_their_modes = true; if (!c) @@ -717,7 +717,7 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) { if (ac == 8) { - time_t ts = Anope::string(av[0]).is_number_only() ? convertTo<time_t>(av[0]) : 0; + time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0; user = do_nick("", av[1], av[4], av[2], source, av[7], ts, 0, av[3], ""); if (user) @@ -766,7 +766,7 @@ int anope_event_chghost(const Anope::string &source, int ac, const char **av) /* EVENT: SERVER */ int anope_event_server(const Anope::string &source, int ac, const char **av) { - do_server(source, av[0], Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); + do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); return MOD_CONT; } @@ -983,7 +983,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av) else if (capab.find("MAXMODES=") != std::string::npos) { Anope::string maxmodes(capab.begin() + 9, capab.end()); - ircd->maxmodes = maxmodes.is_number_only() ? convertTo<unsigned>(maxmodes) : 3; + ircd->maxmodes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; } } } diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 55a371700..987590034 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -397,7 +397,7 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av) /* Checking the TS for validity to avoid desyncs */ if ((c = findchan(av[0]))) { - time_t ts = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; if (c->creation_time > ts) /* Our TS is bigger, we should lower it */ c->creation_time = ts; @@ -436,7 +436,7 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av) int anope_event_fjoin(const Anope::string &source, int ac, const char **av) { Channel *c = findchan(av[0]); - time_t ts = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; bool keep_their_modes = true; if (!c) @@ -809,7 +809,7 @@ int anope_event_chghost(const Anope::string &source, int ac, const char **av) */ int anope_event_server(const Anope::string &source, int ac, const char **av) { - do_server(source, av[0], Anope::string(av[2]).is_number_only() ? convertTo<unsigned>(av[2]) : 0, av[4], av[3]); + do_server(source, av[0], Anope::string(av[2]).is_pos_number_only() ? convertTo<unsigned>(av[2]) : 0, av[4], av[3]); return MOD_CONT; } @@ -1144,7 +1144,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av) else if (capab.find("MAXMODES=") != Anope::string::npos) { Anope::string maxmodes(capab.begin() + 9, capab.end()); - ircd->maxmodes = maxmodes.is_number_only() ? convertTo<unsigned>(maxmodes) : 3; + ircd->maxmodes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; } } } diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 8a8748d49..54c30d8df 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -395,7 +395,7 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av) /* Checking the TS for validity to avoid desyncs */ if ((c = findchan(av[0]))) { - time_t ts = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; if (c->creation_time > ts) /* Our TS is bigger, we should lower it */ c->creation_time = ts; @@ -434,7 +434,7 @@ int anope_event_fmode(const Anope::string &source, int ac, const char **av) int anope_event_fjoin(const Anope::string &source, int ac, const char **av) { Channel *c = findchan(av[0]); - time_t ts = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; bool keep_their_modes = true; if (!c) @@ -750,7 +750,7 @@ int anope_event_uid(const Anope::string &source, int ac, const char **av) User *user; NickAlias *na; Server *s = Server::Find(source); - time_t ts = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; /* Check if the previously introduced user was Id'd for the nickgroup of the nick he s currently using. * If not, validate the user. ~ Viper*/ @@ -806,7 +806,7 @@ int anope_event_chghost(const Anope::string &source, int ac, const char **av) */ int anope_event_server(const Anope::string &source, int ac, const char **av) { - do_server(source, av[0], Anope::string(av[2]).is_number_only() ? convertTo<unsigned>(av[2]) : 0, av[4], av[3]); + do_server(source, av[0], Anope::string(av[2]).is_pos_number_only() ? convertTo<unsigned>(av[2]) : 0, av[4], av[3]); return MOD_CONT; } @@ -852,7 +852,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av) { if (!strcasecmp(av[0], "START")) { - if (ac < 2 || (Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]): 0) < 1202) + if (ac < 2 || (Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]): 0) < 1202) { send_cmd("", "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START"); quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START"; @@ -1124,7 +1124,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av) else if (capab.find("MAXMODES=") != Anope::string::npos) { Anope::string maxmodes(capab.begin() + 9, capab.end()); - ircd->maxmodes = maxmodes.is_number_only() ? convertTo<unsigned>(maxmodes) : 3; + ircd->maxmodes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; } } } diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index a26ee9598..dc039682e 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -285,7 +285,7 @@ class RatboxProto : public IRCDTS6Proto int anope_event_sjoin(const Anope::string &source, int ac, const char **av) { Channel *c = findchan(av[1]); - time_t ts = Anope::string(av[0]).is_number_only() ? convertTo<time_t>(av[0]) : 0; + time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0; bool keep_their_modes = true; if (!c) @@ -410,7 +410,7 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) { Server *s = Server::Find(source); /* Source is always the server */ - user = do_nick("", av[0], av[4], av[5], s->GetName(), av[8], Anope::string(av[2]).is_number_only() ? convertTo<time_t>(av[2]) : 0, 0, "*", av[7]); + user = do_nick("", av[0], av[4], av[5], s->GetName(), av[8], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, 0, "*", av[7]); if (user) { UserSetInternalModes(user, 1, &av[3]); @@ -426,7 +426,7 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) } } else if (ac == 2) - do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0, 0, "", ""); + do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0, 0, "", ""); return MOD_CONT; } @@ -483,7 +483,7 @@ int anope_event_tburst(const Anope::string &source, int ac, const char **av) Anope::string setter = myStrGetToken(av[2], '!', 0); c = findchan(av[0]); - topic_time = Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0; + topic_time = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; if (!c) { @@ -606,9 +606,9 @@ int anope_event_whois(const Anope::string &source, int ac, const char **av) int anope_event_server(const Anope::string &source, int ac, const char **av) { if (!stricmp(av[1], "1")) - do_server(source, av[0], Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], TS6UPLINK); + do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], TS6UPLINK); else - do_server(source, av[0], Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); + do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); return MOD_CONT; } @@ -617,7 +617,7 @@ int anope_event_sid(const Anope::string &source, int ac, const char **av) /* :42X SID trystan.nomadirc.net 2 43X :ircd-ratbox test server */ Server *s = Server::Find(source); - do_server(s->GetName(), av[0], Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]) : 0, av[3], av[2]); + do_server(s->GetName(), av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[3], av[2]); return MOD_CONT; } diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp index ff04e87eb..cb1949cb7 100644 --- a/modules/protocol/unreal32.cpp +++ b/modules/protocol/unreal32.cpp @@ -865,11 +865,11 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) <codemastr> it's sent when a nick collision occurs - so we have to leave it around for now -TSL */ - do_nick(source, av[0], av[3], av[4], av[5], av[6], Anope::string(av[2]).is_number_only() ? convertTo<time_t>(av[2]) : 0, 0, "*", ""); + do_nick(source, av[0], av[3], av[4], av[5], av[6], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, 0, "*", ""); } else if (ac == 11) { - user = do_nick(source, av[0], av[3], av[4], av[5], av[10], Anope::string(av[2]).is_number_only() ? convertTo<time_t>(av[2]) : 0, ntohl(decode_ip(av[9])), av[8], ""); + user = do_nick(source, av[0], av[3], av[4], av[5], av[10], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, ntohl(decode_ip(av[9])), av[8], ""); if (user) { UserSetInternalModes(user, 1, &av[7]); @@ -888,7 +888,7 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) else { /* NON NICKIP */ - user = do_nick(source, av[0], av[3], av[4], av[5], av[9], Anope::string(av[2]).is_number_only() ? convertTo<time_t>(av[2]) : 0, 0, av[8], ""); + user = do_nick(source, av[0], av[3], av[4], av[5], av[9], Anope::string(av[2]).is_pos_number_only() ? convertTo<time_t>(av[2]) : 0, 0, av[8], ""); if (user) { UserSetInternalModes(user, 1, &av[7]); @@ -906,7 +906,7 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) } } else - do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_number_only() ? convertTo<time_t>(av[1]) : 0, 0, "", ""); + do_nick(source, av[0], "", "", "", "", Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0, 0, "", ""); return MOD_CONT; } @@ -936,10 +936,10 @@ int anope_event_server(const Anope::string &source, int ac, const char **av) Anope::string vl = myStrGetToken(av[2], ' ', 0); Anope::string upnumeric = myStrGetToken(vl, '-', 2); Anope::string desc = myStrGetTokenRemainder(av[2], ' ', 1); - do_server(source, av[0], Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]) : 0, desc, upnumeric); + do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, desc, upnumeric); } else - do_server(source, av[0], Anope::string(av[1]).is_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); + do_server(source, av[0], Anope::string(av[1]).is_pos_number_only() ? convertTo<unsigned>(av[1]) : 0, av[2], ""); ircdproto->SendPing(Config->ServerName, av[0]); return MOD_CONT; @@ -992,7 +992,7 @@ int anope_event_sdesc(const Anope::string &source, int ac, const char **av) int anope_event_sjoin(const Anope::string &source, int ac, const char **av) { Channel *c = findchan(av[1]); - time_t ts = Anope::string(av[0]).is_number_only() ? convertTo<time_t>(av[0]) : 0; + time_t ts = Anope::string(av[0]).is_pos_number_only() ? convertTo<time_t>(av[0]) : 0; bool keep_their_modes = true; if (!c) |
