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.UnblockItemHandler().handleTag(pyGlooxTag) jid, info = findFirst(None, result, ('', {})) if jid != self._jid: return user = self._getUser() if user and user.getItemType() in XMPP_ITEM_TYPE.BLOCKING_LIST: user.update(item=None) user.removeTags({USER_TAG.MUTED}) g_logOutput.debug(CLIENT_LOG_AREA.BLOCK_LIST, 'Block item is removed', jid, info) self._doNotify(USER_ACTION_ID.IGNORED_REMOVED, user) self._doNotify(USER_ACTION_ID.MUTE_UNSET, user, False) if user.isFriend(): self._doNotify(USER_ACTION_ID.FRIEND_ADDED, user, False) self._result = TASK_RESULT.REMOVE