# -*- Mode: Python; tab-width: 4 -*-

class multi_filter:
	"""Combines multiple filters into a single filter object.
	The response is the logical OR of the sub-filters"""

	def __init__ (self, *filters):
		self.filters = filters
		self.hits = 0

	def scan (self, headers):
		for f in self.filters:
			if f.scan (headers):
				self.hits = self.hits + 1
				return 1
		return 0

	def report (self, channel):
		channel.push ('multi-filter report (%d hits total):\r\n' % self.hits)
		for f in self.filters:
			channel.push (' --- filter %s:\r\n' % repr(f))
			f.report (channel)
		channel.push ('done with report.\r\n')
