From 3776cb8dcb093ddfd1c5a1afcfd61fca0542d3aa Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 22 Oct 2003 08:32:57 +0000 Subject: [PATCH] * riece-rdcc.el (riece-rdcc-format-size): New function. (riece-handle-dcc-request): Use it. --- lisp/ChangeLog | 3 +++ lisp/riece-rdcc.el | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8dc0a98..eeebf5e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,9 @@ accepting a connection. (riece-command-dcc-send): Use riece-completing-read-identity; take an identity object in the 1st argument. + (riece-rdcc-format-size): New function. + (riece-handle-dcc-request): Use it. + * riece-ndcc.el (riece-command-dcc-send): Use riece-completing-read-identity; take an identity object in the 1st argument. diff --git a/lisp/riece-rdcc.el b/lisp/riece-rdcc.el index ee97197..b54eb3b 100644 --- a/lisp/riece-rdcc.el +++ b/lisp/riece-rdcc.el @@ -263,6 +263,17 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{" (set-process-filter process #'riece-rdcc-filter) (set-process-sentinel process #'riece-rdcc-sentinel))) +(defun riece-rdcc-format-size (size) + (if (< size 1024) + (format "%0.1fB" size) + (setq size (/ size 1024.0)) + (if (< size 1024) + (format "%0.1fKB" size) + (setq size (/ size 1024.0)) + (if (< size 1024) + (format "%0.1fMB" size) + (format "%0.1fGB" (/ size 1024.0)))))) + (defun riece-handle-dcc-request (prefix target message) (let ((case-fold-search t)) (when (string-match @@ -279,7 +290,14 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{" (setq riece-rdcc-requests (cons (list user file address port size) riece-rdcc-requests)) - (riece-insert-change buffer (format "DCC SEND from %s\n" user)) + (message "%s" + (substitute-command-keys + (format + "DCC SEND from %s, \\[riece-command-dcc-receive] to receive" + user))) + (riece-insert-change buffer (format "DCC SEND from %s: %s (%s)\n" + user file + (riece-rdcc-format-size size))) (riece-insert-change (if (and riece-channel-buffer-mode (not (eq buffer riece-channel-buffer))) @@ -287,11 +305,13 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{" riece-dialogue-buffer) (concat (riece-concat-server-name - (format "DCC SEND from %s (%s) to %s" + (format "DCC SEND from %s (%s) to %s: %s (%s)" user (riece-strip-user-at-host (riece-prefix-user-at-host prefix)) - (riece-decode-coding-string target))) + (riece-decode-coding-string target) + file + (riece-rdcc-format-size size))) "\n"))) t))) -- 1.7.10.4