* riece-log.el (riece-log-flashback): Fixed custom spec.
authorueno <ueno>
Wed, 8 Dec 2004 06:32:42 +0000 (06:32 +0000)
committerueno <ueno>
Wed, 8 Dec 2004 06:32:42 +0000 (06:32 +0000)
(riece-log-date-face): New face.
(riece-log-insert): Don't append date string to the end of log
lines if they arrived today.
(riece-log-flashback): Insert "Recent messages ...:"; call
riece-after-insert-functions.

* riece-handle.el (riece-handle-part-message): Call riece-naming
assert-part after inserting changes in channel buffers.
* riece-display.el (riece-part-channel): Call
riece-buffer-dispose-function on parted channel buffer.

lisp/ChangeLog
lisp/riece-display.el
lisp/riece-handle.el
lisp/riece-log.el

index 47c44f0..514c637 100644 (file)
@@ -1,5 +1,19 @@
 2004-12-08  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece-log.el (riece-log-flashback): Fixed custom spec.
+       (riece-log-date-face): New face.
+       (riece-log-insert): Don't append date string to the end of log
+       lines if they arrived today.
+       (riece-log-flashback): Insert "Recent messages ...:"; call
+       riece-after-insert-functions.
+
+       * riece-handle.el (riece-handle-part-message): Call riece-naming
+       assert-part after inserting changes in channel buffers.
+       * riece-display.el (riece-part-channel): Call
+       riece-buffer-dispose-function on parted channel buffer.
+
+2004-12-08  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-log.el (riece-log-display-message-function): Suppress
        further file-name encoding.
 
index 6745e2d..2129482 100644 (file)
@@ -474,7 +474,8 @@ Local to the buffer in `riece-buffer-list'.")
     (if pointer
        (setcar pointer nil))
     (if (riece-identity-equal identity riece-current-channel)
-       (riece-switch-to-nearest-channel pointer))))
+       (riece-switch-to-nearest-channel pointer))
+    (funcall riece-buffer-dispose-function (riece-channel-buffer identity))))
 
 (defun riece-redisplay-buffers (&optional force)
   (riece-update-buffers)
index f19f62c..cf5e0be 100644 (file)
         (message (nth 1 parameters))
         (user-identity (riece-make-identity user riece-server-name)))
     (while channels
-      (riece-naming-assert-part user (car channels))
       (let* ((channel-identity (riece-make-identity (car channels)
                                                    riece-server-name))
             (buffer (riece-channel-buffer channel-identity)))
                    (riece-format-identity channel-identity t))
            message))
          "\n")))
+      (riece-naming-assert-part user (car channels))
       (setq channels (cdr channels)))))
 
 (defun riece-handle-kick-message (prefix string)
index ddedc99..3289a07 100644 (file)
@@ -55,7 +55,8 @@
   "*If non-nil, irc messages flash back from log files.
 If integer, flash back only this line numbers. t means all lines."
   :type '(choice (integer :tag "line numbers")
-                (boolean :tag "flash back or not"))
+                (const t :tag "of the day")
+                (const nil :tag "no flashback"))
   :group 'riece-log)
 
 (defcustom riece-log-coding-system nil
@@ -75,6 +76,19 @@ If integer, flash back only this line numbers. t means all lines."
   :type 'function
   :group 'riece-log)
 
+(defface riece-log-date-face
+  '((((class color)
+      (background dark))
+     (:foreground "Gray70"))
+    (((class color)
+      (background light))
+     (:foreground "DimGray"))
+    (t
+     (:bold t)))
+  "Face used for displaying \"(YYYY/MM/dd)\" extent."
+  :group 'riece-highlight-faces)
+(defvar riece-log-date-face 'riece-log-date-face)
+
 (defvar riece-log-enabled nil)
 
 (defconst riece-log-description
@@ -163,30 +177,40 @@ If LINES is t, insert today's logs entirely."
            (insert-file-contents file)))
     (let ((files (riece-log-get-files identity))
          (lines (- lines))
-         date point)
+         name date point)
       (while (and (< lines 0) files)
        (if (and (file-exists-p (car files))
-                (string-match (concat "\\([0-9][0-9][0-9][0-9]\\)"
-                                      "\\([0-9][0-9]\\)\\([0-9][0-9]\\).txt$")
-                              (car files)))
+                (string-match (concat (riece-make-interval-regexp "[0-9]" 8)
+                                      "\\.txt$")
+                              (setq name (file-name-nondirectory
+                                          (car files)))))
            (save-restriction
              (narrow-to-region (point) (point))
-             (setq date (concat " (" (match-string 1 (car files)) "/"
-                                (match-string 2 (car files)) "/"
-                                (match-string 3 (car files)) ")"))
              (insert-file-contents (car files))
              (goto-char (point-max))
              (setq lines (forward-line lines))
              (delete-region (point-min) (point))
-             (while (not (eobp))
-               (end-of-line)
-               (insert date)
-               (forward-line))
-             (goto-char (point-min))))
+             (unless (equal name (format-time-string "%Y%m%d.txt"))
+               (setq date (concat " (" (substring name 0 4) "/"
+                                  (substring name 4 6) "/"
+                                  (substring name 6 8) ")"))
+               (while (not (eobp))
+                 (end-of-line)
+                 (setq point (point))
+                 (insert date)
+                 (put-text-property point (point)
+                                    'riece-overlay-face 'riece-log-date-face)
+                 (forward-line))
+               (goto-char (point-min)))))
        (setq files (cdr files))))))
 
 (defun riece-log-flashback (identity)
   (when riece-log-flashback
+    (riece-insert-info (current-buffer)
+                      (if (eq riece-log-flashback t)
+                          "Recent messages of the day:\n"
+                        (format "Recent messages up to %d lines:\n"
+                                riece-log-flashback)))
     (let (buffer-read-only
          (point (goto-char (point-max))))
       (insert (with-temp-buffer
@@ -200,10 +224,8 @@ If LINES is t, insert today's logs entirely."
                           (riece-make-identity
                            (riece-match-string-no-properties 1)
                            (riece-identity-server identity))))
-      (when (and (memq 'riece-button riece-addons)
-                riece-button-enabled)
-       (riece-button-update-buffer))
-      (goto-char (point-max))
+      (run-hook-with-args 'riece-after-insert-functions
+                         point (goto-char (point-max)))
       (set-window-point (get-buffer-window (current-buffer))
                        (point)))))