* liece-commands.el (liece-command-beep): New function.
authorbg66 <bg66>
Sun, 16 Jul 2000 05:57:29 +0000 (05:57 +0000)
committerbg66 <bg66>
Sun, 16 Jul 2000 05:57:29 +0000 (05:57 +0000)
Toggle the automatic beep notice when the channel message is received.

* liece-handle.el (liece-handle-privmsg-message): added it.

* liece-misc.el (liece-beep): New function.

* liece-vars.el (liece-default-beep): New variable.
(liece-beep-when-invited): Ditto.
(liece-beep-when-privmsg):  Ditto.
(liece-beep-words-list): Ditto.

* liece.el (liece-dialogue-mode-map): Bind "\C-B" to liece-dialogue-beep.

lisp/ChangeLog
lisp/liece-commands.el
lisp/liece-globals.el
lisp/liece-handle.el
lisp/liece-misc.el
lisp/liece-vars.el
lisp/liece.el

index e43ebfb..6fa9d9f 100644 (file)
@@ -1,3 +1,16 @@
+2000-07-16  Akira Ohashi  <bg66@luck.gr.jp>
+
+       * liece-commands.el (liece-command-beep): New function.
+       Toggle the automatic beep notice when the channel message is received.
+
+       * liece.el (liece-dialogue-mode-map):
+       Bind "\C-B" to liece-dialogue-beep.
+
+       * liece-vars.el (liece-default-beep): New variable.
+       (liece-beep-when-invited): Ditto.
+       (liece-beep-when-privmsg): Ditto.
+       (liece-beep-words-list): Ditto.
+
 2000-05-07   Daiki Ueno  <ueno@unixuser.org>
 
        * liece-tcp.el
index 3d9f564..c4439eb 100644 (file)
@@ -847,6 +847,14 @@ If prefix argument ARG is non-nil, toggle frozen status."
                      liece-dialogue-buffer)
                    (if arg (prefix-numeric-value arg))))
 
+(defun liece-command-beep (&optional arg)
+  "Toggle the automatic beep notice when the channel message is received."
+  (interactive "P")
+  (liece-beep (if liece-channel-buffer-mode
+                  liece-channel-buffer
+                liece-dialogue-buffer)
+              (if arg (prefix-numeric-value arg))))
+
 (defun liece-command-quit (&optional arg)
   "Quit IRC.
 If prefix argument ARG is non-nil, leave signoff message."
index b1e5fde..a540b99 100644 (file)
@@ -115,8 +115,10 @@ Each element in the list is a list containing a nickname.")
 (defvar liece-command-buffer-mode-indicator "Channels")
 (defvar liece-channel-status-indicator "")
 
+(defvar liece-beep-indicator nil)
 (defvar liece-freeze-indicator nil)
 (defvar liece-own-freeze-indicator nil)
+(defvar liece-beep nil)
 (defvar liece-freeze nil)
 (defvar liece-own-freeze nil)
 
index 374a627..ae0927f 100644 (file)
 (defun* liece-handle-privmsg-message (prefix rest)
   (if (liece-handle-message-check-ignored prefix rest)
       (return-from liece-handle-privmsg-message))
-  (and (string-match "\007" rest) liece-beep-on-bells
-       (beep t))
   (with-liece-decryption (rest prefix)
     (if (run-hook-with-args-until-success 'liece-privmsg-cleartext-hook
                                          prefix rest)
 
       (setq chnl (liece-channel-virtual chnl))
       
+      ; beep
+      (if liece-beep-on-bells
+         (progn
+           (and (string-match "\007" rest) (beep t))
+           (if (liece-nick-equal chnl liece-real-nickname)
+               (and liece-beep-when-privmsg (beep t))
+             (with-current-buffer (if liece-channel-buffer-mode
+                                      (format liece-channel-buffer-format
+                                              chnl)
+                                    liece-dialogue-buffer)
+                                  (and liece-beep (beep t))))
+           (let ((i 0)
+                 (word (nth 0 liece-beep-words-list)))
+             (while word
+               (and (string-match word rest) (beep t))
+               (setq i (1+ i))
+               (setq word (nth i liece-beep-words-list))))))
+
       ;; Append timestamp if we are being away.
       (and (string-equal "A" liece-away-indicator)
           (liece-nick-equal chnl liece-real-nickname)
 (defun* liece-handle-invite-message (prefix rest)
   (or (string-match " +:" rest)
       (return-from liece-handle-invite-message))
+  (and liece-beep-when-invited liece-beep-on-bells
+       (beep t))
   (let ((chnl (liece-channel-virtual (substring rest (match-end 0)))))
     (liece-insert-info (append liece-D-buffer liece-O-buffer)
                        (format "%s invites you to channel %s\n"
index 3603ef6..4872f0b 100644 (file)
   (if liece-display-frame-title
       (liece-set-frame-title-format)))
 
+(defun liece-beep (buffer &optional arg)
+  (with-current-buffer buffer
+    (setq liece-beep (if arg (plusp arg) (not liece-beep))
+          liece-beep-indicator (if liece-beep "B" "-"))
+    (force-mode-line-update)))
+
 (defun liece-freeze (buffer &optional arg)
   (with-current-buffer buffer
     (setq liece-freeze (if arg (plusp arg) (not liece-freeze))
index 937cc7a..9f3d4f1 100644 (file)
@@ -371,6 +371,11 @@ Otherwise you might get killed again if automagic reconnect is too fast."
   :type 'integer
   :group 'liece-look)
 
+(defcustom liece-default-beep nil
+  "If non nil, channel buffer local beep flag is on at starting."
+  :type 'boolean
+  :group 'liece-look)
+
 (defcustom liece-default-freeze nil
   "If non nil, channel buffer local freeze flag is on at starting."
   :type 'boolean
@@ -596,6 +601,21 @@ If value is 'always, an arriving bell will always cause a beep (or flash)."
   :type '(radio (const :tag "Always" always) (const :tag "No" nil))
   :group 'liece-vars)
 
+(defcustom liece-beep-when-invited nil
+  "If non-nil, beep when invited."
+  :type 'boolean
+  :group 'liece-vars)
+
+(defcustom liece-beep-when-privmsg nil
+  "If non-nil, beep when received privmsg."
+  :type 'boolean
+  :group 'liece-vars)
+
+(defcustom liece-beep-words-list nil
+  "This list used for user defined beep rules."
+  :type '(repeat (string :tag "Beep Rules List"))
+  :group 'liece-vars)
+
 (defcustom liece-system-fqdname (system-name)
   "The fully qualified domain name of the system.
 Default is what (system-name) returns."
index c148f9e..c530797 100644 (file)
@@ -209,6 +209,7 @@ If optional argument SAFE is nil, overwrite previous definitions."
     "|" liece-command-show-last-kill
     "a" liece-command-away
     "b" liece-command-submit-bug-report
+    "B" liece-dialogue-beep
     "c" liece-command-point-back-to-command-buffer
     "f" liece-command-finger
     "F" liece-dialogue-freeze
@@ -667,6 +668,7 @@ For a list of the generic commands type \\[liece-command-generic] ? RET.
        liece-privmsg-partner nil
        liece-private-indicator nil
        liece-away-indicator "-"
+       liece-beep-indicator "-"
        liece-freeze-indicator "-"
        liece-own-freeze-indicator "-"
        mode-line-buffer-identification
@@ -676,7 +678,7 @@ For a list of the generic commands type \\[liece-command-generic] ? RET.
           liece-private-indicator
           liece-away-indicator
           liece-crypt-indicator
-          "- " liece-current-channel " " liece-real-nickname)))
+          "-- " liece-current-channel " " liece-real-nickname)))
   (liece-suppress-mode-line-format)
   (use-local-map liece-command-mode-map)
 
@@ -706,13 +708,17 @@ Instead, these commands are available:
 \\{liece-dialogue-mode-map}"
   (kill-all-local-variables)
 
+  (make-local-variable 'liece-beep)
+  (make-local-variable 'liece-beep-indicator)
   (make-local-variable 'liece-freeze)
   (make-local-variable 'liece-freeze-indicator)
   (make-local-variable 'liece-own-freeze)
   (make-local-variable 'liece-own-freeze-indicator)
   (make-local-variable 'tab-stop-list)
 
-  (setq liece-freeze liece-default-freeze
+  (setq liece-beep liece-default-beep
+       liece-beep-indicator (if liece-beep "B" "-")
+       liece-freeze liece-default-freeze
        liece-freeze-indicator (if liece-freeze "F" "-")
        liece-own-freeze liece-default-own-freeze
        liece-own-freeze-indicator (if liece-own-freeze "M" "-")
@@ -724,6 +730,7 @@ Instead, these commands are available:
         '("Liece: "
           mode-line-modified
           liece-away-indicator
+          liece-beep-indicator
           liece-crypt-indicator
           liece-freeze-indicator
           liece-own-freeze-indicator
@@ -759,6 +766,7 @@ Instead, these commands are available:
         '("Liece: "
           mode-line-modified
           liece-away-indicator
+          liece-beep-indicator
           liece-crypt-indicator
           liece-freeze-indicator
           liece-own-freeze-indicator
@@ -800,6 +808,7 @@ Instead, these commands are available:
   (use-local-map liece-nick-mode-map)
   (run-hooks 'liece-nick-mode-hook))
 
+(fset 'liece-dialogue-beep 'liece-command-beep)
 (fset 'liece-dialogue-freeze 'liece-command-freeze)
 (fset 'liece-dialogue-own-freeze 'liece-command-own-freeze)