diff options
Diffstat (limited to 'lisp/erc/erc-dcc.el')
-rw-r--r-- | lisp/erc/erc-dcc.el | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 2ca6a92b66f..8de00070583 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -54,9 +54,11 @@ ;;; Code: (require 'erc) -(eval-when-compile (require 'pcomplete)) +;; Strictly speaking, should only be needed at compile time. +;; Require at run-time too to silence compiler. +(require 'pcomplete) -;;;###autoload (autoload 'erc-dcc-mode "erc-dcc") +;;;###autoload(autoload 'erc-dcc-mode "erc-dcc") (define-erc-module dcc nil "Provide Direct Client-to-Client support for ERC." ((add-hook 'erc-server-401-functions 'erc-dcc-no-such-nick)) @@ -222,14 +224,6 @@ which is big-endian." (setq i (1- i))) str)) -(defconst erc-most-positive-int-bytes - (ceiling (/ (ceiling (/ (log most-positive-fixnum) (log 2))) 8.0)) - "Maximum number of bytes for a fixnum.") - -(defconst erc-most-positive-int-msb - (lsh most-positive-fixnum (- 0 (* 8 (1- erc-most-positive-int-bytes)))) - "Content of the most significant byte of most-positive-fixnum.") - (defun erc-unpack-int (str) "Unpack a packed string into an integer." (let ((len (length str))) @@ -240,16 +234,11 @@ which is big-endian." (when (> start 0) (setq str (substring str start)) (setq len (- len start)))) - ;; make sure size is not larger than Emacs can handle - (when (or (> len (min 4 erc-most-positive-int-bytes)) - (and (eq len erc-most-positive-int-bytes) - (> (aref str 0) erc-most-positive-int-msb))) - (error "ERC-DCC (erc-unpack-int): packet to send is too large")) ;; unpack (let ((num 0) (count 0)) (while (< count len) - (setq num (+ num (lsh (aref str (- len count 1)) (* 8 count)))) + (setq num (+ num (ash (aref str (- len count 1)) (* 8 count)))) (setq count (1+ count))) num))) @@ -649,9 +638,10 @@ that subcommand." "\"\\(\\(.*?\\(\\\\\"\\)?\\)+?\\)\"\\|\\([^ ]+\\)" "\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)")) -(defsubst erc-dcc-unquote-filename (filename) - (erc-replace-regexp-in-string "\\\\\\\\" "\\" - (erc-replace-regexp-in-string "\\\\\"" "\"" filename t t) t t)) +(define-inline erc-dcc-unquote-filename (filename) + (inline-quote + (erc-replace-regexp-in-string "\\\\\\\\" "\\" + (erc-replace-regexp-in-string "\\\\\"" "\"" ,filename t t) t t))) (defun erc-dcc-handle-ctcp-send (proc query nick login host to) "This is called if a CTCP DCC SEND subcommand is sent to the client. @@ -780,8 +770,8 @@ unconfirmed." :group 'erc-dcc :type '(choice (const nil) integer)) -(defsubst erc-dcc-get-parent (proc) - (plist-get (erc-dcc-member :peer proc) :parent)) +(define-inline erc-dcc-get-parent (proc) + (inline-quote (plist-get (erc-dcc-member :peer ,proc) :parent))) (defun erc-dcc-send-block (proc) "Send one block of data. @@ -1091,14 +1081,14 @@ Possible values are: ask, auto, ignore." (pcomplete-here '("auto" "ask" "ignore"))) (defalias 'pcomplete/erc-mode/SREQ 'pcomplete/erc-mode/CREQ) +(define-obsolete-variable-alias 'erc-dcc-chat-filter-hook + 'erc-dcc-chat-filter-functions "24.3") + (defvar erc-dcc-chat-filter-functions '(erc-dcc-chat-parse-output) "Abnormal hook run after parsing (and maybe inserting) a DCC message. Each function is called with two arguments: the ERC process and the unprocessed output.") -(define-obsolete-variable-alias 'erc-dcc-chat-filter-hook - 'erc-dcc-chat-filter-functions "24.3") - (defvar erc-dcc-chat-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "RET") 'erc-send-current-line) @@ -1257,5 +1247,6 @@ other client." ;;; erc-dcc.el ends here ;; ;; Local Variables: +;; generated-autoload-file: "erc-loaddefs.el" ;; indent-tabs-mode: nil ;; End: |