Add more log output in case we drop carbons

This commit is contained in:
Philipp Hörist 2017-09-03 22:35:56 +02:00
parent 6bb822f884
commit 8bc2ab096e
2 changed files with 6 additions and 4 deletions

View File

@ -741,7 +741,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def check_jid(self, jid):
return helpers.parse_jid(jid)
def get_own_jid(self):
def get_own_jid(self, warn=False):
"""
Return the last full JID we received on a bind event.
In case we were never connected it returns the bare JID from config.
@ -750,6 +750,8 @@ class Connection(CommonConnection, ConnectionHandlers):
# This returns the full jid we received on the bind event
return self.registered_name
else:
if warn:
log.warning('only bare JID available')
# This returns the bare jid
return nbxmpp.JID(app.get_jid_from_account(self.name))

View File

@ -1156,12 +1156,12 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
self.encrypted = False
account = self.conn.name
if self.stanza.getFrom() == self.conn.get_own_jid():
if self.stanza.getFrom() == self.conn.get_own_jid(warn=True):
# Drop messages sent from our own full jid
# It can happen that when we sent message to our own bare jid
# that the server routes that message back to us
log.info('Received message from self: %s, message is dropped'
% self.stanza.getFrom())
log.info('Received message from self: %s, message is dropped',
self.stanza.getFrom())
return
# check if the message is a roster item exchange (XEP-0144)