From 4bd304ce369cb70b20a3efd6f909137478efaaff Mon Sep 17 00:00:00 2001 From: defanor Date: Fri, 17 Sep 2021 00:04:42 +0300 Subject: Don't accept empty input in xmpp.el --- emacs/xmpp.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/emacs/xmpp.el b/emacs/xmpp.el index 6966b36..c2c5af8 100644 --- a/emacs/xmpp.el +++ b/emacs/xmpp.el @@ -471,21 +471,22 @@ (defun xmpp-send-input () (interactive) (let ((input (buffer-substring xmpp-prompt-end-marker (point-max)))) - (pcase major-mode - ('xmpp-query-mode (xmpp-send `(message ((xmlns . "jabber:client") + (unless (string-empty-p input) + (pcase major-mode + ('xmpp-query-mode (xmpp-send `(message ((xmlns . "jabber:client") + (id . ,(xmpp-gen-id)) + (to . ,xmpp-jid) + (type . "chat")) + (body nil ,input)))) + ('xmpp-muc-mode (xmpp-send `(message ((xmlns . "jabber:client") (id . ,(xmpp-gen-id)) (to . ,xmpp-jid) - (type . "chat")) + (type . "groupchat")) (body nil ,input)))) - ('xmpp-muc-mode (xmpp-send `(message ((xmlns . "jabber:client") - (id . ,(xmpp-gen-id)) - (to . ,xmpp-jid) - (type . "groupchat")) - (body nil ,input)))) - ('xmpp-console-mode (xmpp-request `(console nil ,input) nil xmpp-proc)) - ('xmpp-xml-mode - (mapcar 'xmpp-send (xml-parse-region xmpp-prompt-end-marker (point-max)))))) - (delete-region xmpp-prompt-end-marker (point-max))) + ('xmpp-console-mode (xmpp-request `(console nil ,input) nil xmpp-proc)) + ('xmpp-xml-mode + (mapcar 'xmpp-send (xml-parse-region xmpp-prompt-end-marker (point-max)))))) + (delete-region xmpp-prompt-end-marker (point-max)))) (defvar xmpp-mode-map -- cgit v1.2.3