From 3a484a4afda5e7667843e109e2ff1e17786e3fb4 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 9 Mar 2006 12:28:35 +0000 Subject: Correctly use iterators and pointer to ucrec git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3584 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_nonicks.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/modules/m_nonicks.cpp') diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 5f7be1580..a252dc6da 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -64,20 +64,17 @@ class ModuleNoNickChange : public Module irc::string me = Srv->GetServerName().c_str(); if (server == me) { - for (unsigned int i =0; i < user->chans.size(); i++) + for (std::vector::iterator i = user->chans.begin(); i != user->chans.end(); i++) { - if (user->chans[i].channel != NULL) + if (((ucrec*)(*i))->channel != NULL) { - chanrec* curr = user->chans[i].channel; - if (curr->IsCustomModeSet('N')) + chanrec* curr = ((ucrec*)(*i))->channel; + if ((curr->IsCustomModeSet('N')) && (!*user->oper)) { - if (!*user->oper) - { - // don't allow the nickchange, theyre on at least one channel with +N set - // and theyre not an oper - WriteServ(user->fd,"447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name); - return 1; - } + // don't allow the nickchange, theyre on at least one channel with +N set + // and theyre not an oper + WriteServ(user->fd,"447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name); + return 1; } } } -- cgit v1.3.1-10-gc9f91