using namespace std;
-std::vector<ModeParameter> custom_mode_params;
+//std::vector<ModeParameter> custom_mode_params;
chanrec* ForceChan(chanrec* Ptr,ucrec &a,userrec* user, int created);
return (strchr(this->custom_modes,mode));
}
-/* XXX - would it not be better to store a vector for each channel, rather than one huge list? -- w00t */
std::string chanrec::GetModeParameter(char mode)
{
if (custom_mode_params.size())
chanlist[cname]->binarymodes = CM_TOPICLOCK | CM_NOEXTERNAL;
chanlist[cname]->created = TIME;
*chanlist[cname]->topic = 0;
- strlcpy(chanlist[cname]->setby, user->nick,NICKMAX);
+ strlcpy(chanlist[cname]->setby, user->nick,NICKMAX-1);
chanlist[cname]->topicset = 0;
Ptr = chanlist[cname];
log(DEBUG,"add_channel: created: %s",cname);
user->chans.push_back(a);
return c;
}
- else if (strchr(user->modes,'o'))
+ else if (*user->oper)
{
/* Oper allows extension up to the OPERMAXCHANS value */
if (user->chans.size() < OPERMAXCHANS)
log(DEBUG,"add_channel: user channel max exceeded: %s %s",user->nick,cname);
WriteServ(user->fd,"405 %s %s :You are on too many channels",user->nick, cname);
+
+ if (created == 2)
+ {
+ log(DEBUG,"BLAMMO, Whacking channel.");
+ /* Things went seriously pear shaped, so take this away. bwahaha. */
+ chan_hash::iterator n = chanlist.find(cname);
+ if (n != chanlist.end())
+ {
+ Ptr->DelUser((char*)user);
+ delete Ptr;
+ chanlist.erase(n);
+ for (unsigned int index =0; index < user->chans.size(); index++)
+ {
+ if (user->chans[index].channel == Ptr)
+ {
+ user->chans[index].channel == NULL;
+ user->chans[index].uc_modes = 0;
+ }
+ }
+ }
+ }
return NULL;
}