-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
+/* +------------------------------------+
+ * | Inspire Internet Relay Chat Daemon |
+ * +------------------------------------+
+ *
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
- *
- * Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
-using namespace std;
-
#include <stdarg.h>
#include "configreader.h"
#include "inspircd.h"
{
*name = *topic = *setby = *key = 0;
created = topicset = limit = 0;
- internal_userlist.clear();
memset(&modes,0,64);
age = ServerInstance->Time(true);
}
/* create a new one */
Ptr = new chanrec(Instance);
- Instance->chanlist[cname] = Ptr;
+ (*(Instance->chanlist))[cname] = Ptr;
strlcpy(Ptr->name, cname,CHANMAX);
if (Ptr->modes[CM_INVITEONLY])
{
MOD_RESULT = 0;
- irc::string xname(Ptr->name);
FOREACH_RESULT_I(Instance,I_OnCheckInvite,OnCheckInvite(user, Ptr));
if (!MOD_RESULT)
{
- if (user->IsInvited(xname))
+ if (user->IsInvited(Ptr->name))
{
/* user was invited to channel */
/* there may be an optional channel NOTICE here */
return NULL;
}
}
- user->RemoveInvite(xname);
+ user->RemoveInvite(Ptr->name);
}
if (Ptr->limit)
{
{
Instance->Log(DEBUG,"BLAMMO, Whacking channel.");
/* Things went seriously pear shaped, so take this away. bwahaha. */
- chan_hash::iterator n = Instance->chanlist.find(cname);
- if (n != Instance->chanlist.end())
+ chan_hash::iterator n = Instance->chanlist->find(cname);
+ if (n != Instance->chanlist->end())
{
Ptr->DelUser(user);
DELETE(Ptr);
- Instance->chanlist.erase(n);
+ Instance->chanlist->erase(n);
}
}
dummyuser->SetFd(FD_MAGIC_NUMBER);
Ptr->AddUser(user);
- user->ModChannelCount(1);
+
+ /* Just in case they have no permissions */
+ user->chans[Ptr] = 0;
for (std::string::const_iterator x = privs.begin(); x != privs.end(); x++)
{
FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason ? reason : ""));
this->WriteChannel(user, "PART %s%s%s", this->name, reason ? " :" : "", reason ? reason : "");
user->chans.erase(i);
- user->ModChannelCount(-1);
this->RemoveAllPrefixes(user);
}
if (!this->DelUser(user)) /* if there are no users left on the channel... */
{
- chan_hash::iterator iter = ServerInstance->chanlist.find(this->name);
+ chan_hash::iterator iter = ServerInstance->chanlist->find(this->name);
/* kill the record */
- if (iter != ServerInstance->chanlist.end())
+ if (iter != ServerInstance->chanlist->end())
{
ServerInstance->Log(DEBUG,"del_channel: destroyed: %s", this->name);
FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(this));
- ServerInstance->chanlist.erase(iter);
+ ServerInstance->chanlist->erase(iter);
}
return 0;
}
if (!this->DelUser(user))
{
- chan_hash::iterator iter = ServerInstance->chanlist.find(this->name);
+ chan_hash::iterator iter = ServerInstance->chanlist->find(this->name);
/* kill the record */
- if (iter != ServerInstance->chanlist.end())
+ if (iter != ServerInstance->chanlist->end())
{
FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(this));
- ServerInstance->chanlist.erase(iter);
+ ServerInstance->chanlist->erase(iter);
}
return 0;
}
if (!this->DelUser(user))
/* if there are no users left on the channel */
{
- chan_hash::iterator iter = ServerInstance->chanlist.find(this->name);
+ chan_hash::iterator iter = ServerInstance->chanlist->find(this->name);
/* kill the record */
- if (iter != ServerInstance->chanlist.end())
+ if (iter != ServerInstance->chanlist->end())
{
FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(this));
- ServerInstance->chanlist.erase(iter);
+ ServerInstance->chanlist->erase(iter);
}
return 0;
}