From 0a3bf6fcd92a52e8b3988f470fbf73a03a391739 Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 22 Oct 2021 14:21:16 +0200 Subject: don't allow posts longer than server's max_toot_chars length --- lisp/mastodon-toot.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index d4068ea..0153c9b 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -401,13 +401,15 @@ If media items have been uploaded with `mastodon-toot--add-media-attachment', at (if (and mastodon-toot--media-attachments (equal mastodon-toot--media-attachment-ids nil)) (message "Looks like your uploads are not up: C-c C-u to upload...") - (if empty-toot-p - (message "Empty toot. Cowardly refusing to post this.") - (let ((response (mastodon-http--post endpoint args nil))) - (mastodon-http--triage response - (lambda () - (mastodon-toot--kill) - (message "Toot toot!")))))))) + (if (> (length toot) (string-to-number mastodon-toot--max-toot-chars)) + (message "Looks like your toot is longer than that maximum allowed length.") + (if empty-toot-p + (message "Empty toot. Cowardly refusing to post this.") + (let ((response (mastodon-http--post endpoint args nil))) + (mastodon-http--triage response + (lambda () + (mastodon-toot--kill) + (message "Toot toot!"))))))))) (defun mastodon-toot--process-local (acct) "Add domain to local ACCT and replace the curent user name with \"\". -- cgit v1.2.3