* riece-url.el: Fix usage.
authorDaiki Ueno <ueno@unixuser.org>
Sat, 31 May 2003 00:21:17 +0000 (00:21 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Sat, 31 May 2003 00:21:17 +0000 (00:21 +0000)
* riece-inlines.el (string-list-member-ignore-case): Remove docstring.

* riece-unread.el: New add-on.
* COMPILE (riece-modules): Add riece-unread.
* Makefile.am (EXTRA_DIST): Add riece-unread.el

* riece-300.el (riece-handle-322-message): New handler.
(riece-handle-323-message): New handler.

lisp/COMPILE
lisp/ChangeLog
lisp/Makefile.am
lisp/riece-300.el
lisp/riece-display.el
lisp/riece-inlines.el
lisp/riece-unread.el [new file with mode: 0644]
lisp/riece-url.el

index 51445d4..153f1fa 100644 (file)
@@ -42,7 +42,8 @@
                ;; add-ons
                riece-ctcp
                riece-highlight
                ;; add-ons
                riece-ctcp
                riece-highlight
-               riece-url))))
+               riece-url
+               riece-unread))))
 
 (defun riece-compile-modules (modules)
   (let ((load-path (cons nil load-path)))
 
 (defun riece-compile-modules (modules)
   (let ((load-path (cons nil load-path)))
index 4fa7673..4def359 100644 (file)
@@ -1,3 +1,16 @@
+2003-05-31  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-url.el: Fix usage.
+
+       * riece-inlines.el (string-list-member-ignore-case): Remove docstring.
+
+       * riece-unread.el: New add-on.
+       * COMPILE (riece-modules): Add riece-unread.
+       * Makefile.am (EXTRA_DIST): Add riece-unread.el
+
+       * riece-300.el (riece-handle-322-message): New handler.
+       (riece-handle-323-message): New handler.
+
 2003-05-30  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-display.el (riece-configure-windows): Select other window
 2003-05-30  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-display.el (riece-configure-windows): Select other window
index fb658e5..13fbab3 100644 (file)
@@ -6,7 +6,7 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \
        riece-inlines.el riece-message.el riece-misc.el riece-naming.el \
        riece-options.el riece-server.el riece-user.el riece-version.el \
        riece-xemacs.el riece.el \
        riece-inlines.el riece-message.el riece-misc.el riece-naming.el \
        riece-options.el riece-server.el riece-user.el riece-version.el \
        riece-xemacs.el riece.el \
-       riece-ctcp.el riece-url.el
+       riece-ctcp.el riece-url.el riece-unread.el
 
 CLEANFILES = auto-autoloads.el custom-load.el *.elc
 FLAGS ?= -batch -q -no-site-file
 
 CLEANFILES = auto-autoloads.el custom-load.el *.elc
 FLAGS ?= -batch -q -no-site-file
index 99f83c4..fb644d1 100644 (file)
          (setq users (cdr users)))
        (riece-redisplay-buffers))))
 
          (setq users (cdr users)))
        (riece-redisplay-buffers))))
 
+(defun riece-handle-322-message (prefix number name string)
+  (if (string-match "^\\([^ ]+\\) \\([0-9]+\\) :" string)
+      (let* ((channel (match-string 1 string))
+            (visible (match-string 2 string))
+            (topic (substring string (match-end 0))))
+       (let ((buffer (cdr (riece-identity-assoc-no-server
+                           (riece-make-identity channel)
+                           riece-channel-buffer-alist))))
+         (riece-insert-info buffer (concat visible " users, topic: "
+                                           topic "\n"))
+         (riece-insert-info
+          (if (and riece-channel-buffer-mode
+                   (not (eq buffer riece-channel-buffer)))
+              (list riece-dialogue-buffer riece-others-buffer)
+            riece-dialogue-buffer)
+          (concat
+           (riece-concat-server-name
+            (format "%s users on %s, topic: %s" visible channel topic))
+           "\n"))))))
+
 (defun riece-handle-324-message (prefix number name string)
   (if (string-match "^\\([^ ]+\\) \\([^ ]+\\) " string)
       (let* ((channel (match-string 1 string))
 (defun riece-handle-324-message (prefix number name string)
   (if (string-match "^\\([^ ]+\\) \\([^ ]+\\) " string)
       (let* ((channel (match-string 1 string))
 
 (defun riece-handle-315-message (prefix number name string))
 (defun riece-handle-318-message (prefix number name string))
 
 (defun riece-handle-315-message (prefix number name string))
 (defun riece-handle-318-message (prefix number name string))
+(defun riece-handle-323-message (prefix number name string))
 (defun riece-handle-366-message (prefix number name string))
 
 (provide 'riece-300)
 (defun riece-handle-366-message (prefix number name string))
 
 (provide 'riece-300)
index e5a6584..69fbb3d 100644 (file)
          (erase-buffer)
          (while channels
            (if (car channels)
          (erase-buffer)
          (while channels
            (if (car channels)
-               (insert (format "%2d:%s\n" index (car channels))))
+               (insert (format "%2d: %s\n" index (car channels))))
            (setq index (1+ index)
                  channels (cdr channels)))))))
 
            (setq index (1+ index)
                  channels (cdr channels)))))))
 
-(defsubst riece-update-channel-indicator ()
+(defun riece-update-channel-indicator ()
   (setq riece-channel-indicator
        (if riece-current-channel
            (riece-concat-current-channel-modes
   (setq riece-channel-indicator
        (if riece-current-channel
            (riece-concat-current-channel-modes
 
 (defun riece-update-buffers ()
   (run-hooks 'riece-update-buffer-functions)
 
 (defun riece-update-buffers ()
   (run-hooks 'riece-update-buffer-functions)
-  (force-mode-line-update t))
+  (force-mode-line-update t)
+  (run-hooks 'riece-update-buffers-hook))
 
 (eval-when-compile
   (autoload 'riece-channel-mode "riece"))
 
 (eval-when-compile
   (autoload 'riece-channel-mode "riece"))
              identity riece-channel-buffer-alist))
        riece-user-list-buffer 
        (cdr (riece-identity-assoc-no-server
              identity riece-channel-buffer-alist))
        riece-user-list-buffer 
        (cdr (riece-identity-assoc-no-server
-             identity riece-user-list-buffer-alist))))
+             identity riece-user-list-buffer-alist)))
+  (run-hooks 'riece-channel-switch-hook))
 
 (defun riece-join-channel (channel-name)
   (let ((identity (riece-make-identity channel-name)))
 
 (defun riece-join-channel (channel-name)
   (let ((identity (riece-make-identity channel-name)))
   (riece-update-buffers)
   (if (or force
          (funcall riece-configure-windows-predicate))
   (riece-update-buffers)
   (if (or force
          (funcall riece-configure-windows-predicate))
-      (funcall riece-configure-windows-function)))
+      (funcall riece-configure-windows-function))
+  (run-hooks 'riece-redisplay-buffers-hook))
 
 (provide 'riece-display)
 
 (provide 'riece-display)
+
+;;; riece-display.el ends here
index 5aa21c9..b7ce500 100644 (file)
@@ -28,7 +28,6 @@
   (string-equal (upcase s1) (upcase s2)))
 
 (defsubst string-list-member-ignore-case (thing list)
   (string-equal (upcase s1) (upcase s2)))
 
 (defsubst string-list-member-ignore-case (thing list)
-  "Returns t if thing is member of list, not funcallable"
   (catch 'found
     (while list
       (if (and (stringp (car list))
   (catch 'found
     (while list
       (if (and (stringp (car list))
diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el
new file mode 100644 (file)
index 0000000..5c7ad7f
--- /dev/null
@@ -0,0 +1,79 @@
+;;; riece-unread.el --- "unread message mark" add-on
+;; Copyright (C) 1998-2003 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Keywords: IRC, riece
+
+;; This file is part of Riece.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; This add-on displays unread mark ("!") for channels which have
+;; "unread messages".
+
+;; To use, add the following line to your ~/.riece/init.el:
+;; (add-to-list 'riece-addons 'riece-unread t)
+
+;;; Code:
+
+(eval-when-compile (require 'riece-message))
+
+(defvar riece-unread-channels nil)
+
+(defun riece-unread-display-message-function (message)
+  (unless (or (riece-message-own-p message)
+             (equal (riece-message-target message) riece-current-channel))
+    (add-to-list 'riece-unread-channels
+                (riece-message-target message))
+    (riece-unread-update-channel-list-buffer)))
+
+(defun riece-unread-channel-switch-hook ()
+  (setq riece-unread-channels
+       (delete riece-current-channel
+               riece-unread-channels))
+  (riece-unread-update-channel-list-buffer))
+
+(defun riece-unread-update-channel-list-buffer ()
+  (if riece-channel-list-buffer-mode
+      (save-excursion
+       (set-buffer riece-channel-list-buffer)
+       (let ((inhibit-read-only t)
+             buffer-read-only)
+         (goto-char (point-min))
+         (while (not (eobp))
+           (if (looking-at "\\( ?[0-9]+:\\)\\([ !]\\)\\(.+\\)")
+               (let ((channel (match-string 3)))
+                 (replace-match
+                  (concat "\\1"
+                          (if (member channel riece-unread-channels)
+                              "!"
+                            " ")
+                          "\\3"))))
+           (forward-line))))))
+      
+(defun riece-unread-insinuate ()
+  (add-hook 'riece-after-display-message-functions
+           'riece-unread-display-message-function)
+  (add-hook 'riece-channel-switch-hook
+           'riece-unread-channel-switch-hook)
+  (add-hook 'riece-update-buffers-hook
+           'riece-unread-update-channel-list-buffer))
+
+(provide 'riece-unread)
+
+;;; riece-unread.el ends here
index 8a62c18..9a694f5 100644 (file)
@@ -25,7 +25,7 @@
 ;;; Commentary:
 
 ;; To use, add the following line to your ~/.riece/init.el:
 ;;; Commentary:
 
 ;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-url)
+;; (add-to-list 'riece-addons 'riece-url t)
 
 ;;; Code:
 
 
 ;;; Code: