예제 #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)