コード例 #1
0
ファイル: xmpp.py プロジェクト: revcozmo/err
 def incoming_message(self, xmppmsg):
     """Callback for message events"""
     msg = Message(xmppmsg['body'])
     if 'html' in xmppmsg.keys():
         msg.html = xmppmsg['html']
     msg.frm = xmppmsg['from'].full
     msg.to = xmppmsg['to'].full
     msg.type = xmppmsg['type']
     msg.nick = xmppmsg['mucnick']
     msg.delayed = bool(xmppmsg['delay']._get_attr('stamp'))  # this is a bug in sleekxmpp it should be ['from']
     self.callback_message(msg)
コード例 #2
0
ファイル: xmpp.py プロジェクト: Cloudxtreme/err
 def incoming_message(self, xmppmsg):
     """Callback for message events"""
     msg = Message(xmppmsg['body'])
     if 'html' in xmppmsg.keys():
         msg.html = xmppmsg['html']
     msg.frm = xmppmsg['from'].full
     msg.to = xmppmsg['to'].full
     msg.type = xmppmsg['type']
     msg.nick = xmppmsg['mucnick']
     msg.delayed = bool(xmppmsg['delay']._get_attr('stamp'))  # this is a bug in sleekxmpp it should be ['from']
     self.callback_message(msg)
コード例 #3
0
ファイル: xmpp.py プロジェクト: nicolas33/errbot
    def incoming_message(self, xmppmsg):
        """Callback for message events"""
        msg = Message(xmppmsg['body'])
        if 'html' in xmppmsg.keys():
            msg.html = xmppmsg['html']
        msg.frm = self.build_identifier(xmppmsg['from'].full)
        msg.to = self.build_identifier(xmppmsg['to'].full)
        log.debug("incoming_message frm : %s" % msg.frm)
        if xmppmsg['type'] == 'groupchat':
            room = XMPPRoom(msg.frm.node + '@' + msg.frm.domain, self)
            msg.frm = XMPPRoomOccupant(msg.frm.node, msg.frm.domain, msg.frm.resource, room)
            msg.to = room

        msg.nick = xmppmsg['mucnick']
        msg.delayed = bool(xmppmsg['delay']._get_attr('stamp'))  # this is a bug in sleekxmpp it should be ['from']
        self.callback_message(msg)
コード例 #4
0
ファイル: xmpp.py プロジェクト: bolshoibooze/err
 def incoming_message(self, xmppmsg):
     """Callback for message events"""
     msg = Message(xmppmsg['body'])
     if 'html' in xmppmsg.keys():
         msg.html = xmppmsg['html']
     msg.frm = self.build_identifier(xmppmsg['from'].full)
     msg.to = self.build_identifier(xmppmsg['to'].full)
     log.debug("incoming_message frm : %s" % msg.frm)
     log.debug("incoming_message frm node: %s" % msg.frm.node)
     log.debug("incoming_message frm domain: %s" % msg.frm.domain)
     log.debug("incoming_message frm resource: %s" % msg.frm.resource)
     msg.type = xmppmsg['type']
     if msg.type == 'groupchat':
         # those are not simple identifiers, they are muc occupants.
         msg.frm = XMPPMUCOccupant(msg.frm.node, msg.frm.domain, msg.frm.resource)
         msg.to = XMPPMUCOccupant(msg.to.node, msg.to.domain, msg.to.resource)
     msg.nick = xmppmsg['mucnick']
     msg.delayed = bool(xmppmsg['delay']._get_attr('stamp'))  # this is a bug in sleekxmpp it should be ['from']
     self.callback_message(msg)
コード例 #5
0
ファイル: xmpp.py プロジェクト: Kelur/errbot
 def incoming_message(self, xmppmsg):
     """Callback for message events"""
     msg = Message(xmppmsg["body"])
     if "html" in xmppmsg.keys():
         msg.html = xmppmsg["html"]
     msg.frm = self.build_identifier(xmppmsg["from"].full)
     msg.to = self.build_identifier(xmppmsg["to"].full)
     log.debug("incoming_message frm : %s" % msg.frm)
     log.debug("incoming_message frm node: %s" % msg.frm.node)
     log.debug("incoming_message frm domain: %s" % msg.frm.domain)
     log.debug("incoming_message frm resource: %s" % msg.frm.resource)
     msg.type = xmppmsg["type"]
     if msg.type == "groupchat":
         # those are not simple identifiers, they are muc occupants.
         msg.frm = XMPPMUCOccupant(msg.frm.node, msg.frm.domain, msg.frm.resource)
         msg.to = XMPPMUCOccupant(msg.to.node, msg.to.domain, msg.to.resource)
     msg.nick = xmppmsg["mucnick"]
     msg.delayed = bool(xmppmsg["delay"]._get_attr("stamp"))  # this is a bug in sleekxmpp it should be ['from']
     self.callback_message(msg)
コード例 #6
0
ファイル: xmpp.py プロジェクト: garmann/errbot
    def incoming_message(self, xmppmsg):
        """Callback for message events"""
        if xmppmsg['type'] == "error":
            log.warning("Received error message: %s", xmppmsg)
            return

        msg = Message(xmppmsg['body'])
        if 'html' in xmppmsg.keys():
            msg.html = xmppmsg['html']
        log.debug("incoming_message from: %s", msg.frm)
        if xmppmsg['type'] == 'groupchat':
            msg.frm = self._build_room_occupant(xmppmsg['from'].full)
            msg.to = msg.frm.room
        else:
            msg.frm = self._build_person(xmppmsg['from'].full)
            msg.to = self._build_person(xmppmsg['to'].full)

        msg.nick = xmppmsg['mucnick']
        msg.delayed = bool(xmppmsg['delay']._get_attr('stamp'))  # this is a bug in sleekxmpp it should be ['from']
        self.callback_message(msg)
コード例 #7
0
ファイル: xmpp.py プロジェクト: tynril/errbot
    def incoming_message(self, xmppmsg):
        """Callback for message events"""
        if xmppmsg['type'] == "error":
            log.warning("Received error message: %s", xmppmsg)
            return

        msg = Message(xmppmsg['body'])
        if 'html' in xmppmsg.keys():
            msg.html = xmppmsg['html']
        log.debug("incoming_message from: %s", msg.frm)
        if xmppmsg['type'] == 'groupchat':
            msg.frm = self._build_room_occupant(xmppmsg['from'].full)
            msg.to = msg.frm.room
        else:
            msg.frm = self._build_person(xmppmsg['from'].full)
            msg.to = self._build_person(xmppmsg['to'].full)

        msg.nick = xmppmsg['mucnick']
        msg.delayed = bool(xmppmsg['delay']._get_attr(
            'stamp'))  # this is a bug in sleekxmpp it should be ['from']
        self.callback_message(msg)
コード例 #8
0
ファイル: xmpp.py プロジェクト: e4r7hbug/errbot
    def incoming_message(self, xmppmsg):
        """Callback for message events"""
        if xmppmsg["type"] == "error":
            log.warning("Received error message: %s", xmppmsg)
            return

        msg = Message(xmppmsg["body"])
        if "html" in xmppmsg.keys():
            msg.html = xmppmsg["html"]
        log.debug("incoming_message from: %s", msg.frm)
        if xmppmsg["type"] == "groupchat":
            msg.frm = self._build_room_occupant(xmppmsg["from"].full)
            msg.to = msg.frm.room
        else:
            msg.frm = self._build_person(xmppmsg["from"].full)
            msg.to = self._build_person(xmppmsg["to"].full)

        msg.nick = xmppmsg["mucnick"]
        msg.delayed = bool(xmppmsg["delay"]._get_attr(
            "stamp"))  # this is a bug in slixmpp it should be ['from']
        self.callback_message(msg)
コード例 #9
0
 def incoming_message(self, xmppmsg):
     """Callback for message events"""
     msg = Message(xmppmsg['body'])
     if 'html' in xmppmsg.keys():
         msg.html = xmppmsg['html']
     msg.frm = self.build_identifier(xmppmsg['from'].full)
     msg.to = self.build_identifier(xmppmsg['to'].full)
     log.debug("incoming_message frm : %s" % msg.frm)
     log.debug("incoming_message frm node: %s" % msg.frm.node)
     log.debug("incoming_message frm domain: %s" % msg.frm.domain)
     log.debug("incoming_message frm resource: %s" % msg.frm.resource)
     msg.type = xmppmsg['type']
     if msg.type == 'groupchat':
         # those are not simple identifiers, they are muc occupants.
         msg.frm = XMPPMUCOccupant(msg.frm.node, msg.frm.domain,
                                   msg.frm.resource)
         msg.to = XMPPMUCOccupant(msg.to.node, msg.to.domain,
                                  msg.to.resource)
     msg.nick = xmppmsg['mucnick']
     msg.delayed = bool(xmppmsg['delay']._get_attr(
         'stamp'))  # this is a bug in sleekxmpp it should be ['from']
     self.callback_message(msg)
コード例 #10
0
    def incoming_message(self, xmppmsg):
        """Callback for message events"""
        if xmppmsg['type'] == "error":
            log.warning("Received error message: %s", xmppmsg)
            return

        msg = Message(xmppmsg['body'])
        if 'html' in xmppmsg.keys():
            msg.html = xmppmsg['html']
        msg.frm = self.build_identifier(xmppmsg['from'].full)
        msg.to = self.build_identifier(xmppmsg['to'].full)
        log.debug("incoming_message from: %s", msg.frm)
        if xmppmsg['type'] == 'groupchat':
            room = self.room_factory(msg.frm.node + '@' + msg.frm.domain, self)
            msg.frm = self.roomoccupant_factory(msg.frm.node, msg.frm.domain,
                                                msg.frm.resource, room)
            msg.to = room

        msg.nick = xmppmsg['mucnick']
        msg.delayed = bool(xmppmsg['delay']._get_attr(
            'stamp'))  # this is a bug in sleekxmpp it should be ['from']
        self.callback_message(msg)
コード例 #11
0
    def incoming_message(self, xmppmsg: dict) -> None:
        """Callback for message events"""
        if xmppmsg["type"] == "error":
            log.warning("Received error message: %s", xmppmsg)
            return

        msg = Message(xmppmsg["body"])
        if "html" in xmppmsg.keys():
            msg.html = xmppmsg["html"]
        log.debug("incoming_message from: %s", msg.frm)
        if xmppmsg["type"] == "groupchat":
            msg.frm = self._build_room_occupant(xmppmsg["from"].full)
            msg.to = msg.frm.room
        else:
            msg.frm = self._build_person(xmppmsg["from"].full)
            msg.to = self._build_person(xmppmsg["to"].full)

        msg.nick = xmppmsg["mucnick"]
        now = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
        delay = xmppmsg["delay"]._get_attr(
            "stamp")  # this is a bug in sleekxmpp it should be ['from']
        msg.delayed = bool(delay and delay != now)
        self.callback_message(msg)