Philipp Hörist pushed to branch gajim_0.16 at gajim / gajim

Commits:
a6cb7230 by Philipp Hörist at 2017-03-27T18:46:23+02:00
Drop messages from invalid JIDs silently

- - - - -


1 changed file:

- src/common/connection_handlers_events.py


Changes:

=====================================
src/common/connection_handlers_events.py
=====================================
--- a/src/common/connection_handlers_events.py
+++ b/src/common/connection_handlers_events.py
@@ -1144,10 +1144,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 Jabber ID'),
-                sec_txt=_('A message from a non-valid JID arrived, it has been 
'
-                'ignored.')))
+            log.warn('Invalid JID: %s, ignoring it' %
+                     self.stanza.getFrom())
             return
 
         address_tag = self.stanza.getTag('addresses',
@@ -1159,8 +1157,8 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, 
HelperEvent):
                 try:
                     self.fjid = helpers.parse_jid(address.getAttr('jid'))
                 except helpers.InvalidFormat:
-                    log.warn('Invalid JID: %s, ignoring it' % address.getAttr(
-                        'jid'))
+                    log.warn('Invalid JID: %s, ignoring it' %
+                             address.getAttr('jid'))
                     return
                 self.jid = gajim.get_jid_without_resource(self.fjid)
 
@@ -1189,11 +1187,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 Jabber ID'),
-                        sec_txt=_('A message from a non-valid JID arrived, it '
-                        'has been ignored.')))
+                    log.warn('Invalid JID: %s, ignoring it' %
+                             self.stanza.getFrom())
                     return
                 self.forwarded = True
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/a6cb72301c5461e7f3930565198e124d5a7e3c54
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to