def __init__(self): super(SyncBlockItemTask, self).__init__() block = blocking_cmd.BlockItemHandler().getFilterString() unblock = blocking_cmd.UnblockItemHandler().getFilterString() self._handlers = { block: AddBlockItemTask, unblock: RemoveBlockItemTask }
def set(self, pyGlooxTag): result = blocking_cmd.BlockItemHandler().handleTag(pyGlooxTag) jid, info = findFirst(None, result, ('', {})) if jid != self._jid: return user = _syncBlockItem(self.usersStorage, self._jid, **info) if user: g_logOutput.debug(CLIENT_LOG_AREA.BLOCK_LIST, 'Block item is added', jid, info) self._doNotify(USER_ACTION_ID.IGNORED_ADDED, user) self._doNotify(USER_ACTION_ID.MUTE_SET, user, False) self._result = TASK_RESULT.REMOVE