From 8d99003c221b7d6dcc04d0fc58629c243b48dbf0 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 8 Aug 2006 15:05:49 +0000 Subject: AddOper() and DeleteOper() -> userrec::Oper() and userrec::UnOper() (these do more, too) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4792 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/users.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index aab7815e8..327d0b5bb 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -615,21 +615,31 @@ const char* userrec::GetWriteError() return this->WriteError.c_str(); } -void AddOper(userrec* user) +void userrec::Oper(const std::string &opertype) { - log(DEBUG,"Oper added to optimization list"); - all_opers.push_back(user); + this->modes[UM_OPERATOR] = 1; + WriteServ(this->fd, "MODE %s :+o", this->nick); + FOREACH_MOD(I_OnOper, OnOper(this, opertype)); + log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str()); + strlcpy(this->oper, opertype.c_str(), NICKMAX - 1); + all_opers.push_back(this); + FOREACH_MOD(I_OnPostOper,OnPostOper(this, opertype)); } -void DeleteOper(userrec* user) +void userrec::UnOper() { - for (std::vector::iterator a = all_opers.begin(); a < all_opers.end(); a++) + if (*this->oper) { - if (*a == user) + *this->oper = 0; + this->modes[UM_OPERATOR] = 0; + for (std::vector::iterator a = all_opers.begin(); a < all_opers.end(); a++) { - log(DEBUG,"Oper removed from optimization list"); - all_opers.erase(a); - return; + if (*a == this) + { + log(DEBUG,"Oper removed from optimization list"); + all_opers.erase(a); + return; + } } } } -- cgit v1.3.1-10-gc9f91