diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-08 15:05:49 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-08 15:05:49 +0000 |
commit | 8d99003c221b7d6dcc04d0fc58629c243b48dbf0 (patch) | |
tree | 1412b12337da066d69cea9529dfefef7234c4062 /src/users.cpp | |
parent | 8c4528880ab1dfe6307b03d5976e23e1a553a663 (diff) |
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
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
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<userrec*>::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<userrec*>::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; + } } } } |