- (catch 'done
- (while t
- ;; Search for the beginning of the button region.
- (unless (get-text-property start 'riece-identity)
- (setq start (next-single-property-change start 'riece-identity
- nil end)))
- ;; Search for the end of the button region.
- (let* ((identity (get-text-property start 'riece-identity))
- (button-end (next-single-property-change start 'riece-identity
- nil end)))
- (if (= button-end end)
- (throw 'done nil)
- (if (riece-channel-p (riece-identity-prefix identity))
- (widget-convert-button
- 'riece-channel-button start button-end identity))
- (setq start button-end)))))))
-
-(defun riece-button-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)
- (riece-button-add-channel-buttons (point-min) (point-max) nil)))))
-
-(defun riece-button-requires ()
- '(riece-highlight))
+ (set-buffer (riece-event-buffer event))
+ (goto-char (riece-event-point event))
+ (riece-popup-menu-popup
+ (if (riece-channel-p (riece-identity-prefix
+ (get-text-property (point) 'riece-identity)))
+ riece-channel-button-popup-menu
+ riece-user-button-popup-menu)
+ event)))
+
+(defun riece-channel-button-switch-to-channel ()
+ (interactive)
+ (riece-command-switch-to-channel
+ (get-text-property (point) 'riece-identity)))
+
+(defun riece-channel-button-part ()
+ (interactive)
+ (riece-command-part
+ (get-text-property (point) 'riece-identity)))
+
+(defun riece-channel-button-list ()
+ (interactive)
+ (riece-command-list
+ (riece-identity-prefix (get-text-property (point) 'riece-identity))))
+
+(defun riece-user-button-join-partner ()
+ (interactive)
+ (riece-command-join-partner
+ (get-text-property (point) 'riece-identity)))
+
+(defun riece-user-button-set-operators ()
+ (interactive)
+ (let (group users)
+ (if (riece-region-active-p)
+ (save-excursion
+ (riece-scan-property-region
+ 'riece-identity
+ (region-beginning) (region-end)
+ (lambda (start end)
+ (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 (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 users)
+ (if (riece-region-active-p)
+ (save-excursion
+ (riece-scan-property-region
+ 'riece-identity
+ (region-beginning) (region-end)
+ (lambda (start end)
+ (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 (memq ?v (cdr (riece-identity-assoc
+ (riece-identity-prefix identity)
+ users
+ t)))
+ identity))
+ group)))
+ (riece-command-set-speakers (mapcar #'riece-identity-prefix group)))))