From: brain Date: Thu, 9 Mar 2006 11:34:47 +0000 (+0000) Subject: Fixed to use iterators X-Git-Tag: v2.0.23~8516 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=b251c1feb7f7e379181266f23f4f20a740b68fe8;p=user%2Fhenk%2Fcode%2Finspircd.git Fixed to use iterators git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3580 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/channels.cpp b/src/channels.cpp index 1574ffc0b..41759f2e2 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -373,11 +373,11 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri log(DEBUG,"Passed channel checks"); - for (unsigned int index =0; index < user->chans.size(); index++) + for (std::vector::const_iterator index = user->chans.begin(); index != user->chans.end(); index++) { - if (user->chans[index].channel == NULL) + if ((ucrec*)(*index)->channel == NULL) { - return ForceChan(Ptr,user->chans[index],user,created); + return ForceChan(Ptr,(ucrec*)(*index),user,created); } } @@ -444,7 +444,7 @@ chanrec* ForceChan(chanrec* Ptr,ucrec *a,userrec* user, int created) a->uc_modes = 0; } - a.channel = Ptr; + a->channel = Ptr; Ptr->AddUser(user); WriteChannel(Ptr,user,"JOIN :%s",Ptr->name); log(DEBUG,"Sent JOIN to client"); @@ -548,7 +548,7 @@ void server_kick_channel(userrec* user, chanrec* Ptr, char* reason, bool trigger for (unsigned int i =0; i < user->chans.size(); i++) { - if ((user->chans[i]->channel) && (user->chans[i]->channel->name == Ptr)) + if ((user->chans[i]->channel) && (user->chans[i]->channel == Ptr)) { WriteChannelWithServ(Config->ServerName,Ptr,"KICK %s %s :%s",Ptr->name, user->nick, reason); user->chans[i]->uc_modes = 0; @@ -627,15 +627,15 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) } FOREACH_MOD(I_OnUserKick,OnUserKick(src,user,Ptr,reason)); - - for (unsigned int i =0; i < user->chans.size(); i++) + + for (std::vector::const_iterator i = user->chans.begin(); i != user->chans.end(); i++) { /* zap it from the channel list of the user */ - if ((user->chans[i].channel) && (user->chans[i].channel == Ptr->name)) + if ((((ucrec*)(*i))->channel) && (((ucrec*)(*i))->channel == Ptr)) { WriteChannel(Ptr,src,"KICK %s %s :%s",Ptr->name, user->nick, reason); - user->chans[i].uc_modes = 0; - user->chans[i].channel = NULL; + ((ucrec*)(*i))->uc_modes = 0; + ((ucrec*)(*i))->channel = NULL; log(DEBUG,"del_channel: unlinked: %s %s",user->nick,Ptr->name); break; } diff --git a/src/svn-rev.sh b/src/svn-rev.sh index 168c57787..54b5c80eb 100755 --- a/src/svn-rev.sh +++ b/src/svn-rev.sh @@ -1 +1 @@ -echo 3575 +echo 3579 diff --git a/src/users.cpp b/src/users.cpp index 9bc006bbc..4db389957 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -117,6 +117,8 @@ userrec::userrec() for (unsigned int n = 0; n < MAXCHANS; n++) { clientlist[tempnick]->chans[n] = new ucrec(); + clientlist[tempnick]->chans[n]->channel = NULL; + clientlist[tempnick]->chans[n]->uc_modes = 0; } }