def __onChannelInfoUpdated(self, chatAction):
     result = chatAction['data'] if chatAction.has_key('data') else {}
     received = entities.BWChannelEntity(result)
     channel = self.channelsStorage.getChannel(received)
     if channel:
         channel.update(other=received)
         g_messengerEvents.channels.onChannelInfoUpdated(channel)
Example #2
0
    def __onRequestChannels(self, chatAction, join=False):
        chatActionDict = dict(chatAction)
        data = chatActionDict.get('data', [])
        requestID = chatActionDict.get('requestID', -1)
        channels = set()
        isStore = requestID == -1
        for channelData in data:
            received = entities.BWChannelEntity(dict(channelData))
            channel = self.channelsStorage.getChannel(received)
            if channel:
                channel.update(other=received)
                if not isStore:
                    self.__channels[received.getID()] = received
            else:
                if isStore:
                    if self.channelsStorage.addChannel(received):
                        g_messengerEvents.channels.onChannelInited(received)
                else:
                    self.__channels[received.getID()] = received
                channel = received
            channels.add(channel)
            if join:
                self.joinToChannel(channel.getID())

        self.onRequestChannelsComplete(requestID, channels)
    def __onRequestChannels(self, chatAction, join=False):
        chatActionDict = dict(chatAction)
        data = chatActionDict.get('data', [])
        requestID = chatActionDict.get('requestID', -1)
        channels = set()
        isStore = requestID == -1
        isMucEnabled = g_settings.server.isUserRoomsEnabled(PROTO_TYPE.XMPP)
        for channelData in data:
            received = entities.BWChannelEntity(dict(channelData))
            if isMucEnabled and not received.isSystem(
            ) and not received.isLazy() and not received.isPrivate(
            ) and not received.isClan():
                g_logOutput.error(
                    CLIENT_LOG_AREA.OBSOLETE,
                    'Game server sends BW channel on which player is joined, but MUC are enabled. BW channel is ignored',
                    received)
                continue
            channel = self.channelsStorage.getChannel(received)
            if channel:
                channel.update(other=received)
                if not isStore:
                    self.__channels[received.getID()] = received
            else:
                if isStore:
                    if self.channelsStorage.addChannel(received):
                        g_messengerEvents.channels.onChannelInited(received)
                else:
                    self.__channels[received.getID()] = received
                channel = received
            channels.add(channel)
            if join:
                self.joinToChannel(channel.getID())

        self.onRequestChannelsComplete(requestID, channels)
Example #4
0
 def __onChatChannelCreated(self, chatAction):
     result = chatAction['data'] if chatAction.has_key('data') else {}
     created = entities.BWChannelEntity(dict(result))
     channel = self.channelsStorage.getChannel(created)
     if channel is None:
         self.__channels[created.getID()] = created
         password = None
         name = created.getName()
         if name in self.__creationInfo:
             password = self.__creationInfo.pop(name)
         self.joinToChannel(created.getID(), password=password)