diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-07 17:16:55 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-07 17:16:55 +0000 |
commit | 91ca2329986bf3b6611edbc88795d345a4c0353f (patch) | |
tree | dcd9175f8648e29fe8c4c3c6853ebf9953fec646 | |
parent | 9ec715957b95578172c136e6706e58e873956689 (diff) |
Optimizations
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3517 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/helperfuncs.cpp | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 9080cc6a5..82ee5c148 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -1268,31 +1268,18 @@ void userlist(userrec *user,chanrec *c) int usercount_i(chanrec *c) { - int count = 0; - - if (!c) - { - log(DEFAULT,"*** BUG *** usercount_i was given an invalid parameter"); - return 0; - } + if (!c) + return 0; - for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) - { - if (has_channel(i->second,c)) - { - if (i->second->registered == 7) - { - if ((!has_channel(i->second,c)) && (strchr(i->second->modes,'i'))) - { - /* user is +i, and source not on the channel, does not show - * nick in NAMES list */ - continue; - } - count++; - } - } - } - log(DEBUG,"usercount_i: %s %lu",c->name,(unsigned long)count); + int count = 0; + std::map<char*,char*> *ulist= c->GetUsers(); + for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++) + { + char* o = i->second; + userrec* user = (userrec*)o; + if (!strchr(user->modes,'i')) + count++; + } return count; } @@ -1507,9 +1494,10 @@ bool DirValid(char* dirandfile) if( getcwd( otherdir, MAXBUF ) == NULL ) return false; chdir(buffer); - if (strlen(otherdir) >= strlen(work)) + int t = strlen(work); + if (strlen(otherdir) >= t) { - otherdir[strlen(work)] = '\0'; + otherdir[t] = '\0'; if (!strcmp(otherdir,work)) { return true; |