* riece.el (riece-command-mode): Don't set riece-freeze-indicator.
(riece-dialogue-mode): Call riece-update-status-indicators.
(riece-channel-mode): Add riece-operator-indicator to
mode-line-buffer-identification.
* riece-user.el (riece-make-user): New attribute `operator'.
(riece-user-operator): New function.
(riece-user-set-operator): New function.
(riece-user-toggle-away): New function.
(riece-user-toggle-operator): New function.
* riece-misc.el (riece-own-frozen): Revive.
* riece-message.el (riece-display-message): Reset riece-freeze if
riece-freeze == 'own && (riece-message-own-p message).
* riece-globals.el (riece-own-freeze): Abolish; use riece-freeze.
(riece-operator-indicator): New variable.
* riece-display.el (riece-update-status-indicators): New function.
(riece-update-buffer-functions): Add it.
* riece-commands.el (riece-command-toggle-freeze): Don't call
riece-freeze.
(riece-command-toggle-own-freeze): Don't call riece-own-freeze.
* riece-300.el (riece-handle-302-message): Use
riece-user-toggle-away instead of riece-user-set-away.
(riece-handle-301-message): Ditto.
(riece-handle-305-message): Ditto.
(riece-handle-306-message): Ditto.
(riece-handle-352-message): Ditto.
+2003-06-02 Daiki Ueno <ueno@unixuser.org>
+
+ * riece.el (riece-command-mode): Don't set riece-freeze-indicator.
+ (riece-dialogue-mode): Call riece-update-status-indicators.
+ (riece-channel-mode): Add riece-operator-indicator to
+ mode-line-buffer-identification.
+ * riece-user.el (riece-make-user): New attribute `operator'.
+ (riece-user-operator): New function.
+ (riece-user-set-operator): New function.
+ (riece-user-toggle-away): New function.
+ (riece-user-toggle-operator): New function.
+ * riece-misc.el (riece-own-frozen): Revive.
+ * riece-message.el (riece-display-message): Reset riece-freeze if
+ riece-freeze == 'own && (riece-message-own-p message).
+ * riece-globals.el (riece-own-freeze): Abolish; use riece-freeze.
+ (riece-operator-indicator): New variable.
+ * riece-display.el (riece-update-status-indicators): New function.
+ (riece-update-buffer-functions): Add it.
+ * riece-commands.el (riece-command-toggle-freeze): Don't call
+ riece-freeze.
+ (riece-command-toggle-own-freeze): Don't call riece-own-freeze.
+ * riece-300.el (riece-handle-302-message): Use
+ riece-user-toggle-away instead of riece-user-set-away.
+ (riece-handle-301-message): Ditto.
+ (riece-handle-305-message): Ditto.
+ (riece-handle-306-message): Ditto.
+ (riece-handle-352-message): Ditto.
+
2003-06-02 Yoichi NAKAYAMA <yoichi@geiin.org>
* riece-commands.el (riece-command-next-channel): Circularly
"\\)\\(\\*\\)?=\\([-+]\\)\\([^ ]+\\)")
(car replies))
(let ((user (match-string 1 (car replies)))
- (away (eq (match-string 3 (car replies)) ?-)))
+ (away (eq (match-string 3 (car replies)) ?-))
+ (user-at-host (match-string 4 (car replies)))
+ (operator (not (null (match-beginning 2)))))
+ (riece-user-toggle-away user away)
+ (riece-user-toggle-operator user operator)
(riece-insert-info
(list riece-dialogue-buffer riece-others-buffer)
(concat
(riece-concat-server-name
(format "%s is (%s) [%s, %s]"
user
- (riece-strip-user-at-host
- (match-string 4 (car replies)))
- (if (match-beginning 2)
+ (riece-strip-user-at-host user-at-host)
+ (if operator
"operator"
"not operator")
(if away
"away"
"not away")))
- "\n"))
- (riece-user-set-away (riece-get-user user) away)))
+ "\n"))))
(setq replies (cdr replies)))))
(defun riece-handle-303-message (prefix number name string)
(when (string-match
(concat "^\\(" riece-user-regexp "\\) :")
string)
- (let ((user (match-string 1 string)))
- (riece-user-set-away (riece-get-user user) t)
+ (let ((user (match-string 1 string))
+ (message (substring string (match-end 0))))
+ (riece-user-toggle-away user t)
(riece-insert-info
(list riece-dialogue-buffer riece-others-buffer)
(concat
(riece-concat-server-name
- (format "%s is away: %s"
- user
- (substring string (match-end 0))))
+ (format "%s is away: %s" user message))
"\n")))))
(defun riece-handle-305-message (prefix number name string)
- (riece-user-set-away (riece-get-user riece-real-nickname) nil)
- (setq riece-away-indicator "-")
- (force-mode-line-update t))
+ (riece-user-toggle-away riece-real-nickname nil))
(defun riece-handle-306-message (prefix number name string)
- (riece-user-set-away (riece-get-user riece-real-nickname) t)
- (setq riece-away-indicator "A")
- (force-mode-line-update t))
+ (riece-user-toggle-away riece-real-nickname t))
(defun riece-handle-311-message (prefix number name string)
(if (string-match
(server (match-string 4 string))
(nick (match-string 5 string))
(away (equal (match-string 6 string) "G"))
- (operator (match-string 7 string))
+ (operator (not (null (match-beginning 7))))
(flag (match-string 8 string))
(hops (match-string 9 string))
(name (substring string (match-end 0)))
(riece-make-identity channel)
riece-channel-buffer-alist))))
(riece-naming-assert-join nick channel)
- (riece-user-set-away (riece-get-user user) away)
+ (riece-user-toggle-away user away)
+ (riece-user-toggle-operator user operator)
(riece-insert-info
buffer
(format "%10s = %s (%s) [%s, %s, %s hops, on %s]\n"
"Prevent automatic scrolling of the dialogue window.
If prefix argument ARG is non-nil, toggle frozen status."
(interactive "P")
- (riece-freeze (if riece-channel-buffer-mode
- riece-channel-buffer
- riece-dialogue-buffer)
- (if arg (prefix-numeric-value arg))))
+ (with-current-buffer (if (and riece-channel-buffer-mode
+ riece-channel-buffer)
+ riece-channel-buffer
+ riece-dialogue-buffer)
+ (setq riece-freeze (if arg
+ (< 0 (prefix-numeric-value arg))
+ (not riece-freeze))))
+ (riece-update-status-indicators)
+ (force-mode-line-update t))
(defun riece-command-toggle-own-freeze (&optional arg)
"Prevent automatic scrolling of the dialogue window.
The difference from `riece-command-freeze' is that your messages are hidden.
If prefix argument ARG is non-nil, toggle frozen status."
(interactive "P")
- (riece-own-freeze (if riece-channel-buffer-mode
- riece-channel-buffer
- riece-dialogue-buffer)
- (if arg (prefix-numeric-value arg))))
+ (with-current-buffer (if (and riece-channel-buffer-mode
+ riece-channel-buffer)
+ riece-channel-buffer
+ riece-dialogue-buffer)
+ (if (if arg
+ (< 0 (prefix-numeric-value arg))
+ (not (eq riece-freeze 'own)))
+ (setq riece-freeze 'own)
+ (setq riece-freeze nil)))
+ (riece-update-status-indicators)
+ (force-mode-line-update t))
(defun riece-command-quit (&optional arg)
"Quit IRC."
(defvar riece-update-buffer-functions
'(riece-user-list-update-buffer
riece-channel-list-update-buffer
+ riece-update-status-indicators
riece-update-channel-indicator
riece-update-channel-list-indicator))
",")))
(setq riece-channel-list-indicator "No channel")))
+(defun riece-update-status-indicators ()
+ (riece-with-server-buffer
+ (setq riece-away-indicator
+ (if (and riece-real-nickname
+ (riece-user-get-away riece-real-nickname))
+ "A"
+ "-"))
+ (setq riece-operator-indicator
+ (if (and riece-real-nickname
+ (riece-user-get-operator riece-real-nickname))
+ "O"
+ "-")))
+ (setq riece-freeze-indicator
+ (with-current-buffer (if (and riece-channel-buffer-mode
+ riece-channel-buffer)
+ riece-channel-buffer
+ riece-dialogue-buffer)
+ (if (eq riece-freeze 'own)
+ "f"
+ (if riece-freeze
+ "F"
+ "-")))))
+
(defun riece-update-buffers ()
(run-hooks 'riece-update-buffer-functions)
(force-mode-line-update t)
;;; Variables local to the channel buffers:
(defvar riece-freeze nil
- "If non-nil, channel window is not scrolled.
-Local to the channel buffers.")
-(defvar riece-own-freeze nil
- "If non-nil, channel window is not scrolled until you input.
+ "If t, channel window is not scrolled.
+If 'own, channel window is not scrolled until you speak.
Local to the channel buffers.")
;;; Modeline indicators:
"The current joined channels, \"pretty-printed.\".")
(defvar riece-away-indicator "-")
+(defvar riece-operator-indicator "-")
(defvar riece-freeze-indicator nil)
(defvar riece-own-freeze-indicator nil)
(defun riece-display-message (message)
"Display MESSAGE object."
- (let* ((open-bracket
- (funcall riece-message-make-open-bracket-function message))
- (close-bracket
- (funcall riece-message-make-close-bracket-function message))
- (name
- (funcall riece-message-make-name-function message))
- (global-name
- (funcall riece-message-make-global-name-function message))
- (buffer (riece-message-buffer message))
- (parent-buffers (riece-message-parent-buffers message buffer)))
+ (let ((open-bracket
+ (funcall riece-message-make-open-bracket-function message))
+ (close-bracket
+ (funcall riece-message-make-close-bracket-function message))
+ (name
+ (funcall riece-message-make-name-function message))
+ (global-name
+ (funcall riece-message-make-global-name-function message))
+ (buffer (riece-message-buffer message))
+ parent-buffers)
+ (when (and buffer
+ (riece-message-own-p message)
+ (riece-own-frozen buffer))
+ (with-current-buffer buffer
+ (setq riece-freeze nil))
+ (riece-update-status-indicators))
+ (setq parent-buffers (riece-message-parent-buffers message buffer))
(riece-insert buffer
(concat open-bracket name close-bracket
" " (riece-message-text message) "\n"))
(defun riece-insert-info (buffer message)
(riece-insert buffer (concat riece-info-prefix message)))
-(defun riece-freeze (buffer &optional arg)
- (with-current-buffer buffer
- (setq riece-freeze (if arg (< 0 arg) (not riece-freeze))
- riece-freeze-indicator (if riece-freeze "F" "-"))
- (force-mode-line-update)))
-
(defun riece-frozen (buffer)
- (with-current-buffer buffer riece-freeze))
+ (with-current-buffer buffer
+ riece-freeze))
-(defun riece-own-freeze (buffer &optional arg)
+(defun riece-own-frozen (buffer)
(with-current-buffer buffer
- (setq riece-own-freeze (if arg (< 0 arg) (not riece-own-freeze))
- riece-own-freeze-indicator (if riece-own-freeze "M" "-"))
- (force-mode-line-update)))
+ (eq riece-freeze 'own)))
(defun riece-process-send-string (process string)
(with-current-buffer (process-buffer process)
:group 'riece-looks)
(defcustom riece-default-freeze nil
- "If non nil, channel buffer local freeze flag is on at starting."
- :type 'boolean
- :group 'riece-looks)
-
-(defcustom riece-default-own-freeze nil
- "If non nil, channel buffer local own freeze flag is on at starting."
+ "Channel buffer local freeze flag is on at starting."
:type 'boolean
:group 'riece-looks)
(makunbound symbol)
(unintern (symbol-name symbol) riece-obarray))))))
-(defun riece-make-user (&optional channels user-at-host modes away)
+(defun riece-make-user (&optional channels user-at-host modes away operator)
"Make an instance of user object.
Arguments are appropriate to joined channels, user-at-host, mode, and
away status, respectively."
- (vector channels user-at-host modes away))
+ (vector channels user-at-host modes away operator))
(defun riece-get-user (name)
(riece-with-server-buffer
"Return t, if USER has been marked as away."
(aref user 3))
+(defun riece-user-operator (user)
+ "Return t, if USER has operator privilege."
+ (aref user 4))
+
(defun riece-user-set-channels (user value)
"Set the joined channels of USER to VALUE."
(aset user 0 value))
"Set the away status of USER to VALUE."
(aset user 3 value))
+(defun riece-user-set-operator (user value)
+ "Set the operator status of USER to VALUE."
+ (aset user 4 value))
+
(defun riece-user-get-channels (&optional name)
(riece-user-channels
(riece-get-user (or name riece-real-nickname))))
(riece-user-away
(riece-get-user (or name riece-real-nickname))))
+(defun riece-user-get-operator (&optional name)
+ (riece-user-operator
+ (riece-get-user (or name riece-real-nickname))))
+
(defun riece-user-toggle-channel (name channel flag)
"Add or remove the joined channel of user."
(let* ((user (riece-get-user (or name (riece-current-nickname))))
(if (memq mode modes)
(riece-user-set-modes user (delq mode modes))))))
+(defun riece-user-toggle-away (name flag)
+ (riece-user-set-away
+ (riece-get-user (or name (riece-current-nickname))) flag))
+
+(defun riece-user-toggle-operator (name flag)
+ (riece-user-set-operator
+ (riece-get-user (or name (riece-current-nickname))) flag))
+
(provide 'riece-user)
;;; riece-user.el ends here
(interactive)
(kill-all-local-variables)
- (setq riece-freeze riece-default-freeze
- riece-freeze-indicator (if riece-freeze "F" "-")
- riece-own-freeze riece-default-own-freeze
- riece-own-freeze-indicator (if riece-own-freeze "M" "-")
- riece-away-indicator "-"
+ (setq riece-away-indicator "-"
+ riece-operator-indicator "-"
major-mode 'riece-command-mode
mode-name "Commands"
mode-line-buffer-identification
'("Riece: "
mode-line-modified
riece-away-indicator
+ riece-operator-indicator
"-- " riece-current-channel " " riece-real-nickname)))
(riece-simplify-mode-line-format)
(use-local-map riece-command-mode-map)
(kill-all-local-variables)
(make-local-variable 'riece-freeze)
- (make-local-variable 'riece-freeze-indicator)
- (make-local-variable 'riece-own-freeze)
- (make-local-variable 'riece-own-freeze-indicator)
(make-local-variable 'tab-stop-list)
(setq riece-freeze riece-default-freeze
- riece-freeze-indicator (if riece-freeze "F" "-")
- riece-own-freeze riece-default-own-freeze
- riece-own-freeze-indicator (if riece-own-freeze "M" "-")
riece-away-indicator "-"
+ riece-operator-indicator "-"
major-mode 'riece-dialogue-mode
mode-name "Dialogue"
mode-line-buffer-identification
'("Riece: "
mode-line-modified
riece-away-indicator
+ riece-operator-indicator
riece-freeze-indicator
riece-own-freeze-indicator
" " riece-channel-list-indicator " "))
buffer-read-only t
tab-stop-list riece-tab-stop-list)
+ (riece-update-status-indicators)
(riece-simplify-mode-line-format)
(use-local-map riece-dialogue-mode-map)
(buffer-disable-undo)
'("Riece: "
mode-line-modified
riece-away-indicator
+ riece-operator-indicator
riece-freeze-indicator
riece-own-freeze-indicator
" "