]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Merge branch 'master+movenames'
[user/henk/code/inspircd.git] / src / channels.cpp
index fdf0f76e1abdbb4f20539b63749cda5546d3cfb6..f79b5b89f56c37e221e7aee01f24862d64f660cb 100644 (file)
@@ -32,9 +32,6 @@ namespace
        ChanModeReference inviteonlymode(NULL, "inviteonly");
        ChanModeReference keymode(NULL, "key");
        ChanModeReference limitmode(NULL, "limit");
-       ChanModeReference secretmode(NULL, "secret");
-       ChanModeReference privatemode(NULL, "private");
-       UserModeReference invisiblemode(NULL, "invisible");
 }
 
 Channel::Channel(const std::string &cname, time_t ts)
@@ -86,14 +83,13 @@ void Channel::CheckDestroy()
        if (res == MOD_RES_DENY)
                return;
 
+       // If the channel isn't in chanlist then it is already in the cull list, don't add it again
        chan_hash::iterator iter = ServerInstance->chanlist.find(this->name);
-       /* kill the record */
-       if (iter != ServerInstance->chanlist.end())
-       {
-               FOREACH_MOD(OnChannelDelete, (this));
-               ServerInstance->chanlist.erase(iter);
-       }
+       if ((iter == ServerInstance->chanlist.end()) || (iter->second != this))
+               return;
 
+       FOREACH_MOD(OnChannelDelete, (this));
+       ServerInstance->chanlist.erase(iter);
        ClearInvites();
        ServerInstance->GlobalCulls.AddItem(this);
 }
@@ -345,16 +341,6 @@ Membership* Channel::ForceJoin(User* user, const std::string* privs, bool bursti
                this->WriteAllExcept(user, !ServerInstance->Config->CycleHostsFromUser, 0, except_list, "MODE %s +%s", this->name.c_str(), ms.c_str());
        }
 
-       if (IS_LOCAL(user))
-       {
-               if (this->topicset)
-               {
-                       user->WriteNumeric(RPL_TOPIC, "%s :%s", this->name.c_str(), this->topic.c_str());
-                       user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", this->name.c_str(), this->setby.c_str(), (unsigned long)this->topicset);
-               }
-               this->UserList(user);
-       }
-
        FOREACH_MOD(OnPostJoin, (memb));
        return memb;
 }
@@ -587,66 +573,6 @@ const char* Channel::ChanModes(bool showkey)
        return scratch.c_str();
 }
 
-/* compile a userlist of a channel into a string, each nick seperated by
- * spaces and op, voice etc status shown as @ and +, and send it to 'user'
- */
-void Channel::UserList(User* user, bool has_user)
-{
-       bool has_privs = user->HasPrivPermission("channels/auspex");
-       std::string list;
-       list.push_back(this->IsModeSet(secretmode) ? '@' : this->IsModeSet(privatemode) ? '*' : '=');
-       list.push_back(' ');
-       list.append(this->name).append(" :");
-       std::string::size_type pos = list.size();
-
-       const size_t maxlen = ServerInstance->Config->Limits.MaxLine - 10 - ServerInstance->Config->ServerName.size();
-       std::string prefixlist;
-       std::string nick;
-       for (MemberMap::iterator i = userlist.begin(); i != userlist.end(); ++i)
-       {
-               if ((!has_user) && (i->first->IsModeSet(invisiblemode)) && (!has_privs))
-               {
-                       /*
-                        * user is +i, and source not on the channel, does not show
-                        * nick in NAMES list
-                        */
-                       continue;
-               }
-
-               Membership* memb = i->second;
-
-               prefixlist.clear();
-               char prefix = memb->GetPrefixChar();
-               if (prefix)
-                       prefixlist.push_back(prefix);
-               nick = i->first->nick;
-
-               ModResult res;
-               FIRST_MOD_RESULT(OnNamesListItem, res, (user, memb, prefixlist, nick));
-
-               // See if a module wants us to exclude this user from NAMES
-               if (res == MOD_RES_DENY)
-                       continue;
-
-               if (list.size() + prefixlist.length() + nick.length() + 1 > maxlen)
-               {
-                       /* list overflowed into multiple numerics */
-                       user->WriteNumeric(RPL_NAMREPLY, list);
-
-                       // Erase all nicks, keep the constant part
-                       list.erase(pos);
-               }
-
-               list.append(prefixlist).append(nick).push_back(' ');
-       }
-
-       // Only send the user list numeric if there is at least one user in it
-       if (list.size() != pos)
-               user->WriteNumeric(RPL_NAMREPLY, list);
-
-       user->WriteNumeric(RPL_ENDOFNAMES, "%s :End of /NAMES list.", this->name.c_str());
-}
-
 /* returns the status character for a given user on a channel, e.g. @ for op,
  * % for halfop etc. If the user has several modes set, the highest mode
  * the user has must be returned.