Beispiel #1
0
		ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
		{
			if (target_type == TYPE_CHANNEL)
			{
				Channel* chan = (Channel*)dest;

				/* If the user is +v or higher, they can speak regardless. */
				if (chan->GetPrefixValue(user) >= VOICE_VALUE)
					return MOD_RES_PASSTHRU;

				/* Get the list of +q's */
				modelist *list = qb.extItem.get(chan);

				/* No list, continue. */
				if (!list)
					return MOD_RES_PASSTHRU;

				/* Copied from m_banredirect.cpp */
				std::string ipmask(user->nick);
				ipmask.append(1, '!').append(user->MakeHostIP());

				/* If this matches, then they match a +q, & don't allow them to speak. */
				for (modelist::iterator it = list->begin(); it != list->end(); it++)
					if (InspIRCd::Match(user->GetFullHost(), it->mask) ||
						InspIRCd::Match(user->GetFullRealHost(), it->mask) ||
						InspIRCd::MatchCIDR(ipmask, it->mask))
					{
						/* lol 404 */
						user->WriteNumeric(404, "%s %s :Cannot send to channel (You are muted (+q))", user->nick.c_str(), chan->name.c_str());
						return MOD_RES_DENY;
					}
			}

			return MOD_RES_PASSTHRU;
		}
OptionsWidget_channelAdvanced::OptionsWidget_channelAdvanced(QWidget * pParent)
: KviOptionsWidget(pParent)
{
	createLayout();

	KviBoolSelector * b = addBoolSelector(0,0,4,0,__tr2qs_ctx("Log joined channels history","options"),KviOption_boolLogChannelHistory);

	addLabel(0,1,0,1,__tr2qs_ctx("Default ban mask:","options"));

	m_pBanTypeCombo = new QComboBox(this);
	addWidgetToLayout(m_pBanTypeCombo,1,1,4,1);

	KviIrcMask hostmask("[email protected]");
	KviIrcMask ipmask("[email protected]");
	QString tmp1;
	QString tmp2;
	for(int i=0;i<=26;i++)
	{

		hostmask.mask(tmp1,(KviIrcMask::MaskType)i);
		ipmask.mask(tmp2,(KviIrcMask::MaskType)i);
        m_pBanTypeCombo->insertItem(m_pBanTypeCombo->count(),QString("%1 (%2)").arg(tmp1, tmp2));
	}
	m_pBanTypeCombo->setCurrentIndex(KVI_OPTION_UINT(KviOption_uintDefaultBanType));

	KviTalGroupBox * g = addGroupBox(0,2,4,2,Qt::Horizontal,__tr2qs_ctx("On Channel Join","options"));
	KviUIntSelector *u = addUIntSelector(g,__tr2qs_ctx("Minimum delay between two channel requests:","options"),KviOption_uintOnJoinRequestsDelay,0,10,1);
	u->setSuffix(__tr2qs_ctx(" sec","options"));
	mergeTip(u,__tr2qs_ctx("<center>This is an artificial delay for the channel requests made on join.<br>You may increase it if your server complains about flooding when joining many channels at once.<br>Minimum value: <b>0 secs</b><br>Maximum value: <b>10 secs</b></center>","options"));

	addBoolSelector(g,__tr2qs_ctx("Do not send /WHO request","options"),KviOption_boolDisableWhoRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request ban list","options"),KviOption_boolDisableBanListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request ban exception list","options"),KviOption_boolDisableBanExceptionListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request invite list","options"),KviOption_boolDisableInviteListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Do not request quiet ban list","options"),KviOption_boolDisableQuietBanListRequestOnJoin);
	addBoolSelector(g,__tr2qs_ctx("Echo channel topic","options"),KviOption_boolEchoNumericTopic);
	addBoolSelector(g,__tr2qs_ctx("Show channel sync time","options"),KviOption_boolShowChannelSyncTime);

	b = addBoolSelector(g,__tr2qs_ctx("Paste last channel log","options"),KviOption_boolPasteLastLogOnChannelJoin);

	KviTalHBox * box = new KviTalHBox(g);
	u = addUIntSelector(box,__tr2qs_ctx("Paste up to:","options"),KviOption_uintLinesToPasteOnChannelJoin,0,50,10,KVI_OPTION_BOOL(KviOption_boolPasteLastLogOnChannelJoin));
	u->setSuffix(__tr2qs_ctx(" lines","options"));
	mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>0 lines</b><br>Maximum value: <b>50 lines</b></center>","options"));
	connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));
	u = addUIntSelector(box,__tr2qs_ctx("Interval:","options"),KviOption_uintDaysIntervalToPasteOnChannelJoin,1,10,10,KVI_OPTION_BOOL(KviOption_boolPasteLastLogOnChannelJoin));
	u->setSuffix(__tr2qs_ctx(" days","options"));
	mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>0 days</b><br>Maximum value: <b>10 days</b></center>","options"));
	connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));

 	b = addBoolSelector(0,3,4,3,__tr2qs_ctx("Keep away list updated","options"),KviOption_boolEnableAwayListUpdates);
	mergeTip(b,
		__tr2qs_ctx("<center>KVIrc sends out a channel /WHO message every now and then to keep " \
			"the channel away list in sync. Use this option to disable this feature (and to save " \
			"your IRC bandwidth. If the server supports IRCv3.1's away-notify extension, it will be used instead of WHO requests.</center>","options"));

	addRowSpacer(0,5,4,5);
}