X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fchannels.cpp;h=6c70259bcea4a78bbfc5379d27c81629edd87ae9;hb=74a515a72f08fc85d8d59cb7207fba9ece51215f;hp=c8334d42ec735be95d8b408d4b95f07478f88f1c;hpb=bff68688367b82f9841d6c45114c58af61a800e8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/channels.cpp b/src/channels.cpp index c8334d42e..6c70259bc 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -36,7 +36,7 @@ void Channel::SetMode(char mode,bool mode_on) modes[mode-65] = mode_on; } -void Channel::SetMode(char mode, std::string parameter) +void Channel::SetModeParam(char mode, std::string parameter) { CustomModeList::iterator n = custom_mode_params.find(mode); // always erase, even if changing, so that the map gets the new value @@ -261,15 +261,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool if (IS_LOCAL(user) && !override) { // Checking MyClass exists because we *may* get here with NULL, not 100% sure. - if (user->MyClass && user->MyClass->GetMaxChans()) - { - if (user->chans.size() >= user->MyClass->GetMaxChans()) - { - user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn); - return NULL; - } - } - else + if (user->MyClass && user->MyClass->maxchans) { if (user->HasPrivPermission("channels/high-join-limit")) { @@ -281,7 +273,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool } else { - if (user->chans.size() >= Instance->Config->MaxChans) + if (user->chans.size() >= user->MyClass->maxchans) { user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn); return NULL; @@ -474,6 +466,10 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const user->WriteNumeric(RPL_TOPIC, "%s %s :%s", user->nick.c_str(), Ptr->name.c_str(), Ptr->topic.c_str()); user->WriteNumeric(RPL_TOPICTIME, "%s %s %s %lu", user->nick.c_str(), Ptr->name.c_str(), Ptr->setby.c_str(), (unsigned long)Ptr->topicset); } + else + { + user->WriteNumeric(RPL_NOTOPICSET, "%s %s :No topic is set", user->nick.c_str(), Ptr->name.c_str()); + } Ptr->UserList(user); } FOREACH_MOD_I(Instance,I_OnPostJoin,OnPostJoin(user, Ptr)); @@ -595,52 +591,11 @@ long Channel::PartUser(User *user, std::string &reason) long Channel::ServerKickUser(User* user, const char* reason, const char* servername) { - bool silent = false; - - if (!user || !reason) - return this->GetUserCounter(); - - if (IS_LOCAL(user)) - { - if (!this->HasUser(user)) - { - /* Not on channel */ - return this->GetUserCounter(); - } - } - if (servername == NULL || *ServerInstance->Config->HideWhoisServer) servername = ServerInstance->Config->ServerName; - FOREACH_MOD(I_OnUserKick,OnUserKick(NULL, user, this, reason, silent)); - - UCListIter i = user->chans.find(this); - if (i != user->chans.end()) - { - if (!silent) - this->WriteChannelWithServ(servername, "KICK %s %s :%s", this->name.c_str(), user->nick.c_str(), reason); - - user->chans.erase(i); - this->RemoveAllPrefixes(user); - } - - if (!this->DelUser(user)) - { - chan_hash::iterator iter = ServerInstance->chanlist->find(this->name); - /* kill the record */ - if (iter != ServerInstance->chanlist->end()) - { - int MOD_RESULT = 0; - FOREACH_RESULT_I(ServerInstance,I_OnChannelPreDelete, OnChannelPreDelete(this)); - if (MOD_RESULT == 1) - return 1; // delete halted by module - FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this)); - ServerInstance->chanlist->erase(iter); - } - return 0; - } - - return this->GetUserCounter(); + ServerInstance->FakeClient->server = servername; + return this->KickUser(ServerInstance->FakeClient, user, reason); } long Channel::KickUser(User *src, User *user, const char* reason)