;;; Code:
-(eval-when-compile (require 'riece-inlines))
-
(require 'riece-channel)
(require 'riece-complete)
(require 'riece-display)
"Select the next channel."
(interactive)
(when (> (length riece-current-channels) 1)
- (let ((pointer (cdr (string-list-member-ignore-case
+ (let ((pointer (cdr (riece-identity-member-no-server
riece-current-channel
riece-current-channels))))
(while (and pointer
(null (car pointer)))
(setq pointer (cdr pointer)))
+ (when (null pointer)
+ (setq pointer riece-current-channels)
+ (while (and pointer
+ (null (car pointer)))
+ (setq pointer (cdr pointer))))
(if (car pointer)
(riece-command-switch-to-channel (car pointer))
(error "No such channel!")))))
"Select the previous channel."
(interactive)
(when (> (length riece-current-channels) 1)
- (let ((pointer (string-list-member-ignore-case
+ (let ((pointer (riece-identity-member-no-server
riece-current-channel
riece-current-channels))
(start riece-current-channels)
channel)
(while (and start (not (eq start pointer)))
- (if (car start)
- (setq channel (car start)))
+ (setq channel (car start))
(setq start (cdr start)))
+ (when (null channel)
+ (setq start (copy-sequence riece-current-channels))
+ (setq start (delq nil start))
+ (and (> (length start) 1)
+ (setq channel (nth (1- (length start)) start))))
(if channel
(riece-command-switch-to-channel channel)
(error "No such channel!")))))
(riece-identity-prefix target))))))
(defun riece-command-join-partner (target)
- (let ((pointer (riece-identity-member target riece-current-channels)))
+ (let ((pointer (riece-identity-member-safe target riece-current-channels)))
(if pointer
(riece-command-switch-to-channel (car pointer))
(riece-join-channel target)
(defun riece-command-join (target &optional key)
(interactive
- (let ((completion-ignore-case t)
- (target
- (completing-read "Channel/User: "
- (mapcar #'list riece-current-channels)))
- key)
+ (let* ((completion-ignore-case t)
+ (target
+ (completing-read "Channel/User: "
+ (mapcar #'list riece-current-channels)))
+ key)
(if (and current-prefix-arg
(riece-channel-p target))
(setq key
(riece-read-passwd (format "Key for %s: " target))))
(list target key)))
- (let ((pointer (riece-identity-member target riece-current-channels)))
+ (let ((pointer (riece-identity-member-safe target riece-current-channels)))
(if pointer
(riece-command-switch-to-channel (car pointer))
(if (riece-channel-p target)
(defun riece-command-part (target &optional message)
(interactive
- (let ((completion-ignore-case t)
- (target
- (completing-read "Channel/User: "
- (mapcar #'list riece-current-channels)
- nil t (cons riece-current-channel 0)))
- message)
+ (let* ((completion-ignore-case t)
+ (target
+ (completing-read "Channel/User: "
+ (mapcar #'list riece-current-channels)
+ nil t (cons riece-current-channel 0)))
+ message)
(if (and current-prefix-arg
(riece-channel-p target))
(setq message (read-string "Message: ")))
(list target message)))
- (if (riece-identity-member target riece-current-channels)
+ (if (riece-identity-member-safe target riece-current-channels)
(if (riece-channel-p target)
(riece-command-part-channel target message)
(riece-part-channel target)
"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."