diff options
Diffstat (limited to 'lisp/net')
| -rw-r--r-- | lisp/net/rcirc.el | 40 | ||||
| -rw-r--r-- | lisp/net/sasl.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 2 |
4 files changed, 30 insertions, 20 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 27cf50f06ca..dd345630b9b 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -802,26 +802,36 @@ With no argument or nil as argument, use the current buffer." (defvar rcirc-max-message-length 420 "Messages longer than this value will be split.") +(defun rcirc-split-message (message) + "Split MESSAGE into chunks within `rcirc-max-message-length'." + ;; `rcirc-encode-coding-system' can have buffer-local value. + (let ((encoding rcirc-encode-coding-system)) + (with-temp-buffer + (insert message) + (goto-char (point-min)) + (let (result) + (while (not (eobp)) + (goto-char (or (byte-to-position rcirc-max-message-length) + (point-max))) + ;; max message length is 512 including CRLF + (while (and (not (bobp)) + (> (length (encode-coding-region + (point-min) (point) encoding t)) + rcirc-max-message-length)) + (forward-char -1)) + (push (delete-and-extract-region (point-min) (point)) result)) + (nreverse result))))) + (defun rcirc-send-message (process target message &optional noticep silent) "Send TARGET associated with PROCESS a privmsg with text MESSAGE. If NOTICEP is non-nil, send a notice instead of privmsg. If SILENT is non-nil, do not print the message in any irc buffer." - ;; max message length is 512 including CRLF - (let* ((response (if noticep "NOTICE" "PRIVMSG")) - (oversize (> (length message) rcirc-max-message-length)) - (text (if oversize - (substring message 0 rcirc-max-message-length) - message)) - (text (if (string= text "") - " " - text)) - (more (if oversize - (substring message rcirc-max-message-length)))) + (let ((response (if noticep "NOTICE" "PRIVMSG"))) (rcirc-get-buffer-create process target) - (rcirc-send-string process (concat response " " target " :" text)) - (unless silent - (rcirc-print process (rcirc-nick process) response target text)) - (when more (rcirc-send-message process target more noticep)))) + (dolist (msg (rcirc-split-message message)) + (rcirc-send-string process (concat response " " target " :" msg)) + (unless silent + (rcirc-print process (rcirc-nick process) response target msg))))) (defvar rcirc-input-ring nil) (defvar rcirc-input-ring-index 0) diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el index c6e95970f3d..4e759a4e6b2 100644 --- a/lisp/net/sasl.el +++ b/lisp/net/sasl.el @@ -183,7 +183,7 @@ It contain at least 64 bits of entropy." ;; Don't use microseconds from (current-time), they may be unsupported. ;; Instead we use this randomly inited counter. (setq sasl-unique-id-char - (% (1+ (or sasl-unique-id-char (logand (random t) (1- (lsh 1 20))))) + (% (1+ (or sasl-unique-id-char (logand (random) (1- (lsh 1 20))))) ;; (current-time) returns 16-bit ints, ;; and 2^16*25 just fits into 4 digits i base 36. (* 25 25))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 6283188d46a..2c1af3e83fa 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -512,9 +512,9 @@ detected as prompt when being sent on echoing hosts, therefore.") ;; IRIX64: /usr/bin ;;;###tramp-autoload (defcustom tramp-remote-path - '(tramp-default-remote-path "/bin" "/usr/bin" "/usr/sbin" - "/usr/local/bin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" - "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" + '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" + "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" + "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin") "List of directories to search for executables on remote host. For every remote host, this variable will be set buffer local, diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 848599104c5..a17bbfa0d14 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3293,7 +3293,7 @@ for process communication also." ;; Under Windows XP, accept-process-output doesn't return ;; sometimes. So we add an additional timeout. (with-timeout ((or timeout 1)) - (accept-process-output proc timeout timeout-msecs))) + (accept-process-output proc timeout timeout-msecs (and proc t)))) (tramp-message proc 10 "\n%s" (buffer-string)))) (defun tramp-check-for-regexp (proc regexp) |
