@xmpp.stanza('message')
    def message(self, elem):
        """Proxy message from one user to another"""

        # so, possible:
        # XMPP user -> Old user
        # XMPP user -> XMPP user => make it like XMPP->old

        # Old user -> XMPP user (emulated) => handled elsewhere

        to_jid = elem.get('to')
        from_jid = elem.get('from')
        if (from_jid == None):
            return

#       self.recv(to_jid, elem)

        text_body = None
        for child in elem:
            if (child.tag.endswith('}body')):
                text_body = child.text
        if (text_body == None):
            return

        ret = self.rosters.send_msg(from_jid, to_jid, text_body)
        if (ret <= 0):
            Log.warn("sendmsg() failed to %s from %s error %d" % (to_jid, from_jid, ret))
            errors = { 
                    -1 : "That user has locked screen, please send later.",
                    -11: "That user denied your message.",
                    -12: "That user has too many unread messages. Please send later.",
                    -13: "User has gone after message sent.",
                    -14: "User has gone before message sent.",
                    -2 : "User has gone before message sent.",
                    -21: "Error when sending message!"}
            if (errors in ret):
                elem = self.E.message({'from': to_jid,
                    'to': from_jid,
                    'type': 'error'},
                    self.E.body(errors[ret]))
                self.recv(from_jid, elem)
            # -2: no perm to see cloak
            # 0: error
            # -1: lockscreen
            # -11: blocked
            # -12: too many messages
            # -13: user gone when notifying
            # -14: user gone before saving
            # -21: error when saving message
dataset/ETHPy150Open HenryHu/pybbs/xmppserver.py/XMPPServer.message/swapped operands of `in`