diff options
author | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-10 20:08:30 +0000 |
---|---|---|
committer | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-10 20:08:30 +0000 |
commit | e7f08977f2686ceebb7a27ab56dd686a5b976e77 (patch) | |
tree | 9fa69aeb4cb724e750596dc46a57e1419e64ae7c /src | |
parent | 5fb54ac29a36131d2e49991095ef9741abb5f94e (diff) |
Add time.h include to inspircd.h. Random cleanups in channels.cpp, mostly using the typedef'ed names already defined rather than having the full template names everywhere. Remove some unneeded casts too.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3865 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index c63ddbb28..45a12ee7a 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -16,18 +16,13 @@ using namespace std; -#include "configreader.h" -#include "inspircd.h" -#include <unistd.h> -#include <sys/errno.h> -#include <sys/ioctl.h> -#include <sys/utsname.h> -#include <time.h> #include <string> #include <map> #include <sstream> #include <vector> #include <deque> +#include "configreader.h" +#include "inspircd.h" #include "hash_map.h" #include "users.h" #include "ctables.h" @@ -48,8 +43,6 @@ extern ServerConfig* Config; extern int MODCOUNT; extern std::vector<Module*> modules; extern std::vector<ircd_module*> factory; -extern int WHOWAS_STALE; -extern int WHOWAS_MAX; extern time_t TIME; extern chan_hash chanlist; @@ -76,14 +69,18 @@ void chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on) { log(DEBUG,"SetCustomModeParam called"); - std::map<char,char*>::iterator n = custom_mode_params.find(mode); + CustomModeList::iterator n = custom_mode_params.find(mode); if (mode_on) { - log(DEBUG,"Custom mode parameter %c %s added",mode,parameter); if (n == custom_mode_params.end()) { custom_mode_params[mode] = strdup(parameter); + log(DEBUG,"Custom mode parameter %c %s added",mode,parameter); + } + else + { + log(DEBUG, "Tried to set custom mode parameter for %c '%s' when it was already '%s'", mode, parameter, n->second); } } else @@ -113,7 +110,7 @@ std::string chanrec::GetModeParameter(char mode) } else { - std::map<char,char*>::iterator n = custom_mode_params.find(mode); + CustomModeList::iterator n = custom_mode_params.find(mode); if (n != custom_mode_params.end()) { return n->second; @@ -375,9 +372,9 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri for (std::vector<ucrec*>::const_iterator index = user->chans.begin(); index != user->chans.end(); index++) { - if ((ucrec*)(*index)->channel == NULL) + if ((*index)->channel == NULL) { - return ForceChan(Ptr,(ucrec*)(*index),user,created); + return ForceChan(Ptr, *index, user, created); } } @@ -634,11 +631,11 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++) { /* zap it from the channel list of the user */ - if ((((ucrec*)(*i))->channel) && (((ucrec*)(*i))->channel == Ptr)) + if ((*i)->channel && ((*i)->channel == Ptr)) { WriteChannel(Ptr,src,"KICK %s %s :%s",Ptr->name, user->nick, reason); - ((ucrec*)(*i))->uc_modes = 0; - ((ucrec*)(*i))->channel = NULL; + (*i)->uc_modes = 0; + (*i)->channel = NULL; log(DEBUG,"del_channel: unlinked: %s %s",user->nick,Ptr->name); break; } |