def __init__(self, global_state, channel_name): PBThread.__init__(self, self._enter, name='ChanOp-{}'.format(channel_name)) self._message_queue = Queue(100) self._members = MemberList() self._is_getting_members = Event() self._channel_name = channel_name self.update_global_state(global_state) if 'masters' not in self._conf['general']: self._masters = [] else: self._masters = json.loads(self._conf['general']['masters']) if 'ignores' not in self._conf['general']: self._ignores = [] else: self._ignores = json.loads(self._conf['general']['ignores']) self._highlight_spam_token_bucket = token_bucket( int(self._conf['highlight_spam']['long_mention_limit']), float(self._conf['highlight_spam']['long_mention_limit_seconds']) / float(self._conf['highlight_spam']['long_mention_limit'])) self._highlight_spam_token_bucket_state = None self._message_flood_token_bucket_func = token_bucket( int(self._conf['flood']['message_limit']), float(self._conf['flood']['message_limit_seconds']) / float(self._conf['flood']['message_limit'])) self._message_flood_burst_token_bucket_func = token_bucket( int(self._conf['flood']['burst_message_limit']), float(self._conf['flood']['burst_message_limit_seconds']) / float(self._conf['flood']['burst_message_limit'])) self._message_flood_token_bucket_states = {}
def __init__(self, global_state, long_timeout=5, time_between_actions_func=None): PBThread.__init__(self, self._enter, name='OutboundMessage') self._action_queue = \ ActionQueue(long_timeout=long_timeout, time_between_actions_func=time_between_actions_func) self.update_global_state(global_state)
def __init__(self, global_state, channel_name): PBThread.__init__(self, self._enter, name='OperatorAction-{}'.format(channel_name)) self._is_op = Event() self._waiting_actions = Queue(100) self._unmute_timer = None self._last_mute = 0.1 self._channel_name = channel_name self.update_global_state(global_state)
def __init__(self, global_state): PBThread.__init__(self, self._enter, name='Heartbeat') self._event_queue = Queue(10) self._start = time.time() self._counters = { 'add_nick': 0, 'add_nick_total': 0, 'change_nick': 0, 'change_nick_total': 0, 'del_nick': 0, 'del_nick_total': 0, 'quiet_add': 0, 'quiet_add_total': 0, 'quiet_del': 0, 'quiet_del_total': 0, 'akick_add': 0, 'akick_add_total': 0, 'akick_del': 0, 'akick_del_total': 0, 'mode': 0, 'mode_total': 0, 'kick': 0, 'kick_total': 0, 'chan_msg': 0, 'chan_msg_total': 0, } self.update_global_state(global_state)
def __init__(self, fname, source, global_state, channel_name=None, *args, **kwargs): # if <source> == 'chan' or 'comm', then <channel_name> must be given. # Otherwise, it must not be given assert source in ['chan', 'comm', 'serv', 'priv'] if source in ['chan', 'comm']: assert channel_name is not None name = 'WatchFile-{}'.format(channel_name) else: assert channel_name is None name = 'WatchFile-{}'.format(source) PBThread.__init__(self, self._enter, *args, name=name, **kwargs) self._fname = fname self._source = source self._channel_name = channel_name self.update_global_state(global_state)
def __init__(self, global_state): PBThread.__init__(self, self._enter, name='CommandListener') self._message_queue = Queue(100) self.update_global_state(global_state)
def __init__(self, global_state): PBThread.__init__(self, self._enter, name='IIWatchdog') self.update_global_state(global_state)
def __init__(self, fname, global_state, *args, **kwargs): name = 'LogToMasters' PBThread.__init__(self, self._enter, *args, name=name, **kwargs) self._fname = fname self.update_global_state(global_state)