Commit 85bc3896 authored by Philipp Hörist's avatar Philipp Hörist

Handle messages without 'to' correctly

parent 7ac81552
......@@ -73,7 +73,7 @@ def parse_carbon(con, stanza):
type_ = carbon.getName()
to = message.getTo()
frm = message.getFrom()'Received type: %s, from: %s, to: %s', type_, to, frm)'Received type: %s, from: %s', type_, frm)
if type_ == 'received':
sent = False
......@@ -58,6 +58,23 @@ def __init__(self, con):
def _message_received(self, con, stanza):
# If the stanza does not include a 'to' address then the client MUST
# treat it as if the 'to' address were included with a value of the
# client's full JID.
# Implementation Note: However, if the client does
# check the 'to' address then it is suggested to check at most the
# bare JID portion (not the full JID)
own_jid = self._con.get_own_jid().getStripped()
to = stanza.getTo()
if to is None:
elif not to.bareMatch(own_jid):
log.warning('Message addressed to someone else: %s', stanza)
raise nbxmpp.NodeProcessed
# Check if a child of the message contains any
# namespaces that we handle in other modules.
# nbxmpp executes less common handlers last
......@@ -118,7 +135,7 @@ def _message_received(self, con, stanza):
if type_ == 'groupchat':
archive_jid = stanza.getFrom().getStripped()
archive_jid = self._con.get_own_jid().getStripped()
archive_jid = own_jid
if app.logger.find_stanza_id(self._account,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment