quick frontend(app): avoid sending empty messages
This commit is contained in:
parent
472a43597e
commit
3f1412f677
1 changed files with 6 additions and 22 deletions
|
|
@ -728,17 +728,11 @@ class QuickApp(object):
|
|||
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 @@ class QuickApp(object):
|
|||
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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue