def addMessage(self, jid, message): if message.isHistory(): self.__historyRQ.addHistory(message) return else: contactDBID = message.accountDBID or jid.getDatabaseID() nickname = message.accountName or jid.getNode() created, exists = self._searchChannel(jid, nickname) if exists is None and g_settings.userPrefs.chatContactsListOnly: contact = self.usersStorage.getUser(contactDBID) if not contact or not USER_TAG.filterClosedContactsTags( contact.getTags()): g_logOutput.debug( CLIENT_LOG_AREA.MESSAGE, "There is not closed contact in player's contacts list,contact's message is ignored", jid, nickname) return if exists is None: if self.__addSession(created, contactDBID): exists = created else: return if message.body: g_messengerEvents.channels.onMessageReceived(message, exists) return
def addMessage(self, jid, message): if message.isHistory(): self.__historyRQ.addHistory(message) return dbID = message.accountDBID name = message.accountName if jid not in self.__sessions and g_settings.userPrefs.chatContactsListOnly: contact = self.usersStorage.getUser(dbID) if not contact or not USER_TAG.filterClosedContactsTags(contact.getTags()): g_logOutput.debug( CLIENT_LOG_AREA.MESSAGE, "There is not closed contact in player's contacts list,contact's message is ignored", jid, name, ) return search = entities.XMPPChatChannelEntity(jid, name) channel = self.channelsStorage.getChannel(search) if not channel: channel = self._addChannel(search, dbID, name) if not channel: return self.__sessions.add(jid) if message.body: g_messengerEvents.channels.onMessageReceived(message, channel)
def hasUntrustedMembers(self): getter = self.usersStorage.getUser for member in self._channel.getMembers(): user = getter(member.getID().getDatabaseID()) if user is None: return True if user.isCurrentPlayer(): continue if not USER_TAG.filterClosedContactsTags(user.getTags()): return True return False
def onMessageReceived(self, jid, body, _, info, sentAt): dbID = info['dbID'] name = info['name'] if jid not in self.__sessions and g_settings.userPrefs.chatContactsListOnly: contact = self.usersStorage.getUser(dbID) if not contact or not USER_TAG.filterClosedContactsTags(contact.getTags()): g_logOutput.debug(CLIENT_LOG_AREA.MESSAGE, "There is not closed contact in player's contacts list,contact's massage is ignored", jid, name) return search = entities.XMPPChatChannelEntity(jid, name) channel = self.channelsStorage.getChannel(search) if not channel: channel = self._addChannel(search, dbID, name, True) if not channel: return self.__sessions.add(jid) if body: g_messengerEvents.channels.onMessageReceived(XMPPMessageData(dbID, name, body, sentAt), channel)
def addMessage(self, jid, message): if message.isHistory(): self.__historyRQ.addHistory(message) return else: contactDBID = message.accountDBID or jid.getDatabaseID() nickname = message.accountName or jid.getNode() created, exists = self._searchChannel(jid, nickname) if exists is None and g_settings.userPrefs.chatContactsListOnly: contact = self.usersStorage.getUser(contactDBID) if not contact or not USER_TAG.filterClosedContactsTags(contact.getTags()): g_logOutput.debug(CLIENT_LOG_AREA.MESSAGE, "There is not closed contact in player's contacts list,contact's message is ignored", jid, nickname) return if exists is None: if self.__addSession(created, contactDBID): exists = created else: return if message.body: g_messengerEvents.channels.onMessageReceived(message, exists) return
def addMessage(self, jid, message): if message.isHistory(): self.__historyRQ.addHistory(message) return dbID = message.accountDBID name = message.accountName if jid not in self.__sessions and g_settings.userPrefs.chatContactsListOnly: contact = self.usersStorage.getUser(dbID) if not contact or not USER_TAG.filterClosedContactsTags( contact.getTags()): g_logOutput.debug( CLIENT_LOG_AREA.MESSAGE, "There is not closed contact in player's contacts list,contact's message is ignored", jid, name) return search = entities.XMPPChatChannelEntity(jid, name) channel = self.channelsStorage.getChannel(search) if not channel: channel = self._addChannel(search, dbID, name) if not channel: return self.__sessions.add(jid) if message.body: g_messengerEvents.channels.onMessageReceived(message, channel)