change of riece-channel.el.
* riece-message.el (riece-message-external-p): Follow the
change of riece-channel.el.
* riece-display.el (riece-update-user-list-buffer): Follow the
change of riece-channel.el.
* riece-commands.el (riece-command-kick): Follow the change of
riece-channel.el.
(riece-command-set-operators): Ditto.
(riece-command-set-speakers): Ditto.
* riece-button.el (riece-user-button-set-operators): Follow the
change of riece-channel.el.
(riece-user-button-set-speakers): Ditto.
* riece-channel.el (riece-make-channel): Abolish 2nd and 3rd
arguments.
(riece-get-channel): Follow the change of riece-make-channel.
(riece-channel-operators): Abolish.
(riece-channel-speakers): Abolish.
(riece-channel-set-operators): Abolish.
(riece-channel-set-speakers): Abolish.
(riece-channel-get-operators): Abolish.
(riece-channel-get-speakers): Abolish.
(riece-channel-toggle-user): Follow the change of the return type
of riece-channel-users.
(riece-channel-toggle-operator): Ditto.
(riece-channel-toggle-speaker): Ditto.
(riece-channel-operator-p): Abolish.
(riece-channel-speaker-p): Abolish.
(riece-channel-intern-user): Abolish.
2003-10-23 Daiki Ueno <ueno@unixuser.org>
+ * riece-naming.el (riece-naming-assert-rename): Follow the
+ change of riece-channel.el.
+
+ * riece-message.el (riece-message-external-p): Follow the
+ change of riece-channel.el.
+
+ * riece-display.el (riece-update-user-list-buffer): Follow the
+ change of riece-channel.el.
+
+ * riece-commands.el (riece-command-kick): Follow the change of
+ riece-channel.el.
+ (riece-command-set-operators): Ditto.
+ (riece-command-set-speakers): Ditto.
+
+ * riece-button.el (riece-user-button-set-operators): Follow the
+ change of riece-channel.el.
+ (riece-user-button-set-speakers): Ditto.
+
+ * riece-channel.el (riece-make-channel): Abolish 2nd and 3rd
+ arguments.
+ (riece-get-channel): Follow the change of riece-make-channel.
+ (riece-channel-operators): Abolish.
+ (riece-channel-speakers): Abolish.
+ (riece-channel-set-operators): Abolish.
+ (riece-channel-set-speakers): Abolish.
+ (riece-channel-get-operators): Abolish.
+ (riece-channel-get-speakers): Abolish.
+ (riece-channel-toggle-user): Follow the change of the return type
+ of riece-channel-users.
+ (riece-channel-toggle-operator): Ditto.
+ (riece-channel-toggle-speaker): Ditto.
+ (riece-channel-operator-p): Abolish.
+ (riece-channel-speaker-p): Abolish.
+ (riece-channel-intern-user): Abolish.
+
+2003-10-23 Daiki Ueno <ueno@unixuser.org>
+
* riece-identity.el (riece-identity-member): Take an optional 3rd
argument to instruct to use riece-identity-equal-no-server.
(riece-identity-assoc): Ditto.
(defun riece-user-button-set-operators ()
(interactive)
- (let (group)
+ (let (group users)
(if (riece-region-active-p)
(save-excursion
(riece-scan-property-region
(setq group (cons (get-text-property start 'riece-identity)
group)))))
(setq group (list (get-text-property (point) 'riece-identity))))
+ (setq users (riece-with-server-buffer
+ (riece-identity-server riece-current-channel)
+ (riece-channel-get-users (riece-identity-prefix
+ riece-current-channel))))
(if (setq group
(delq nil
(mapcar
(lambda (identity)
- (unless (riece-channel-operator-p
- (riece-with-server-buffer
- (riece-identity-server
- riece-current-channel)
- (riece-get-channel (riece-identity-prefix
- riece-current-channel)))
- (riece-identity-prefix identity))
+ (unless (memq ?o (cdr (riece-identity-assoc
+ (riece-identity-prefix identity)
+ users
+ t)))
identity))
group)))
(riece-command-set-operators (mapcar #'riece-identity-prefix group)))))
(defun riece-user-button-set-speakers ()
(interactive)
- (let (group)
+ (let (group users)
(if (riece-region-active-p)
(save-excursion
(riece-scan-property-region
(setq group (cons (get-text-property start 'riece-identity)
group)))))
(setq group (list (get-text-property (point) 'riece-identity))))
+ (setq users (riece-with-server-buffer
+ (riece-identity-server riece-current-channel)
+ (riece-channel-get-users (riece-identity-prefix
+ riece-current-channel))))
(if (setq group
(delq nil
(mapcar
(lambda (identity)
- (unless (or (riece-channel-operator-p
- (riece-with-server-buffer
- (riece-identity-server
- riece-current-channel)
- (riece-get-channel
- (riece-identity-prefix
- riece-current-channel)))
- (riece-identity-prefix identity))
- (riece-channel-speaker-p
- (riece-with-server-buffer
- (riece-identity-server
- riece-current-channel)
- (riece-get-channel
- (riece-identity-prefix
- riece-current-channel)))
- (riece-identity-prefix identity)))
+ (unless (memq ?v (cdr (riece-identity-assoc
+ (riece-identity-prefix identity)
+ users
+ t)))
identity))
group)))
(riece-command-set-speakers (mapcar #'riece-identity-prefix group)))))
(makunbound symbol)
(unintern (symbol-name symbol) riece-obarray))))
-(defun riece-make-channel (users operators speakers
- topic modes banned invited uninvited
- key)
+(defun riece-make-channel (users topic modes banned invited uninvited key)
"Make an instance of channel object.
-Arguments are appropriate to channel users, operators, speakers
-\(+v), topic, modes, banned users, invited users, uninvited users, and
-the channel key, respectively."
- (vector users operators speakers topic modes banned invited uninvited))
+Arguments are appropriate to channel users, topic, modes, banned
+users, invited users, uninvited users, and the channel key,
+respectively."
+ (vector users topic modes banned invited uninvited))
(defun riece-get-channel (name)
(let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
(symbol-value symbol)
(set (intern (riece-identity-canonicalize-prefix name)
riece-obarray)
- (riece-make-channel nil nil nil nil nil nil nil nil nil)))))
+ (riece-make-channel nil nil nil nil nil nil nil)))))
(defun riece-channel-users (channel)
"Return the users of CHANNEL."
(aref channel 0))
-(defun riece-channel-operators (channel)
- "Return the operators of CHANNEL."
- (aref channel 1))
-
-(defun riece-channel-speakers (channel)
- "Return the speakers of CHANNEL."
- (aref channel 2))
-
(defun riece-channel-topic (channel)
"Return the topic of CHANNEL."
- (aref channel 3))
+ (aref channel 1))
(defun riece-channel-modes (channel)
"Return the modes of CHANNEL."
- (aref channel 4))
+ (aref channel 2))
(defun riece-channel-banned (channel)
"Return the banned users of CHANNEL."
- (aref channel 5))
+ (aref channel 3))
(defun riece-channel-invited (channel)
"Return the invited users of CHANNEL."
- (aref channel 6))
+ (aref channel 4))
(defun riece-channel-uninvited (channel)
"Return the uninvited users of CHANNEL."
- (aref channel 7))
+ (aref channel 5))
(defun riece-channel-key (channel)
"Return the key of CHANNEL."
- (aref channel 8))
+ (aref channel 6))
(defun riece-channel-set-users (channel value)
"Set the users of CHANNEL to VALUE."
(aset channel 0 value))
-(defun riece-channel-set-operators (channel value)
- "Set the operators of CHANNEL to VALUE."
- (aset channel 1 value))
-
-(defun riece-channel-set-speakers (channel value)
- "Set the speakers of CHANNEL to VALUE."
- (aset channel 2 value))
-
(defun riece-channel-set-topic (channel value)
"Set the topic of CHANNEL to VALUE."
- (aset channel 3 value))
+ (aset channel 1 value))
(defun riece-channel-set-modes (channel value)
"Set the modes of CHANNEL to VALUE."
- (aset channel 4 value))
+ (aset channel 2 value))
(defun riece-channel-set-banned (channel value)
"Set the banned users of CHANNEL to VALUE."
- (aset channel 5 value))
+ (aset channel 3 value))
(defun riece-channel-set-invited (channel value)
"Set the invited users of CHANNEL to VALUE."
- (aset channel 6 value))
+ (aset channel 4 value))
(defun riece-channel-set-uninvited (channel value)
"Set the uninvited users of CHANNEL to VALUE."
- (aset channel 7 value))
+ (aset channel 5 value))
(defun riece-channel-set-key (channel value)
"Set the key of CHANNEL to VALUE."
- (aset channel 8 value))
+ (aset channel 6 value))
(defun riece-channel-get-users (name)
"Return channel's users as list."
(riece-channel-users (riece-get-channel name)))
-(defun riece-channel-get-operators (name)
- "Return channel's operators as list."
- (riece-channel-operators (riece-get-channel name)))
-
-(defun riece-channel-get-speakers (name)
- "Return channel's speakers as list."
- (riece-channel-speakers (riece-get-channel name)))
-
(defun riece-channel-get-topic (name)
"Return channel's topic."
(riece-channel-topic (riece-get-channel name)))
(let* ((channel (riece-get-channel name))
(users (riece-channel-users channel)))
(if flag
- (unless (member user users)
- (riece-channel-set-users channel (cons user users)))
- (if (setq user (car (member user users)))
+ (unless (riece-identity-assoc user users t)
+ (riece-channel-set-users channel (cons (list user) users)))
+ (if (setq user (car (riece-identity-assoc user users t)))
(riece-channel-set-users channel (delq user users))))))
-(defun riece-channel-intern-user (channel user)
- (unless (setq user (car (member user (riece-channel-users channel))))
- (if riece-debug
- (message "%s is not a member of channel" user)))
- user)
-
(defun riece-channel-toggle-operator (name user flag)
"Add or remove an operator to channel."
(let* ((channel (riece-get-channel name))
- (operators (riece-channel-operators channel)))
- (setq user (riece-channel-intern-user channel user))
+ (users (riece-channel-users channel)))
+ (setq user (riece-identity-assoc user users t))
(if flag
- (unless (memq user operators)
- (riece-channel-set-operators channel (cons user operators)))
- (if (setq user (car (memq user operators)))
- (riece-channel-set-operators channel (delq user operators))))))
+ (if user
+ (setcdr user (cons ?o (cdr user)))
+ (riece-channel-set-users channel (cons (list user ?o) users)))
+ (if user
+ (setcdr user (delq ?o (cdr user)))))))
(defun riece-channel-toggle-speaker (name user flag)
"Add or remove an speaker to channel."
(let* ((channel (riece-get-channel name))
- (speakers (riece-channel-speakers channel)))
- (setq user (riece-channel-intern-user channel user))
+ (users (riece-channel-users channel)))
+ (setq user (riece-identity-assoc user users t))
(if flag
- (unless (memq user speakers)
- (riece-channel-set-speakers channel (cons user speakers)))
- (if (setq user (car (memq user speakers)))
- (riece-channel-set-speakers channel (delq user speakers))))))
-
-(defun riece-channel-operator-p (channel user)
- "Return non-nil, if USER has operator privileges in channel."
- (memq (riece-channel-intern-user channel user)
- (riece-channel-operators channel)))
-
-(defun riece-channel-speaker-p (channel user)
- "Return non-nil, if USER is allowed to speak in channel."
- (memq (riece-channel-intern-user channel user)
- (riece-channel-speakers channel)))
+ (if user
+ (setcdr user (cons ?v (cdr user)))
+ (riece-channel-set-users channel (cons (list user ?v) users)))
+ (if user
+ (setcdr user (delq ?v (cdr user)))))))
(provide 'riece-channel)
(riece-check-channel-commands-are-usable t)
(list (completing-read
"User: "
- (mapcar #'list
- (riece-with-server-buffer
- (riece-identity-server riece-current-channel)
- (riece-channel-get-users
- (riece-identity-prefix riece-current-channel)))))
+ (riece-with-server-buffer
+ (riece-identity-server riece-current-channel)
+ (riece-channel-get-users (riece-identity-prefix
+ riece-current-channel))))
(if current-prefix-arg
(read-string "Message: ")))))
(riece-send-string
(interactive
(progn
(riece-check-channel-commands-are-usable t)
- (let ((operators
- (riece-with-server-buffer
- (riece-identity-server riece-current-channel)
- (riece-channel-get-operators
- (riece-identity-prefix riece-current-channel))))
- (completion-ignore-case t)
- users)
- (if current-prefix-arg
- (setq users (riece-completing-read-multiple
- "Users"
- (mapcar #'list operators)))
- (setq users (riece-completing-read-multiple
- "Users"
- (delq nil (mapcar
- (lambda (user)
- (unless (member user operators)
- (list user)))
- (riece-with-server-buffer
- (riece-identity-server
- riece-current-channel)
- (riece-channel-get-users
- (riece-identity-prefix
- riece-current-channel))))))))
- (list users current-prefix-arg))))
+ (let ((completion-ignore-case t))
+ (list (riece-completing-read-multiple
+ "Users"
+ (riece-with-server-buffer
+ (riece-identity-server riece-current-channel)
+ (riece-channel-get-users (riece-identity-prefix
+ riece-current-channel)))
+ (if current-prefix-arg
+ (lambda (user)
+ (memq ?o (cdr user)))
+ (lambda (user)
+ (not (memq ?o (cdr user))))))
+ current-prefix-arg))))
(let (group)
(while users
(setq group (cons (car users) group)
(interactive
(progn
(riece-check-channel-commands-are-usable t)
- (let ((speakers
- (riece-with-server-buffer
- (riece-identity-server riece-current-channel)
- (riece-channel-get-speakers
- (riece-identity-prefix riece-current-channel))))
- (completion-ignore-case t)
- users)
- (if current-prefix-arg
- (setq users (riece-completing-read-multiple
- "Users"
- (mapcar #'list speakers)))
- (setq users (riece-completing-read-multiple
- "Users"
- (delq nil (mapcar
- (lambda (user)
- (unless (member user speakers)
- (list user)))
- (riece-with-server-buffer
- (riece-identity-server
- riece-current-channel)
- (riece-channel-get-users
- (riece-identity-prefix
- riece-current-channel))))))))
- (list users current-prefix-arg))))
+ (let ((completion-ignore-case t))
+ (list (riece-completing-read-multiple
+ "Users"
+ (riece-with-server-buffer
+ (riece-identity-server riece-current-channel)
+ (riece-channel-get-users (riece-identity-prefix
+ riece-current-channel)))
+ (if current-prefix-arg
+ (lambda (user)
+ (memq ?v (cdr user)))
+ (lambda (user)
+ (not (memq ?v (cdr user))))))
+ current-prefix-arg))))
(let (group)
(while users
(setq group (cons (car users) group)
(set-buffer riece-user-list-buffer)
(if (and riece-current-channel
(riece-channel-p (riece-identity-prefix riece-current-channel)))
- (let* ((channel
+ (let* ((users
(with-current-buffer (process-buffer (riece-server-process
(riece-identity-server
riece-current-channel)))
- (riece-get-channel (riece-identity-prefix
- riece-current-channel))))
- (users (riece-channel-users channel))
+ (riece-channel-get-users (riece-identity-prefix
+ riece-current-channel))))
(inhibit-read-only t)
buffer-read-only)
(erase-buffer)
(while users
- (insert (if (riece-channel-operator-p channel (car users))
+ (insert (if (memq ?o (cdr (car users)))
"@"
- (if (riece-channel-speaker-p channel (car users))
+ (if (memq ?v (cdr (car users)))
"+"
" "))
(riece-format-identity
- (riece-make-identity (car users)
+ (riece-make-identity (car (car users))
(riece-identity-server
riece-current-channel))
t)
(riece-with-server-buffer (riece-identity-server target)
(mapcar
(lambda (user)
- (riece-make-identity user riece-server-name))
+ (riece-make-identity (car user) riece-server-name))
(riece-channel-get-users (riece-identity-prefix target))))))))
(provide 'riece-message)
riece-real-nickname new-name))
(let* ((old (riece-get-user old-name))
(channels (riece-user-channels old))
- users pointer)
+ users user)
(while channels
(setq users (riece-channel-get-users (car channels))
- pointer (member old-name users))
- (if pointer
- (setcar pointer new-name))
- (setq users (riece-channel-get-operators (car channels))
- pointer (member old-name users))
- (if pointer
- (setcar pointer new-name))
- (setq users (riece-channel-get-speakers (car channels))
- pointer (member old-name users))
- (if pointer
- (setcar pointer new-name))
+ user (car (riece-identity-assoc old-name users t)))
+ (if user
+ (setcar user new-name))
(setq channels (cdr channels)))
(riece-rename-user old-name new-name))
;; Rename the channel buffer.