From 5cc92efcb61118e62e3b2f3ac6aca47a575a0f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 27 Mar 2017 20:35:14 +0200 Subject: [PATCH] Drop messages from invalid JIDs silently --- src/common/connection_handlers_events.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py index d0e6bfc9e..18e71b393 100644 --- a/src/common/connection_handlers_events.py +++ b/src/common/connection_handlers_events.py @@ -1150,10 +1150,8 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): try: self.get_jid_resource() except helpers.InvalidFormat: - gajim.nec.push_incoming_event(InformationEvent(None, conn=self.conn, - level='error', pri_txt=_('Invalid JID'), - sec_txt=_('A message from a non-valid JID arrived, it has been ' - 'ignored.'))) + log.warning('Invalid JID: %s, ignoring it', + self.stanza.getFrom()) return address_tag = self.stanza.getTag('addresses', @@ -1165,8 +1163,8 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): try: self.fjid = helpers.parse_jid(address.getAttr('jid')) except helpers.InvalidFormat: - log.warning('Invalid JID: %s, ignoring it' % address.getAttr( - 'jid')) + log.warning('Invalid JID: %s, ignoring it', + address.getAttr('jid')) return self.jid = gajim.get_jid_without_resource(self.fjid) @@ -1195,11 +1193,8 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): try: self.get_jid_resource() except helpers.InvalidFormat: - gajim.nec.push_incoming_event(InformationEvent(None, - conn=self.conn, level='error', - pri_txt=_('Invalid JID'), - sec_txt=_('A message from a non-valid JID arrived, it ' - 'has been ignored.'))) + log.warning('Invalid JID: %s, ignoring it', + self.stanza.getFrom()) return self.forwarded = True