def joinToChannel(self, channelID, password=None): channel = self.channelsStorage.getChannel( entities.BWChannelLightEntity(channelID)) if not channel and channelID in self.__channels: channel = self.__channels[channelID] if not channel: raise ChannelNotFound(channelID) if channel.isJoined(): g_messengerEvents.channels.onPlayerEnterChannelByAction(channel) return if channel and channel.getProtoData().isSecured and not password: g_messengerEvents.channels.onConnectingToSecureChannel(channel) return BigWorld.player().enterChat(channelID, password)
def __onSelfEnterChat(self, chatAction): wrapper = ChatActionWrapper(**dict(chatAction)) channelID = wrapper.channel channel = self.channelsStorage.getChannel( entities.BWChannelLightEntity(channelID)) if not channel and channelID in self.__channels: channel = self.__channels[channelID] if self.channelsStorage.addChannel(channel): g_messengerEvents.channels.onChannelInited(channel) g_messengerEvents.channels.onPlayerEnterChannelByAction( channel) if not channel: raise ChannelNotFound(channelID) if not channel.isJoined(): channel.setJoined(True) g_messengerEvents.channels.onConnectStateChanged(channel) self.requestChannelMembers(channelID) else: channel.clearHistory()
def __onSelfEnterChat(self, chatAction): wrapper = ChatActionWrapper(**dict(chatAction)) channelID = wrapper.channel channel = self.channelsStorage.getChannel(entities.BWChannelLightEntity(channelID)) isJoinAction = False if not channel and channelID in self.__channels: channel = self.__channels[channelID] if self.channelsStorage.addChannel(channel): g_messengerEvents.channels.onChannelInited(channel) g_messengerEvents.channels.onPlayerEnterChannelByAction(channel) isJoinAction = True if not channel: raise ChannelNotFound(channelID) name = channel.getName() if not isJoinAction and name in self.__creationInfo and channel.getProtoData().owner == getPlayerDatabaseID(): self.__creationInfo.pop(name) g_messengerEvents.channels.onPlayerEnterChannelByAction(channel) if not channel.isJoined(): channel.setJoined(True) g_messengerEvents.channels.onConnectStateChanged(channel) self.requestChannelMembers(channelID) else: channel.clearHistory()