From 94d1d02c4c43ad3a77529cfef15a18a576a4d0f2 Mon Sep 17 00:00:00 2001 From: om Date: Tue, 31 Jan 2006 00:11:23 +0000 Subject: Some changes to some stuff.. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2996 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_cban.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/modules/m_cban.cpp') diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index ae0961f29..8ddfcc159 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -98,19 +98,21 @@ class cmd_cban : public command_t // parameters[1] = 1h3m2s // parameters[2] = Tortoise abuser long length = Srv->CalcDuration(parameters[1]); + std::string reason = (pcnt > 2) ? parameters[2] : "No reason supplied"; - cbans.push_back(CBan(parameters[0], user->nick, TIME, length, parameters[2])); + cbans.push_back(CBan(parameters[0], user->nick, TIME, length, reason)); + std::sort(cbans.begin(), cbans.end(), CBanComp); if(length > 0) { - WriteServ(user->fd, "385 %s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, parameters[2]); - WriteOpers("*** %s added %lu second channel ban on %s (%s)", user->nick, length, parameters[0], parameters[2]); + WriteServ(user->fd, "385 %s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, reason.c_str()); + WriteOpers("*** %s added %lu second channel ban on %s (%s)", user->nick, length, parameters[0], reason.c_str()); } else { - WriteServ(user->fd, "385 %s %s :Added permenant channel ban (%s)", user->nick, parameters[0], parameters[2]); - WriteOpers("*** %s added permenant channel ban on %s (%s)", user->nick, parameters[0], parameters[2]); + WriteServ(user->fd, "385 %s %s :Added permenant channel ban (%s)", user->nick, parameters[0], reason.c_str()); + WriteOpers("*** %s added permenant channel ban on %s (%s)", user->nick, parameters[0], reason.c_str()); } } else @@ -143,10 +145,13 @@ class ModuleCBan : public Module { ExpireBans(); - for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++) + if(symbol == 'C') { - unsigned long remaining = (iter->set_on + iter->length) - TIME; - WriteServ(user->fd, "210 %s %s %s %lu %lu %lu :%s", user->nick, iter->chname.c_str(), iter->set_by.c_str(), iter->set_on, iter->length, remaining, iter->reason.c_str()); + for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++) + { + unsigned long remaining = (iter->set_on + iter->length) - TIME; + WriteServ(user->fd, "210 %s %s %s %lu %lu %lu :%s", user->nick, iter->chname.c_str(), iter->set_by.c_str(), iter->set_on, iter->length, remaining, iter->reason.c_str()); + } } return 0; -- cgit v1.2.3