예제 #1
0
 def parseTag(self, pyGlooxTag):
     message = ChatMessage()
     message.state = self._getChildData(pyGlooxTag, 0, ChatStateExtension.getDefaultData())
     info = self._getChildData(pyGlooxTag, 1, MessageWgSharedExtension.getDefaultData())
     if info:
         message.accountDBID = info['dbID']
         message.accountName = info['name']
         message.accountRole = info['role']
         message.accountAffiliation = info['affiliation']
     message.sentAt = self._getChildData(pyGlooxTag, 2, DelayExtension.getDefaultData())
     message.uuid = self._getChildData(pyGlooxTag, 3, MessageIDExtension.getDefaultData())
     message.requestID, message.isFinalInHistory = self._getChildData(pyGlooxTag, 4, PrivateHistoryItem.getDefaultData())
     return message
예제 #2
0
 def sendMessage(self, jid, body, filters):
     channel = self.channelsStorage.getChannel(
         entities.XMPPChatChannelEntity(jid))
     if channel:
         if self.playerCtx.isBanned(components=XMPP_BAN_COMPONENT.PRIVATE):
             error = createChatBanError(self.playerCtx.getBanInfo())
             if error:
                 g_messengerEvents.onErrorReceived(error)
                 return
         dbID = getPlayerDatabaseID()
         name = getPlayerName()
         g_messengerEvents.channels.onMessageReceived(
             ChatMessage(dbID, name, filters.chainIn(dbID, body),
                         time.time()), channel)
         self.client().sendMessage(ChatMessageHolder(jid, msgBody=body))
예제 #3
0
 def getDefaultData(self):
     return ChatMessage()
 def _repeatMessage(self, channel, body, filters):
     dbID = utils.getPlayerDatabaseID()
     name = utils.getPlayerName()
     g_messengerEvents.channels.onMessageReceived(ChatMessage(dbID, name, filters.chainIn(dbID, body), time.time()), channel)
예제 #5
0
 def getDefaultData(cls):
     return ChatMessage()