Пример #1
0
 def _onResponseFailure(self, ids, args):
     if super(VOIPChatProvider, self)._onResponseFailure(ids, args):
         error = errors.createVOIPError(args)
         if error:
             g_messengerEvents.onErrorReceived(error)
         else:
             LOG_WARNING('Error is not resolved on the client', ids, args)
Пример #2
0
 def error(self, pyGlooxTag):
     error = self._getError(pyGlooxTag)
     if error:
         g_messengerEvents.onErrorReceived(error)
     else:
         g_logOutput.error(_LOG_AREA.PY_WRAPPER, 'Error is not resolved on the client', self.__class__.__name__, pyGlooxTag.getXml())
     self._result = TASK_RESULT.CLEAR
Пример #3
0
 def _onResponseFailure(self, ids, args):
     if super(AdminChatCommandHandler, self)._onResponseFailure(ids, args):
         error = errors.createAdminCommandError(args)
         if error:
             g_messengerEvents.onErrorReceived(error)
         else:
             LOG_WARNING('Error is not resolved on the client', ids, args)
Пример #4
0
 def _setIQError(self, tag):
     if self._step == ENTRY_STEP.SET_DATA_FORM:
         self._sendPresence(chat_ext.MUCLeaveQuery(self._getUserJID()))
     error = errors.createServerUserRoomCreationIQError(tag, self._room.getName())
     if error is not None:
         g_messengerEvents.onErrorReceived(error)
     self._remove()
     return
Пример #5
0
 def createPrivateChannel(self, dbID, name):
     if GUI_SETTINGS.useXmppToCreatePrivate:
         result, error = self.__xmppProto.messages.startChatSession(dbID, name)
         if not result:
             g_messengerEvents.onErrorReceived(error)
     else:
         self.__bwProto.users.createPrivateChannel(dbID, name)
     return True
Пример #6
0
 def _onResponseFailure(self, ids, args):
     command = super(BattleChatCommandHandler, self)._onResponseFailure(ids, args)
     if command:
         error = errors.createBattleCommandError(args, command)
         if error:
             g_messengerEvents.onErrorReceived(error)
         else:
             LOG_WARNING('Error is not resolved on the client', command, args)
Пример #7
0
 def sendChatMessage(self, jid, body):
     if self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE):
         g_messengerEvents.onErrorReceived(ChatCoolDownError(CLIENT_ACTION_ID.SEND_MESSAGE, self.__limits.getBroadcastCoolDown()))
         return
     body = self.__msgFilters.chainOut(body, self.__limits)
     if not body:
         return
     self.__chatSessions.sendMessage(ContactBareJID(jid), body, self.__msgFilters)
     self.__cooldown.process(CLIENT_ACTION_ID.SEND_MESSAGE)
 def sendPassword(self, value):
     validator = self.proto.messages.getUserRoomValidator()
     password, error = validator.validateUserRoomPwd(value)
     if error is not None:
         g_messengerEvents.onErrorReceived(error)
     else:
         self.proto.messages.joinToUserRoom(self._channel.getID(), password=password)
         self.destroy()
     return
Пример #9
0
 def parseLine(self, text, clientID = 0):
     cmd, result = None, admin_chat_cmd.parseCommandLine(text)
     if not result:
         return (False, None)
     if result.hasError():
         g_messengerEvents.onErrorReceived(result.getError())
     else:
         decorator = admin_chat_cmd.makeDecorator(result, clientID)
         if self.send(decorator):
             cmd = decorator
     return (True, cmd)
Пример #10
0
 def sendMessage(self, jid, body, filters):
     channel = self.channelsStorage.getChannel(entities.XMPPChatChannelEntity(jid))
     if channel:
         if self.playerCtx.isChatBan():
             error = createChatBanError(self.playerCtx.getBanInfo())
             if error:
                 g_messengerEvents.onErrorReceived(error)
                 return
         dbID = getPlayerDatabaseID()
         name = getPlayerName()
         g_messengerEvents.channels.onMessageReceived(XMPPMessageData(dbID, name, filters.chainIn(dbID, body), time.time()), channel)
         self.client().sendMessage(ChatMessageHolder(jid, msgBody=body))
Пример #11
0
 def _setPresenceError(self, tag):
     error = errors.createServerActionPresenceError(self._getActionID(), tag)
     if error is not None:
         if error.getErrorType() == ERROR_TYPE.AUTH and error.getCondition() == 'not-authorized' and self._step != ENTRY_STEP.PASSWORD_REQUIRED:
             self._step = ENTRY_STEP.PASSWORD_REQUIRED
             g_messengerEvents.channels.onConnectingToSecureChannel(self._room)
         else:
             g_messengerEvents.onErrorReceived(error)
             self._remove()
     else:
         self._remove()
     return
Пример #12
0
 def _onResponseFailure(self, ids, args):
     actionID = super(VOIPChatProvider, self)._onResponseFailure(ids, args)
     if actionID is None:
         return
     error, logOnly = errors.createVOIPError(args, actionID)
     if error:
         if logOnly:
             LOG_NOTE(error)
         else:
             g_messengerEvents.onErrorReceived(error)
     else:
         LOG_WARNING('Error is not resolved on the client to display in GUI', actionID, ids, args)
Пример #13
0
 def doAction(self, actionID, args = None, response = False, skipCoolDown = False):
     success, reqID = False, 0
     if self.__coolDown.isInProcess(actionID):
         if not skipCoolDown:
             g_messengerEvents.onErrorReceived(createCoolDownError(actionID))
     else:
         if response:
             reqID = self.__idGen.next()
         if self.__isEnabled:
             success = self.__sendAction(actionID, reqID, args)
         else:
             success = self.__addActionToQueue(actionID, reqID, args)
     return (success, reqID)
Пример #14
0
 def _join(self, info):
     if info is not None:
         statuses = info.statuses
     else:
         statuses = ()
     if MUC_STATUS.SELF_PRESENCE in statuses and MUC_STATUS.CREATE_ROOM in statuses:
         self._step = ENTRY_STEP.SET_DATA_FORM
         self._sendIQ(chat_ext.UserRoomConfigurationFormSet(self._room.getID(), self._room.getName(), self._room.getPassword()))
     else:
         g_messengerEvents.onErrorReceived(ClientActionError(CLIENT_ACTION_ID.CREATE_USER_ROOM, CLIENT_ERROR_ID.GENERIC))
         self._result = ACTION_RESULT.DO_NOTHING
         self._sendPresence(chat_ext.MUCLeaveQuery(self._getUserJID()))
     return
Пример #15
0
 def sendMessage(self, jid, body, filters):
     _, exists = self._searchChannel(jid)
     if exists is None:
         return
     elif self.playerCtx.isBanned(components=exists.getBanComponent()):
         error = createChatBanError(self.playerCtx.getBanInfo())
         if error:
             g_messengerEvents.onErrorReceived(error)
         return
     else:
         self._repeatMessage(exists, body, filters)
         self.client().sendMessage(chat_ext.ChatMessageHolder(exists.getMessageType(), jid, msgBody=body))
         return
Пример #16
0
    def handleIQ(self, iqID, iqType, tag):
        if iqID == self.__iqID:
            if iqType == IQ_TYPE.RESULT:
                self.__state = _HISTORY_RQ_STATE.RESULT
            elif iqType == IQ_TYPE.ERROR:
                self.__state = _HISTORY_RQ_STATE.UNAVAILABLE
                error = errors.createServerActionIQError(CLIENT_ACTION_ID.RQ_HISTORY, tag)
                if error:
                    g_messengerEvents.onErrorReceived(error)
                while self.__pool:
                    self.__setChannelHistory(self.__pool.pop(0))

            result = True
        else:
            result = False
        return result
 def createChannel(self, name, usePassword, password, retype):
     validator = self.proto.messages.getUserRoomValidator()
     name, error = validator.validateUserRoomName(name)
     if error is not None:
         g_messengerEvents.onErrorReceived(error)
         return
     else:
         if usePassword:
             pwd, error = validator.validateUserRoomPwdPair(password, retype)
             if error is not None:
                 g_messengerEvents.onErrorReceived(error)
                 return
         result = self.proto.messages.createUserRoom(name, password)
         if result:
             self.destroy()
         return
Пример #18
0
 def _join(self, info):
     if info is not None:
         statuses = info.statuses
     else:
         statuses = ()
     if MUC_STATUS.SELF_PRESENCE in statuses and MUC_STATUS.CREATE_ROOM in statuses:
         self._step = ENTRY_STEP.SET_DATA_FORM
         self._sendIQ(
             chat_ext.UserRoomConfigurationFormSet(
                 self._room.getID(), self._room.getName(),
                 self._room.getPassword()))
     else:
         g_messengerEvents.onErrorReceived(
             ClientActionError(CLIENT_ACTION_ID.CREATE_USER_ROOM,
                               CLIENT_ERROR_ID.GENERIC))
         self._result = ACTION_RESULT.DO_NOTHING
         self._sendPresence(chat_ext.MUCLeaveQuery(self._getUserJID()))
     return
Пример #19
0
 def doAction(self,
              actionID,
              args=None,
              response=False,
              skipCoolDown=False):
     success, reqID = False, 0
     if self.__coolDown.isInProcess(actionID):
         if not skipCoolDown:
             g_messengerEvents.onErrorReceived(
                 createCoolDownError(actionID))
     else:
         if response:
             reqID = self.__idGen.next()
         if self.__isEnabled:
             success = self.__sendAction(actionID, reqID, args)
         else:
             success = self.__addActionToQueue(actionID, reqID, args)
     return (success, reqID)
Пример #20
0
 def doAction(self,
              actionID,
              args=None,
              response=False,
              skipCoolDown=False):
     success, reqID = False, 0
     if self.__isCooldownInProcess(actionID, args):
         shouldShowCooldownError = not skipCoolDown and self.__shouldShowErrorMessage(
             actionID, args)
         if shouldShowCooldownError:
             g_messengerEvents.onErrorReceived(
                 createCoolDownError(actionID,
                                     self.__getCooldownTime(actionID,
                                                            args)))
     else:
         if response:
             reqID = self.__idGen.next()
         if self.__isEnabled:
             success = self.__sendAction(actionID, reqID, args)
         else:
             success = self.__addActionToQueue(actionID, reqID, args)
     return (success, reqID)
Пример #21
0
 def _onResponseFailure(self, ids, args):
     if super(_EntityChatHandler, self)._onResponseFailure(ids, args):
         error = errors.createBroadcastError(args, self.__actions.broadcastID)
         if error:
             g_messengerEvents.onErrorReceived(error)
Пример #22
0
 def cancelFriendship(self, dbID):
     result, error = self.__xmppProto.contacts.cancelFriendship(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #23
0
 def removeNote(self, dbID):
     result, error = self.__xmppProto.contacts.removeNote(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #24
0
 def addGroup(self, name):
     result, error = self.__xmppProto.contacts.addGroup(name)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #25
0
 def removeGroup(self, name, isForced = False):
     result, error = self.__xmppProto.contacts.removeGroup(name, isForced)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #26
0
 def cancelFriendship(self, dbID):
     result, error = self._proto.contacts.cancelFriendship(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #27
0
 def requestFriendship(self, dbID):
     result, error = self.__xmppProto.contacts.requestFriendship(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #28
0
 def removeIgnored(self, dbID):
     result, error = self.__xmppProto.contacts.removeIgnored(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #29
0
 def removeNote(self, dbID):
     result, error = self._proto.contacts.removeNote(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #30
0
 def __onChatBanned(self, chatAction):
     error = errors.ChatBannedError.create(chatAction)
     if error:
         g_messengerEvents.onErrorReceived(error)
Пример #31
0
 def _setIQError(self, tag):
     error = errors.createServerActionIQError(self._getActionID(), tag)
     if error is not None:
         g_messengerEvents.onErrorReceived(error)
     self._remove()
     return
Пример #32
0
 def _onResponseFailure(self, ids, args):
     if super(_EntityChatHandler, self)._onResponseFailure(ids, args):
         error = errors.createBroadcastError(args, self.__actions.broadcastID)
         if error:
             g_messengerEvents.onErrorReceived(error)
Пример #33
0
 def __onCommandInCooldown(self, chatAction):
     error = errors.CommandInCooldownError.create(chatAction)
     if error:
         g_messengerEvents.onErrorReceived(error)
Пример #34
0
 def __onActionFailure(self, chatAction):
     error = errors.ChatActionError.create(chatAction)
     if error:
         g_messengerEvents.onErrorReceived(error)
Пример #35
0
 def __handleMessageError(self, _, __, ___, pyGlooxTag):
     g_messengerEvents.onErrorReceived(createServerActionMessageError(CLIENT_ACTION_ID.SEND_MESSAGE, pyGlooxTag))
 def _notifyError(dbID, actionID, error, shadowMode=False):
     if shadowMode:
         g_messengerEvents.shadow.onActionFailed(dbID, actionID, error)
     else:
         g_messengerEvents.onErrorReceived(error)
Пример #37
0
 def moveFriendToGroup(self, dbID, add, exclude=None):
     result, error = self._proto.contacts.moveFriendToGroup(dbID, add, exclude)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #38
0
 def addIgnored(self, dbID, name):
     result, error = self.__xmppProto.contacts.addIgnored(dbID, name)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #39
0
 def setNote(self, dbID, note):
     result, error = self._proto.contacts.setNote(dbID, note)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #40
0
 def setMuted(self, dbID, name):
     result, error = self.__xmppProto.contacts.setMuted(dbID, name)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #41
0
def _showClientActionError(actionID, errorID=CLIENT_ERROR_ID.NOT_SUPPORTED):
    g_messengerEvents.onErrorReceived(ClientActionError(actionID, errorID))
Пример #42
0
 def sendChatMessage(self, jid, body):
     if self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE):
         g_messengerEvents.onErrorReceived(ChatCoolDownError(CLIENT_ACTION_ID.SEND_MESSAGE, MESSAGE_LIMIT.COOLDOWN))
         return
     self.__chatSessions.sendMessage(ContactBareJID(jid), body)
     self.__cooldown.process(CLIENT_ACTION_ID.SEND_MESSAGE)
Пример #43
0
 def addFriend(self, dbID, name, group = None):
     result, error = self.__xmppProto.contacts.addFriend(dbID, name, group)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #44
0
 def addFriend(self, dbID, name, group=None):
     result, error = self._proto.contacts.addFriend(dbID, name, group)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #45
0
 def unsetMuted(self, dbID):
     result, error = self.__xmppProto.contacts.unsetMuted(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #46
0
 def addTmpIgnored(self, dbID, name):
     result, error = self._proto.contacts.addTmpIgnored(dbID, name)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #47
0
 def renameGroup(self, oldName, newName):
     result, error = self.__xmppProto.contacts.renameGroup(oldName, newName)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #48
0
 def unsetMuted(self, dbID):
     result, error = self._proto.contacts.unsetMuted(dbID)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #49
0
 def moveFriendToGroup(self, dbID, add, exclude = None):
     result, error = self.__xmppProto.contacts.moveFriendToGroup(dbID, add, exclude)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #50
0
 def addGroup(self, name):
     result, error = self._proto.contacts.addGroup(name)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #51
0
 def setNote(self, dbID, note):
     result, error = self.__xmppProto.contacts.setNote(dbID, note)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #52
0
 def renameGroup(self, oldName, newName):
     result, error = self._proto.contacts.renameGroup(oldName, newName)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #53
0
def _showClientActionError(actionID, errorID = CLIENT_ERROR_ID.NOT_SUPPORTED):
    g_messengerEvents.onErrorReceived(ClientActionError(actionID, errorID))
Пример #54
0
 def removeGroup(self, name, isForced=False):
     result, error = self._proto.contacts.removeGroup(name, isForced)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #55
0
 def createUserRoom(self, name, password = ''):
     result, error = self._proto.messages.createUserRoom(name, password)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #56
0
 def wrapper(*args, **kwargs):
     if not self.sessionProvider.arenaVisitor.isArenaInWaiting():
         func(*args, **kwargs)
     else:
         g_messengerEvents.onErrorReceived(
             ClientError(CLIENT_ERROR_ID.WAITING_BEFORE_START))
Пример #57
0
 def joinToUserRoom(self, roomID, name, password = ''):
     result, error = self._proto.messages.joinToMUC(JID(roomID), password=password, name=name)
     if not result:
         g_messengerEvents.onErrorReceived(error)
     return result
Пример #58
0
 def wrapper(*args, **kwargs):
     if not isArenaInWaiting():
         func(*args, **kwargs)
     else:
         g_messengerEvents.onErrorReceived(
             ClientError(CLIENT_ERROR_ID.WAITING_BEFORE_START))