X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FChanNode.c;h=44a335f1cb822f2d7c414ebeef955781c93601c1;hp=977b9b4c985eb8d9270e0f788607882a9db81d3a;hb=HEAD;hpb=55831bf424312a6908ca07a904f288fba0919a9a diff --git a/src/ChanNode.c b/src/ChanNode.c index 977b9b4..44a335f 100644 --- a/src/ChanNode.c +++ b/src/ChanNode.c @@ -1,4 +1,4 @@ -/* ChanNode.c - NeonServ v5.3 +/* ChanNode.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -20,16 +20,13 @@ #include "BanNode.h" #include "modcmd.h" #include "ModeNode.h" -#include "bot_NeonSpam.h" #include "IRCEvents.h" +#include "tools.h" +#include "log.h" static struct ChanNode **chanList; -#ifdef HAVE_THREADS -pthread_mutex_t cache_sync; -#endif void init_ChanNode() { - THREAD_MUTEX_INIT(cache_sync); /* len pos chars 26 0 a-z @@ -135,7 +132,7 @@ struct ChanNode* addChannel(const char *name) { struct ChanNode *chan = malloc(sizeof(*chan)); if (!chan) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return NULL; } strcpy(chan->name, name); @@ -143,7 +140,7 @@ struct ChanNode* addChannel(const char *name) { chan->bans = NULL; chan->spam_settings = NULL; chan->usercount = 0; - chan->chanbot = NULL; + chan->botcount = 0; chan->topic[0] = 0; chan->flags = 0; /* mode lists */ @@ -235,18 +232,14 @@ void freeChanNode(struct ChanNode* chan) { freeModeNode(chan->modes); if(chan->bans) removeChannelBans(chan); - if(chan->spam_settings) - freeNeonSpamSettings(chan->spam_settings); free(chan); } int checkChannelVisibility(struct ChanNode* chan) { struct ChanUser *chanuser, *next; for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) { - if(chanuser->user->flags & USERFLAG_ISBOT) { - chan->chanbot = chanuser->user; + if(chanuser->user->flags & USERFLAG_ISBOT) return 1; - } } //free the channel... SYNCHRONIZE(cache_sync);