# HG changeset patch # User Goffi # Date 1551458548 -3600 # Node ID 649cb3fd7711026e3ac0123314ebcdddc5cefc87 # Parent 08b54bf77c5419a6289426190061208c4548b6d5 quick frontend(app): avoid sending empty messages diff -r 08b54bf77c54 -r 649cb3fd7711 sat_frontends/quick_frontend/quick_app.py --- a/sat_frontends/quick_frontend/quick_app.py Fri Mar 01 17:33:15 2019 +0100 +++ b/sat_frontends/quick_frontend/quick_app.py Fri Mar 01 17:42:28 2019 +0100 @@ -728,17 +728,11 @@ for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)): widget.onMessageState(uid, status, profile) - def messageSend( - self, - to_jid, - message, - subject=None, - mess_type="auto", - extra=None, - callback=None, - errback=None, - profile_key=C.PROF_KEY_NONE, - ): + def messageSend(self, to_jid, message, subject=None, mess_type="auto", extra=None, callback=None, errback=None, profile_key=C.PROF_KEY_NONE): + if not subject and not extra and (not message or message == {u'': u''}): + log.debug(u"Not sending empty message") + return + if subject is None: subject = {} if extra is None: @@ -753,17 +747,7 @@ failure.fullname, failure.message, "error" ) - if not self.trigger.point( - "messageSendTrigger", - to_jid, - message, - subject, - mess_type, - extra, - callback, - errback, - profile_key=profile_key, - ): + if not self.trigger.point("messageSendTrigger", to_jid, message, subject, mess_type, extra, callback, errback, profile_key=profile_key): return self.bridge.messageSend(