Exemplo n.º 1
0
	void OnLeaveChannel(User *u, Channel *c) override
	{
		/* Channel is persistent, it shouldn't be deleted and the service bot should stay */
		if (c->ci && c->ci->HasFieldS("PERSIST"))
			return;
	
		/* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediately
		 * We also don't part the bot here either, if necessary we will part it after the sync
		 */
		if (c->syncing)
			return;

		/* Additionally, do not delete this channel if ChanServ/a BotServ bot is inhabiting it */
		if (inhabit && inhabit->HasExt(c))
			return;

		if (c->ci)
		{
			ServiceBot *bot = c->ci->GetBot();

			/* This is called prior to removing the user from the channnel, so c->users.size() - 1 should be safe */
			if (bot && u != bot && c->users.size() - 1 <= Config->GetModule(this)->Get<unsigned>("minusers") && c->FindUser(bot))
				bot->Part(c);
		}
	}
Exemplo n.º 2
0
	void SendTopic(const MessageSource &source, Channel *c) override
	{
		ServiceBot *bi = source.GetBot();
		bool needjoin = c->FindUser(bi) == NULL;

		if (needjoin)
		{
			ChannelStatus status;

			status.AddMode('o');
			bi->Join(c, &status);
		}

		IRCDProto::SendTopic(source, c);

		if (needjoin)
			bi->Part(c);
	}