diff options
Diffstat (limited to 'src/protocol')
| -rw-r--r-- | src/protocol/bahamut.c | 73 | ||||
| -rw-r--r-- | src/protocol/inspircd11.c | 66 | ||||
| -rw-r--r-- | src/protocol/inspircd12.cpp | 73 | ||||
| -rw-r--r-- | src/protocol/ratbox.c | 60 | ||||
| -rw-r--r-- | src/protocol/unreal32.c | 70 |
5 files changed, 146 insertions, 196 deletions
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index d60641378..288b36329 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -167,16 +167,16 @@ class BahamutIRCdProto : public IRCDProto } /* SVSMODE -b */ - void SendBanDel(const char *name, const char *nick) + void SendBanDel(Channel *c, const char *nick) { - SendSVSModeChan(name, "-b", nick); + SendSVSModeChan(c, "-b", nick); } /* SVSMODE channel modes */ - void SendSVSModeChan(const char *name, const char *mode, const char *nick) + void SendSVSModeChan(Channel *c, const char *mode, const char *nick) { - if (nick) send_cmd(Config.ServerName, "SVSMODE %s %s %s", name, mode, nick); - else send_cmd(Config.ServerName, "SVSMODE %s %s", name, mode); + if (nick) send_cmd(Config.ServerName, "SVSMODE %s %s %s", c->name, mode, nick); + else send_cmd(Config.ServerName, "SVSMODE %s %s", c->name, mode); } /* SQLINE */ @@ -187,27 +187,27 @@ class BahamutIRCdProto : public IRCDProto } /* UNSGLINE */ - void SendSGLineDel(const char *mask) + void SendSGLineDel(SXLine *sx) { - send_cmd(NULL, "UNSGLINE 0 :%s", mask); + send_cmd(NULL, "UNSGLINE 0 :%s", sx->mask); } /* UNSZLINE */ - void SendSZLineDel(const char *mask) + void SendSZLineDel(SXLine *sx) { /* this will likely fail so its only here for legacy */ - send_cmd(NULL, "UNSZLINE 0 %s", mask); + send_cmd(NULL, "UNSZLINE 0 %s", sx->mask); /* this is how we are supposed to deal with it */ - send_cmd(NULL, "RAKILL %s *", mask); + send_cmd(NULL, "RAKILL %s *", sx->mask); } /* SZLINE */ - void SendSZLine(const char *mask, const char *reason, const char *whom) + void SendSZLine(SXLine *sx) { /* this will likely fail so its only here for legacy */ - send_cmd(NULL, "SZLINE %s :%s", mask, reason); + send_cmd(NULL, "SZLINE %s :%s", sx->mask, sx->reason); /* this is how we are supposed to deal with it */ - send_cmd(NULL, "AKILL %s * %d %s %ld :%s", mask, 172800, whom, static_cast<long>(time(NULL)), reason); + send_cmd(NULL, "AKILL %s * %d %s %ld :%s", sx->mask, 172800, sx->by, static_cast<long>(time(NULL)), sx->reason); } /* SVSNOOP */ @@ -217,21 +217,21 @@ class BahamutIRCdProto : public IRCDProto } /* SGLINE */ - void SendSGLine(const char *mask, const char *reason) + void SendSGLine(SXLine *sx) { - send_cmd(NULL, "SGLINE %d :%s:%s", static_cast<int>(strlen(mask)), mask, reason); + send_cmd(NULL, "SGLINE %d :%s:%s", static_cast<int>(strlen(sx->mask)), sx->mask, sx->reason); } /* RAKILL */ - void SendAkillDel(const char *user, const char *host) + void SendAkillDel(Akill *ak) { - send_cmd(NULL, "RAKILL %s %s", host, user); + send_cmd(NULL, "RAKILL %s %s", ak->host, ak->user); } /* TOPIC */ - void SendTopic(BotInfo *whosets, const char *chan, const char *whosetit, const char *topic, time_t when) + void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->nick, "TOPIC %s %s %lu :%s", chan, whosetit, static_cast<unsigned long>(when), topic); + send_cmd(whosets->nick, "TOPIC %s %s %lu :%s", c->name, whosetit, static_cast<unsigned long>(c->topic_time), topic); } /* UNSQLINE */ @@ -246,35 +246,20 @@ class BahamutIRCdProto : public IRCDProto send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(chantime), channel); } - /* AKILL - * parv[1]=host - * parv[2]=user - * parv[3]=length - * parv[4]=akiller - * parv[5]=time set - * parv[6]=reason - */ - void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) + void SendAkill(Akill *ak) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = expires - time(NULL); + time_t timeleft = ak->expires - time(NULL); if (timeleft > 172800) timeleft = 172800; - send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, static_cast<int>(timeleft), who, static_cast<long>(time(NULL)), reason); + send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", ak->host, ak->user, static_cast<int>(timeleft), ak->by, static_cast<long>(time(NULL)), ak->reason); } - /* SVSKILL */ - /* parv[0] = servername - * parv[1] = client - * parv[2] = nick stamp - * parv[3] = kill message - */ /* Note: if the stamp is null 0, the below usage is correct of Bahamut */ - void SendSVSKillInternal(const char *source, const char *user, const char *buf) + void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - if (!source || !user || !buf) return; - send_cmd(source, "SVSKILL %s :%s", user, buf); + send_cmd(source ? source->nick : NULL, "SVSKILL %s :%s", user->nick, buf); } /* SVSMODE */ @@ -294,16 +279,16 @@ class BahamutIRCdProto : public IRCDProto send_cmd(NULL, "BURST 0"); } - void SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) + void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); + send_cmd(NULL, "NOTICE @%s :%s", dest->name, buf); } - void SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) + void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { - if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan, user, buf); - else send_cmd(source->nick, "KICK %s %s", chan, user); + if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, buf); + else send_cmd(source->nick, "KICK %s %s", chan->name, user->nick); } void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid) diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index b6c24bf18..84aa044de 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -129,14 +129,14 @@ static int has_hidechansmod = 0; /* CHGHOST */ void inspircd_cmd_chghost(const char *nick, const char *vhost) { - if (has_chghostmod == 1) { - if (!nick || !vhost) { - return; - } - send_cmd(Config.s_OperServ, "CHGHOST %s %s", nick, vhost); - } else { - ircdproto->SendGlobops(Config.s_OperServ, "CHGHOST not loaded!"); + if (has_chghostmod == 1) + { + if (!nick || !vhost) + return; + send_cmd(Config.s_OperServ, "CHGHOST %s %s", nick, vhost); } + else + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST not loaded!"); } int anope_event_idle(const char *source, int ac, const char **av) @@ -158,14 +158,14 @@ void inspircd_cmd_pass(const char *pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(const char *user, const char *host) + void SendAkillDel(Akill *ak) { - send_cmd(Config.s_OperServ, "GLINE %s@%s", user, host); + send_cmd(Config.s_OperServ, "GLINE %s@%s", ak->user, ak->host); } - void SendTopic(BotInfo *whosets, const char *chan, const char *whosetit, const char *topic, time_t when) + void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->nick, "FTOPIC %s %lu %s :%s", chan, static_cast<unsigned long>(when), whosetit, topic); + send_cmd(whosets->nick, "FTOPIC %s %lu %s :%s", c->name, static_cast<unsigned long>(c->topic_time), whosetit, topic); } void SendVhostDel(User *u) @@ -181,19 +181,18 @@ class InspIRCdProto : public IRCDProto } } - void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) + void SendAkill(Akill *ak) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = expires - time(NULL); + time_t timeleft = ak->expires - time(NULL); if (timeleft > 172800) timeleft = 172800; - send_cmd(Config.ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who, static_cast<long>(time(NULL)), static_cast<long>(timeleft), reason); + send_cmd(Config.ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL)), static_cast<long>(timeleft), ak->reason); } - void SendSVSKillInternal(const char *source, const char *user, const char *buf) + void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - if (!buf || !source || !user) return; - send_cmd(source, "KILL %s :%s", user, buf); + send_cmd(source ? source->nick : Config.ServerName, "KILL %s :%s", user->nick, buf); } void SendSVSMode(User *u, int ac, const char **av) @@ -230,16 +229,16 @@ class InspIRCdProto : public IRCDProto send_cmd(nick, "OPERTYPE Service"); } - void SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) + void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { - if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan, user, buf); - else send_cmd(source->nick, "KICK %s %s :%s", chan, user, user); + if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, buf); + else send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, user->nick); } - void SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) + void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(Config.ServerName, "NOTICE @%s :%s", dest, buf); + send_cmd(Config.ServerName, "NOTICE @%s :%s", dest->name, buf); } /* SERVER services-dev.chatspike.net password 0 :Description here */ @@ -277,11 +276,10 @@ class InspIRCdProto : public IRCDProto /* Functions that use serval cmd functions */ - void SendVhost(const char *nick, const char *vIdent, const char *vhost) + void SendVhost(User *u, const char *vIdent, const char *vhost) { - if (!nick) return; - if (vIdent) inspircd_cmd_chgident(nick, vIdent); - inspircd_cmd_chghost(nick, vhost); + if (vIdent) inspircd_cmd_chgident(u->nick, vIdent); + inspircd_cmd_chghost(u->nick, vhost); } void SendConnect() @@ -302,7 +300,7 @@ class InspIRCdProto : public IRCDProto } send_cmd(Config.s_OperServ, "CHGIDENT %s %s", nick, vIdent); } else { - ircdproto->SendGlobops(Config.s_OperServ, "CHGIDENT not loaded!"); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT not loaded!"); } } @@ -319,15 +317,15 @@ class InspIRCdProto : public IRCDProto } /* UNSZLINE */ - void SendSZLineDel(const char *mask) + void SendSZLineDel(SXLine *sx) { - send_cmd(Config.s_OperServ, "ZLINE %s", mask); + send_cmd(Config.s_OperServ, "ZLINE %s", sx->mask); } /* SZLINE */ - void SendSZLine(const char *mask, const char *reason, const char *whom) + void SendSZLine(SXLine *sx) { - send_cmd(Config.ServerName, "ADDLINE Z %s %s %ld 0 :%s", mask, whom, static_cast<long>(time(NULL)), reason); + send_cmd(Config.ServerName, "ADDLINE Z %s %s %ld 0 :%s", sx->mask, sx->by, static_cast<long>(time(NULL)), sx->reason); } /* SVSMODE +- */ @@ -905,13 +903,13 @@ int anope_event_capab(const char *source, int ac, const char **av) return MOD_STOP; } if (!has_svsholdmod) { - ircdproto->SendGlobops(Config.s_OperServ, "SVSHOLD missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "SVSHOLD missing, Usage disabled until module is loaded."); } if (!has_chghostmod) { - ircdproto->SendGlobops(Config.s_OperServ, "CHGHOST missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST missing, Usage disabled until module is loaded."); } if (!has_chgidentmod) { - ircdproto->SendGlobops(Config.s_OperServ, "CHGIDENT missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT missing, Usage disabled until module is loaded."); } if (has_messagefloodmod) { ModeManager::AddChannelMode('f', new ChannelModeFlood()); diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp index 30d64f7fa..2b232fe81 100644 --- a/src/protocol/inspircd12.cpp +++ b/src/protocol/inspircd12.cpp @@ -134,7 +134,7 @@ void inspircd_cmd_chghost(const char *nick, const char *vhost) { if (has_chghostmod != 1) { - ircdproto->SendGlobops(Config.s_OperServ, "CHGHOST not loaded!"); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST not loaded!"); return; } @@ -163,15 +163,15 @@ void inspircd_cmd_pass(const char *pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(const char *user, const char *host) + void SendAkillDel(Akill *ak) { BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi->uid, "GLINE %s@%s", user, host); + send_cmd(bi->uid, "GLINE %s@%s", ak->user, ak->host); } - void SendTopic(BotInfo *whosets, const char *chan, const char *whosetit, const char *topic, time_t when) + void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->uid, "FTOPIC %s %lu %s :%s", chan, static_cast<unsigned long>(when), whosetit, topic); + send_cmd(whosets->uid, "FTOPIC %s %lu %s :%s", c->name, static_cast<unsigned long>(c->topic_time), whosetit, topic); } void SendVhostDel(User *u) @@ -187,21 +187,19 @@ class InspIRCdProto : public IRCDProto } } - void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) + void SendAkill(Akill *ak) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = expires - time(NULL); - if (timeleft > 172800 || !expires) + time_t timeleft = ak->expires - time(NULL); + if (timeleft > 172800 || !ak->expires) timeleft = 172800; BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi->uid, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who, static_cast<long>(time(NULL)), static_cast<long>(timeleft), reason); + send_cmd(bi->uid, "ADDLINE G %s@%s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL)), static_cast<long>(timeleft), ak->reason); } - void SendSVSKillInternal(const char *source, const char *user, const char *buf) + void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - BotInfo *bi = findbot(source); - User *u = finduser(user); - send_cmd(bi ? bi->uid : TS6SID, "KILL %s :%s", u ? u->GetUID().c_str(): user, buf); + send_cmd(source ? source->uid : TS6SID, "KILL %s :%s", user->GetUID().c_str(), buf); } void SendSVSMode(User *u, int ac, const char **av) @@ -236,18 +234,17 @@ class InspIRCdProto : public IRCDProto send_cmd(TS6SID, "UID %s %ld %s %s %s %s 0.0.0.0 %ld %s :%s", uid, static_cast<long>(time(NULL)), nick, host, host, user, static_cast<long>(time(NULL)), modes, real); } - void SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) + void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { - User *u = finduser(user); if (buf) - send_cmd(source->uid, "KICK %s %s :%s", chan, u->GetUID().c_str(), buf); + send_cmd(source->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), buf); else - send_cmd(source->uid, "KICK %s %s :%s", chan, u->GetUID().c_str(), user); + send_cmd(source->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), user->nick); } - void SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) + void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { - send_cmd(TS6SID, "NOTICE @%s :%s", dest, buf); + send_cmd(TS6SID, "NOTICE @%s :%s", dest->name, buf); } /* SERVER services-dev.chatspike.net password 0 :Description here */ @@ -282,11 +279,11 @@ class InspIRCdProto : public IRCDProto /* Functions that use serval cmd functions */ - void SendVhost(const char *nick, const char *vIdent, const char *vhost) + void SendVhost(User *u, const char *vIdent, const char *vhost) { if (vIdent) - inspircd_cmd_chgident(nick, vIdent); - inspircd_cmd_chghost(nick, vhost); + inspircd_cmd_chgident(u->nick, vIdent); + inspircd_cmd_chghost(u->nick, vhost); } void SendConnect() @@ -303,7 +300,7 @@ class InspIRCdProto : public IRCDProto { if (has_chgidentmod == 0) { - ircdproto->SendGlobops(Config.s_OperServ, "CHGIDENT not loaded!"); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT not loaded!"); } else { @@ -327,15 +324,15 @@ class InspIRCdProto : public IRCDProto } /* UNSZLINE */ - void SendSZLineDel(const char *mask) + void SendSZLineDel(SXLine *sx) { - send_cmd(TS6SID, "DELLINE Z %s", mask); + send_cmd(TS6SID, "DELLINE Z %s", sx->mask); } /* SZLINE */ - void SendSZLine(const char *mask, const char *reason, const char *whom) + void SendSZLine(SXLine *sx) { - send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", mask, whom, static_cast<long>(time(NULL)), reason); + send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", sx->mask, sx->by, static_cast<long>(time(NULL)), sx->reason); } /* SVSMODE -r */ @@ -370,16 +367,12 @@ class InspIRCdProto : public IRCDProto send_cmd(TS6SID, "ENDBURST"); } - void SendGlobopsInternal(const char *source, const char *buf) + void SendGlobopsInternal(BotInfo *source, const char *buf) { - BotInfo *bi = findbot(source); - if (bi) - { - if (has_globopsmod) - send_cmd(ircd->ts6 ? bi->uid : bi->nick, "SNONOTICE g :%s", buf); - else - send_cmd(ircd->ts6 ? bi->uid : bi->nick, "SNONOTICE A :%s", buf); - } + if (has_globopsmod) + send_cmd(source ? source->uid : TS6SID, "SNONOTICE g :%s", buf); + else + send_cmd(source ? source->uid : TS6SID, "SNONOTICE A :%s", buf); } void SendAccountLogin(User *u, NickCore *account) @@ -1079,18 +1072,18 @@ int anope_event_capab(const char *source, int ac, const char **av) } if (!has_hidechansmod) { send_cmd(NULL, "ERROR :m_hidechans.so is not loaded. This is required by Anope"); - quitmsg = "ERROR: Remote server deos not have the m_hidechans module loaded, and this is required."; + quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required."; quitting = 1; return MOD_STOP; } if (!has_svsholdmod) { - ircdproto->SendGlobops(Config.s_OperServ, "SVSHOLD missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "SVSHOLD missing, Usage disabled until module is loaded."); } if (!has_chghostmod) { - ircdproto->SendGlobops(Config.s_OperServ, "CHGHOST missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST missing, Usage disabled until module is loaded."); } if (!has_chgidentmod) { - ircdproto->SendGlobops(Config.s_OperServ, "CHGIDENT missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT missing, Usage disabled until module is loaded."); } if (has_messagefloodmod) { ModeManager::AddChannelMode('f', new ChannelModeFlood()); diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 249f8b685..3996bf736 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -165,18 +165,12 @@ void ratbox_cmd_pass(const char *pass) class RatboxProto : public IRCDTS6Proto { - void SendGlobopsInternal(const char *source, const char *buf) + void SendGlobopsInternal(BotInfo *source, const char *buf) { if (source) - { - BotInfo *bi = findbot(source); - if (bi) - { - send_cmd(bi->uid, "OPERWALL :%s", buf); - return; - } - } - send_cmd(TS6SID, "OPERWALL :%s", buf); + send_cmd(source->uid, "OPERWALL :%s", buf); + else + send_cmd(TS6SID, "OPERWALL :%s", buf); } void SendSQLine(const char *mask, const char *reason) @@ -184,22 +178,22 @@ class RatboxProto : public IRCDTS6Proto send_cmd(TS6SID, "RESV * %s :%s", mask, reason); } - void SendSGLineDel(const char *mask) + void SendSGLineDel(SXLine *sx) { BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi ? bi->uid : Config.s_OperServ, "UNXLINE * %s", mask); + send_cmd(bi ? bi->uid : Config.s_OperServ, "UNXLINE * %s", sx->mask); } - void SendSGLine(const char *mask, const char *reason) + void SendSGLine(SXLine *sx) { BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi ? bi->uid : Config.s_OperServ, "XLINE * %s 0 :%s", mask, reason); + send_cmd(bi ? bi->uid : Config.s_OperServ, "XLINE * %s 0 :%s", sx->mask, sx->reason); } - void SendAkillDel(const char *user, const char *host) + void SendAkillDel(Akill *ak) { BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi ? bi->uid : Config.s_OperServ, "UNKLINE * %s %s", user, host); + send_cmd(bi ? bi->uid : Config.s_OperServ, "UNKLINE * %s %s", ak->user, ak->host); } void SendSQLineDel(const char *user) @@ -212,26 +206,15 @@ class RatboxProto : public IRCDTS6Proto send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, user->uid.c_str()); } - /* - oper: the nick of the oper performing the kline - target.server: the server(s) this kline is destined for - duration: the duration if a tkline, 0 if permanent. - user: the 'user' portion of the kline - host: the 'host' portion of the kline - reason: the reason for the kline. - */ - - void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) + void SendAkill(Akill *ak) { BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi ? bi->uid : Config.s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(expires - time(NULL)), user, host, reason); + send_cmd(bi ? bi->uid : Config.s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(ak->expires - time(NULL)), ak->user, ak->host, ak->reason); } - void SendSVSKillInternal(const char *source, const char *user, const char *buf) + void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - BotInfo *bi = findbot(source); - User *u = find_byuid(user); - send_cmd(bi ? bi->uid : source, "KILL %s :%s", u ? u->GetUID().c_str(): user, buf); + send_cmd(source ? source->uid : TS6SID, "KILL %s :%s", user->GetUID().c_str(), buf); } void SendSVSMode(User *u, int ac, const char **av) @@ -291,16 +274,15 @@ class RatboxProto : public IRCDTS6Proto send_cmd(TS6SID, "SVSMODE %s %s", u->nick, buf); } - void SendKickInternal(BotInfo *bi, const char *chan, const char *user, const char *buf) + void SendKickInternal(BotInfo *bi, Channel *chan, User *user, const char *buf) { - User *u = finduser(user); - if (buf) send_cmd(bi->uid, "KICK %s %s :%s", chan, u ? u->GetUID().c_str() : user, buf); - else send_cmd(bi->uid, "KICK %s %s", chan, u ? u->GetUID().c_str() : user); + if (buf) send_cmd(bi->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), buf); + else send_cmd(bi->uid, "KICK %s %s", chan->name, user->GetUID().c_str()); } - void SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) + void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); + send_cmd(NULL, "NOTICE @%s :%s", dest->name, buf); } /* QUIT */ @@ -334,9 +316,9 @@ class RatboxProto : public IRCDTS6Proto return 1; } - void SendTopic(BotInfo *bi, const char *chan, const char *whosetit, const char *topic, time_t when) + void SendTopic(BotInfo *bi, Channel *c, const char *whosetit, const char *topic) { - send_cmd(bi->uid, "TOPIC %s :%s", chan, topic); + send_cmd(bi->uid, "TOPIC %s :%s", c->name, topic); } void SetAutoIdentificationToken(User *u) diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index 35eedfbb0..a859582b2 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -174,14 +174,14 @@ class UnrealIRCdProto : public IRCDProto send_cmd(NULL, "f %s %s", server, set ? "+" : "-"); } - void SendAkillDel(const char *user, const char *host) + void SendAkillDel(Akill *ak) { - send_cmd(NULL, "BD - G %s %s %s", user, host, Config.s_OperServ); + send_cmd(NULL, "BD - G %s %s %s", ak->user, ak->host, Config.s_OperServ); } - void SendTopic(BotInfo *whosets, const char *chan, const char *whosetit, const char *topic, time_t when) + void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) { - send_cmd(whosets->nick, ") %s %s %lu :%s", chan, whosetit, static_cast<unsigned long>(when), topic); + send_cmd(whosets->nick, ") %s %s %lu :%s", c->name, whosetit, static_cast<unsigned long>(c->topic_time), topic); } void SendVhostDel(User *u) @@ -191,24 +191,17 @@ class UnrealIRCdProto : public IRCDProto u->SetMode(UMODE_CLOAK); } - void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) + void SendAkill(Akill *ak) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = expires - time(NULL); + time_t timeleft = ak->expires - time(NULL); if (timeleft > 172800) timeleft = 172800; - send_cmd(NULL, "BD + G %s %s %s %ld %ld :%s", user, host, who, static_cast<long>(time(NULL) + timeleft), static_cast<long>(when), reason); + send_cmd(NULL, "BD + G %s %s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL) + timeleft), static_cast<long>(ak->expires), ak->reason); } - /* - ** svskill - ** parv[0] = servername - ** parv[1] = client - ** parv[2] = kill message - */ - void SendSVSKillInternal(const char *source, const char *user, const char *buf) + void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) { - if (!source || !user || !buf) return; - send_cmd(source, "h %s :%s", user, buf); + send_cmd(source ? source->nick : Config.ServerName, "h %s :%s", user->nick, buf); } /* @@ -246,16 +239,16 @@ class UnrealIRCdProto : public IRCDProto SendSQLine(nick, "Reserved for services"); } - void SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) + void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf) { - if (buf) send_cmd(source->nick, "H %s %s :%s", chan, user, buf); - else send_cmd(source->nick, "H %s %s", chan, user); + if (buf) send_cmd(source->nick, "H %s %s :%s", chan->name, user->nick, buf); + else send_cmd(source->nick, "H %s %s", chan->name, user->nick); } - void SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) + void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf) { if (!buf) return; - send_cmd(source->nick, "B @%s :%s", dest, buf); + send_cmd(source->nick, "B @%s :%s", dest->name, buf); } /* SERVER name hop descript */ @@ -321,11 +314,10 @@ class UnrealIRCdProto : public IRCDProto /* Functions that use serval cmd functions */ - void SendVhost(const char *nick, const char *vIdent, const char *vhost) + void SendVhost(User *u, const char *vIdent, const char *vhost) { - if (!nick) return; - if (vIdent) unreal_cmd_chgident(nick, vIdent); - unreal_cmd_chghost(nick, vhost); + if (vIdent) unreal_cmd_chgident(u->nick, vIdent); + unreal_cmd_chghost(u->nick, vhost); } void SendConnect() @@ -356,48 +348,48 @@ class UnrealIRCdProto : public IRCDProto /* * SVSNLINE - :realname mask */ - void SendSGLineDel(const char *mask) + void SendSGLineDel(SXLine *sx) { - send_cmd(NULL, "BR - :%s", mask); + send_cmd(NULL, "BR - :%s", sx->mask); } /* UNSZLINE */ - void SendSZLineDel(const char *mask) + void SendSZLineDel(SXLine *sx) { - send_cmd(NULL, "BD - Z * %s %s", mask, Config.s_OperServ); + send_cmd(NULL, "BD - Z * %s %s", sx->mask, Config.s_OperServ); } /* SZLINE */ - void SendSZLine(const char *mask, const char *reason, const char *whom) + void SendSZLine(SXLine *sx) { - send_cmd(NULL, "BD + Z * %s %s %ld %ld :%s", mask, whom, static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), reason); + send_cmd(NULL, "BD + Z * %s %s %ld %ld :%s", sx->mask, sx->by, static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), sx->reason); } /* SGLINE */ /* * SVSNLINE + reason_where_is_space :realname mask with spaces */ - void SendSGLine(const char *mask, const char *reason) + void SendSGLine(SXLine *sx) { char edited_reason[BUFSIZE]; - strlcpy(edited_reason, reason, BUFSIZE); + strlcpy(edited_reason, sx->reason, BUFSIZE); strnrepl(edited_reason, BUFSIZE, " ", "_"); - send_cmd(NULL, "BR + %s :%s", edited_reason, mask); + send_cmd(NULL, "BR + %s :%s", edited_reason, sx->mask); } /* SVSMODE -b */ - void SendBanDel(const char *name, const char *nick) + void SendBanDel(Channel *c, const char *nick) { - SendSVSModeChan(name, "-b", nick); + SendSVSModeChan(c, "-b", nick); } /* SVSMODE channel modes */ - void SendSVSModeChan(const char *name, const char *mode, const char *nick) + void SendSVSModeChan(Channel *c, const char *mode, const char *nick) { - if (nick) send_cmd(Config.ServerName, "n %s %s %s", name, mode, nick); - else send_cmd(Config.ServerName, "n %s %s", name, mode); + if (nick) send_cmd(Config.ServerName, "n %s %s %s", c->name, mode, nick); + else send_cmd(Config.ServerName, "n %s %s", c->name, mode); } /* svsjoin |
