unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kelvin White <kelvin.white77@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Lawrence Mitchell <wence@gmx.li>, Michael Olson <mwolson@gnu.org>,
	17755@debbugs.gnu.org, Mario Lang <mlang@delysid.org>,
	Diane Murray <disumu@x3y2z1.net>, Alex Schroeder <alex@gnu.org>,
	Julien Danjou <julien@danjou.info>,
	Francis Litterio <franl@users.sourceforge.net>,
	Jorgen Schaefer <forcer@users.sourceforge.net>
Subject: bug#17755: 24.3; ERC user mode support
Date: Wed, 18 Jun 2014 10:40:21 -0400	[thread overview]
Message-ID: <CAG-q9=bAthyQOJMOFNUEyBV7iPp4Yom-f-d=2yM-Ouy_C75_nw@mail.gmail.com> (raw)
In-Reply-To: <jwvmwdb4l1x.fsf-monnier+emacsbugs@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 6814 bytes --]

> Thanks, here are some comments on it.  I wish someone who has worked on
> ERC could say something.  I never use(d) IRC and have hence no clue what
is
> a "user mode prefix", for example.

A user mode prefix is referring to a symbol prefixed to your nickname to
display to other users that you have a certain user mode.
Take "&nickname" for instance. The "&" is the user mode prefix showing you
have +a (admin) user mode.

> > ***************
> > *** 1244,1250 ****
> >                          (erc-format-message
> >                           'JOIN ?n nick ?u login ?h host ?c chnl))))))
> >             (when buffer (set-buffer buffer))
> > !           (erc-update-channel-member chnl nick nick t nil nil host
login)
> >             ;; on join, we want to stay in the new channel buffer
> >             ;;(set-buffer ob)
> >             (erc-display-message parsed nil buffer str))))))
> > --- 1244,1250 ----
> >                          (erc-format-message
> >                           'JOIN ?n nick ?u login ?h host ?c chnl))))))
> >             (when buffer (set-buffer buffer))
> > !           (erc-update-channel-member chnl nick nick t nil nil nil nil
nil host login)
> >             ;; on join, we want to stay in the new channel buffer
> >             ;;(set-buffer ob)
> >             (erc-display-message parsed nil buffer str))))))
>
> In my opinion, erc-update-channel-member had too many arguments already.
> Maybe some of these args should be combined into an erc-channel-user
object?

My first approach was to change the erc-channel-user struct to use a list
of modes,
eliminating some of the args, but it seemed to cause issues elsewhere.
 I'll revisit this again soon.

> > + (defsubst erc-channel-user-owner-p (nick)
> > +   "Return t if NICK is an owner of the current channel."
>
> Usually we say "non-nil" rather than "t", unless the callers need to
> rely on the return value being t rather than some other non-nil value.

Indeed, the callers do rely on the value being t in this case. rather than
just non-nil

> > + (defface erc-nick-prefix-face '((t :weight bold))
> > +   "ERC face used for user mode prefix."
> > +   :group 'erc-faces)
> > +
> > + (defface erc-my-nick-prefix-face '((t :weight bold))
> > +   "ERC face used for my user mode prefix."
> > +   :group 'erc-faces)
>
> Try to use the :inherit property at least to link those two (so users
> who just want to change the two without making them different only need
> to change one of the two) and ideally by inheriting from some other face.

Good idea. I have updated this so each of these two faces inherits from the
appropriate nick faces.
By default the prefix will be the same color unless these are changed
individually.

> > + (defun erc-get-user-mode-prefix (user)
> > +   (when user
> > +     (cond ((erc-channel-user-voice-p user) "+")
> > +           ((erc-channel-user-half-op-p user) "%")
> > +           ((erc-channel-user-op-p user) "@")
> > +           ((erc-channel-user-admin-p user) "&")
> > +           ((erc-channel-user-owner-p user) "~")
> > +           (t ""))))
>
> Here I assume there's some kind of logic or convention.  If not, maybe
> it would be appropriate to do something like add some `help-echo'
> property to those extra chars?

Sure, I've updated the patch to add help-echo props

> One more thing: the above suggests that maybe
> voice/halfop/op/admin/owner are mutually exclusive.  Is that the case?
> Could these be collapsed into a single element which could have values
> `voice', `halfop', `op', `admin', or `owner' (or nil)?

These are actually not mutually exclusive. A user could have all of these
modes enabled, but it isn't typical.
In that case we only want to display the most valuable. If a user has +vo
we want to display @.
If a user has +oa we display &. etc. Glad you noticed this though, this
should check in reverse order.

> >   (defun erc-format-@nick (&optional user channel-data)
> >     "Format the nickname of USER showing if USER is an operator or has
voice.
> >   Operators have \"@\" and users with voice have \"+\" as a prefix.
> >   Use CHANNEL-DATA to determine op and voice status.
> >   See also `erc-format-nick-function'."
> >     (when user
> > !     (let ((nick (erc-server-user-nickname user)))
> > !       (concat (erc-propertize (erc-get-user-mode-prefix nick) 'face
'erc-nick-prefix-face) nick))))

> Please try to stay with 80 columns.

Ok

> BTW, IIUC, ERC is not distributed separately from Emacs any more, so we
> don't need to use compatibility crutches like erc-propertize any more
> (tho it's fine to use it as well for now, and it could be removed "all at
> once" in another patch).

Good point, I'll clean that up in another patch.

> > !                "(ov)@+"))
> [...]
> > !                  "(qaohv)~&@%+"))

>Yay!  Magic!

;D these are the default user modes

> !   (let (prefix op-ch voice-ch names name op voice)
>       (setq prefix (erc-parse-prefix))
> !     (setq op-ch (cdr (assq ?o prefix))
> !         voice-ch (cdr (assq ?v prefix)))
>
> this should have been
>
>      (let* ((prefix (erc-parse-prefix))
>            (op-ch (cdr (assq ?o prefix)))
>             (voice-ch (cdr (assq ?v prefix)))
>             names name op voice)
>
> Which is both cleaner and faster.
>
> So when you change such code, you can take advantage of the change to
> try and reduce occurrences of those "let-without-init followed by setq".

This has been updated, thanks.

> This also makes it sound like those op/voice/admin/owner are mutually
> exclusive and should be combined into a single element.

> Otherwise, please simplify the code with:

>   (setq op 'off voice 'off halfop 'off admin 'off owner 'off)
>   (cond
>    ((eq (elt item 0) voice-ch)
>     (setq name (substring item 1)
>           voice 'on))
>    [...])

Yes, I agree. I have simplified it.

> > +           (when (and voice
> > +                      (not (eq (erc-channel-user-voice cuser) voice)))
> > +             (setq changed t)
> > +             (setf (erc-channel-user-voice cuser)
> > +                   (cond ((eq voice 'on) t)
> > +                         ((eq voice 'off) nil)
> > +                         (t voice))))
>
> Won't this cause `changed' to "always" be set to t, since
> (erc-channel-user-voice cuser) will never be `on' or `off' and hence
> never be equal to `voice'?

> Also, instead of using on/off and converting them from&to nil/t, maybe
> it would be simpler to use nil/t plus a special value
> (e.g. `:unspecified') for the case where the value is simply
> not provided.

Sure, I will look at revising this in a separate patch. I tried to keep
this as simple
as possible but I have noticed things like this and others that could be
simplified
and cleaned up a bit.

Attached is the new patch cleaned up per your suggestions.

Thanks

[-- Attachment #1.2: Type: text/html, Size: 10358 bytes --]

[-- Attachment #2: erc-patch.diff --]
[-- Type: text/plain, Size: 21151 bytes --]

*** projects/emacs/lisp/erc/erc.el	2014-06-18 10:08:15.639519157 -0400
--- projects/emacs-dev/lisp/erc/erc.el	2014-06-18 10:15:41.395718554 -0400
***************
*** 370,376 ****
    )
  
  (cl-defstruct (erc-channel-user (:type vector) :named)
!   op voice
    ;; Last message time (in the form of the return value of
    ;; (current-time)
    ;;
--- 370,376 ----
    )
  
  (cl-defstruct (erc-channel-user (:type vector) :named)
!   voice halfop op admin owner
    ;; Last message time (in the form of the return value of
    ;; (current-time)
    ;;
***************
*** 475,480 ****
--- 475,496 ----
               erc-channel-users)
      (clrhash erc-channel-users)))
  
+ (defsubst erc-channel-user-owner-p (nick)
+   "Return t if NICK is an owner of the current channel."
+   (and nick
+        (hash-table-p erc-channel-users)
+        (let ((cdata (erc-get-channel-user nick)))
+          (and cdata (cdr cdata)
+               (erc-channel-user-owner (cdr cdata))))))
+ 
+ (defsubst erc-channel-user-admin-p (nick)
+   "Return t if NICK is an admin in the current channel."
+   (and nick
+        (hash-table-p erc-channel-users)
+        (let ((cdata (erc-get-channel-user nick)))
+          (and cdata (cdr cdata)
+               (erc-channel-user-admin (cdr cdata))))))
+ 
  (defsubst erc-channel-user-op-p (nick)
    "Return t if NICK is an operator in the current channel."
    (and nick
***************
*** 483,488 ****
--- 499,512 ----
           (and cdata (cdr cdata)
                (erc-channel-user-op (cdr cdata))))))
  
+ (defsubst erc-channel-user-halfop-p (nick)
+   "Return t if NICK is a half-operator in the current channel."
+   (and nick
+        (hash-table-p erc-channel-users)
+        (let ((cdata (erc-get-channel-user nick)))
+          (and cdata (cdr cdata)
+               (erc-channel-user-halfop (cdr cdata))))))
+ 
  (defsubst erc-channel-user-voice-p (nick)
    "Return t if NICK has voice in the current channel."
    (and nick
***************
*** 1122,1127 ****
--- 1146,1159 ----
    "ERC default face."
    :group 'erc-faces)
  
+ (defface erc-nick-prefix-face '((t :inherit erc-nick-default-face :weight bold))
+   "ERC face used for user mode prefix."
+   :group 'erc-faces)
+ 
+ (defface erc-my-nick-prefix-face '((t :inherit erc-my-nick-face :weight bold))
+   "ERC face used for my user mode prefix."
+   :group 'erc-faces)
+ 
  (defface erc-direct-msg-face '((t :foreground "IndianRed"))
    "ERC face used for messages you receive in the main erc buffer."
    :group 'erc-faces)
***************
*** 4190,4196 ****
  (defun erc-format-nick (&optional user _channel-data)
    "Return the nickname of USER.
  See also `erc-format-nick-function'."
!   (when user (erc-server-user-nickname user)))
  
  (defun erc-format-@nick (&optional user channel-data)
    "Format the nickname of USER showing if USER is an operator or has voice.
--- 4222,4245 ----
  (defun erc-format-nick (&optional user _channel-data)
    "Return the nickname of USER.
  See also `erc-format-nick-function'."
!   (let ((nick (erc-server-user-nickname user)))
!     (concat (erc-propertize
!              (erc-get-user-mode-prefix nick)
!              'face 'erc-nick-prefix-face) nick)))
! 
! (defun erc-get-user-mode-prefix (user)
!   (when user
!     (cond ((erc-channel-user-owner-p user)
!            (propertize "~" 'help-echo "owner"))
!           ((erc-channel-user-admin-p user)
!            (propertize "&" 'help-echo "admin"))
!           ((erc-channel-user-op-p user)
!            (propertize "@" 'help-echo "operator"))
!           ((erc-channel-user-halfop-p user)
!            (propertize "%" 'help-echo "half-op"))
!           ((erc-channel-user-voice-p user)
!            propertize "+" 'help-echo "voice")
!           (t ""))))
  
  (defun erc-format-@nick (&optional user channel-data)
    "Format the nickname of USER showing if USER is an operator or has voice.
***************
*** 4198,4215 ****
  Use CHANNEL-DATA to determine op and voice status.
  See also `erc-format-nick-function'."
    (when user
!     (let ((op (and channel-data (erc-channel-user-op channel-data) "@"))
! 	  (voice (and channel-data (erc-channel-user-voice channel-data) "+")))
!       (concat voice op (erc-server-user-nickname user)))))
  
  (defun erc-format-my-nick ()
    "Return the beginning of this user's message, correctly propertized."
    (if erc-show-my-nick
!       (let ((open "<")
  	    (close "> ")
! 	    (nick (erc-current-nick)))
  	(concat
  	 (erc-propertize open 'face 'erc-default-face)
  	 (erc-propertize nick 'face 'erc-my-nick-face)
  	 (erc-propertize close 'face 'erc-default-face)))
      (let ((prefix "> "))
--- 4247,4267 ----
  Use CHANNEL-DATA to determine op and voice status.
  See also `erc-format-nick-function'."
    (when user
!     (let ((nick (erc-server-user-nickname user)))
!       (concat (erc-propertize
!                (erc-get-user-mode-prefix nick)
!                'face 'erc-nick-prefix-face) nick nick))))
  
  (defun erc-format-my-nick ()
    "Return the beginning of this user's message, correctly propertized."
    (if erc-show-my-nick
!       (let* ((open "<")
               (close "> ")
!              (nick (erc-current-nick))
!              (mode (erc-get-user-mode-prefix nick)))
          (concat
           (erc-propertize open 'face 'erc-default-face)
+          (erc-propertize mode 'face 'erc-my-nick-prefix-face)
           (erc-propertize nick 'face 'erc-my-nick-face)
           (erc-propertize close 'face 'erc-default-face)))
      (let ((prefix "> "))
***************
*** 4685,4691 ****
    (let ((str (or (cdr (assoc "PREFIX" (erc-with-server-buffer
  					erc-server-parameters)))
  		 ;; provide a sane default
! 		 "(ov)@+"))
  	types chars)
      (when (string-match "^(\\([^)]+\\))\\(.+\\)$" str)
        (setq types (match-string 1 str)
--- 4737,4743 ----
    (let ((str (or (cdr (assoc "PREFIX" (erc-with-server-buffer
                                          erc-server-parameters)))
                   ;; provide a sane default
!                  "(qaohv)~&@%+"))
          types chars)
      (when (string-match "^(\\([^)]+\\))\\(.+\\)$" str)
        (setq types (match-string 1 str)
***************
*** 4705,4744 ****
  Update `erc-channel-users' according to NAMES-STRING.
  NAMES-STRING is a string listing some of the names on the
  channel."
!   (let (prefix op-ch voice-ch names name op voice)
!     (setq prefix (erc-parse-prefix))
!     (setq op-ch (cdr (assq ?o prefix))
! 	  voice-ch (cdr (assq ?v prefix)))
!     ;; We need to delete "" because in XEmacs, (split-string "a ")
!     ;; returns ("a" "").
      (setq names (delete "" (split-string names-string)))
      (let ((erc-channel-members-changed-hook nil))
        (dolist (item names)
  	(let ((updatep t))
  	  (if (rassq (elt item 0) prefix)
  	      (cond ((= (length item) 1)
  		     (setq updatep nil))
- 		    ((eq (elt item 0) op-ch)
- 		     (setq name (substring item 1)
- 			   op 'on
- 			   voice 'off))
  		    ((eq (elt item 0) voice-ch)
  		     (setq name (substring item 1)
- 			   op 'off
  			   voice 'on))
! 		    (t (setq name (substring item 1)
! 			     op 'off
! 			     voice 'off)))
! 	    (setq name item
! 		  op 'off
! 		  voice 'off))
  	  (when updatep
  	    (puthash (erc-downcase name) t
  		     erc-channel-new-member-names)
  	    (erc-update-current-channel-member
! 	     name name t op voice)))))
      (run-hooks 'erc-channel-members-changed-hook)))
  
  (defcustom erc-channel-members-changed-hook nil
    "This hook is called every time the variable `channel-members' changes.
  The buffer where the change happened is current while this hook is called."
--- 4757,4800 ----
  Update `erc-channel-users' according to NAMES-STRING.
  NAMES-STRING is a string listing some of the names on the
  channel."
!   (let* ((prefix (erc-parse-prefix))
!          (op-ch (cdr (assq ?o prefix)))
!          (voice-ch (cdr (assq ?v prefix)))
!          (adm-ch (cdr (assq ?a prefix)))
!          (own-ch (cdr (assq ?q prefix)))
!          names name op voice halfop admin owner)
      (setq names (delete "" (split-string names-string)))
      (let ((erc-channel-members-changed-hook nil))
        (dolist (item names)
          (let ((updatep t))
+           (setq name item op 'off voice 'off halfop 'off admin 'off owner 'off)
            (if (rassq (elt item 0) prefix)
                (cond ((= (length item) 1)
                       (setq updatep nil))
                      ((eq (elt item 0) voice-ch)
                       (setq name (substring item 1)
                             voice 'on))
!                     ((eq (elt item 0) hop-ch)
!                      (setq name (substring item 1)
!                            halfop 'on))
!                     ((eq (elt item 0) op-ch)
!                      (setq name (substring item 1)
!                            op 'on))
!                     ((eq (elt item 0) adm-ch)
!                      (setq name (substring item 1)
!                            admin 'on))
!                     ((eq (elt item 0) own-ch)
!                      (setq name (substring item 1)
!                            owner 'on))
!                     (t (setq name (substring item 1)))))
            (when updatep
              (puthash (erc-downcase name) t
                       erc-channel-new-member-names)
              (erc-update-current-channel-member
!              name name t voice halfop op admin owner)))))
      (run-hooks 'erc-channel-members-changed-hook)))
  
+ 
  (defcustom erc-channel-members-changed-hook nil
    "This hook is called every time the variable `channel-members' changes.
  The buffer where the change happened is current while this hook is called."
***************
*** 4795,4810 ****
      changed))
  
  (defun erc-update-current-channel-member
!   (nick new-nick &optional add op voice host login full-name info
  	update-message-time)
    "Update the stored user information for the user with nickname NICK.
  `erc-update-user' is called to handle changes to nickname,
! HOST, LOGIN, FULL-NAME, and INFO.  If OP or VOICE are non-nil,
! they must be equal to either `on' or `off', in which case the
! operator or voice status of the user in the current channel is
! changed accordingly.  If UPDATE-MESSAGE-TIME is non-nil, the
! last-message-time of the user in the current channel is set
! to (current-time).
  
  If ADD is non-nil, the user will be added with the specified
  information if it is not already present in the user or channel
--- 4851,4865 ----
      changed))
  
  (defun erc-update-current-channel-member
!   (nick new-nick &optional add voice halfop op admin owner host login full-name info
          update-message-time)
    "Update the stored user information for the user with nickname NICK.
  `erc-update-user' is called to handle changes to nickname,
! HOST, LOGIN, FULL-NAME, and INFO.  If VOICE HALFOP OP ADMIN or OWNER
! are non-nil, they must be equal to either `on' or `off', in which
! case the status of the user in the current channel is changed accordingly.
! If UPDATE-MESSAGE-TIME is non-nil, the last-message-time of the user
!  in the current channel is set to (current-time).
  
  If ADD is non-nil, the user will be added with the specified
  information if it is not already present in the user or channel
***************
*** 4822,4827 ****
--- 4877,4896 ----
      (if cuser
          (progn
            (erc-log (format "update-member: user = %S, cuser = %S" user cuser))
+           (when (and voice
+                      (not (eq (erc-channel-user-voice cuser) voice)))
+             (setq changed t)
+             (setf (erc-channel-user-voice cuser)
+                   (cond ((eq voice 'on) t)
+                         ((eq voice 'off) nil)
+                         (t voice))))
+           (when (and halfop
+                      (not (eq (erc-channel-user-halfop cuser) halfop)))
+             (setq changed t)
+             (setf (erc-channel-user-halfop cuser)
+                   (cond ((eq halfop 'on) t)
+                         ((eq halfop 'off) nil)
+                         (t halfop))))
            (when (and op
                       (not (eq (erc-channel-user-op cuser) op)))
              (setq changed t)
***************
*** 4829,4841 ****
  		  (cond ((eq op 'on) t)
  			((eq op 'off) nil)
  			(t op))))
! 	  (when (and voice
! 		     (not (eq (erc-channel-user-voice cuser) voice)))
  	      (setq changed t)
! 	    (setf (erc-channel-user-voice cuser)
! 		  (cond ((eq voice 'on) t)
! 			((eq voice 'off) nil)
! 			(t voice))))
  	  (when update-message-time
  	    (setf (erc-channel-user-last-message-time cuser) (current-time)))
  	  (setq user-changed
--- 4898,4917 ----
                    (cond ((eq op 'on) t)
                          ((eq op 'off) nil)
                          (t op))))
!           (when (and admin
!                      (not (eq (erc-channel-user-admin cuser) admin)))
              (setq changed t)
!             (setf (erc-channel-user-admin cuser)
!                   (cond ((eq admin 'on) t)
!                         ((eq admin 'off) nil)
!                         (t admin))))
!           (when (and owner
!                      (not (eq (erc-channel-user-owner cuser) owner)))
!             (setq changed t)
!             (setf (erc-channel-user-owner cuser)
!                   (cond ((eq owner 'on) t)
!                         ((eq owner 'off) nil)
!                         (t owner))))
            (when update-message-time
              (setf (erc-channel-user-last-message-time cuser) (current-time)))
            (setq user-changed
***************
*** 4856,4867 ****
  		(cons (current-buffer)
  		      (erc-server-user-buffers user))))
  	(setq cuser (make-erc-channel-user
- 		     :op (cond ((eq op 'on) t)
- 			       ((eq op 'off) nil)
- 			       (t op))
  		     :voice (cond ((eq voice 'on) t)
  				  ((eq voice 'off) nil)
  				  (t voice))
  		     :last-message-time
  		     (if update-message-time (current-time))))
  	(puthash (erc-downcase nick) (cons user cuser)
--- 4932,4952 ----
                  (cons (current-buffer)
                        (erc-server-user-buffers user))))
          (setq cuser (make-erc-channel-user
                       :voice (cond ((eq voice 'on) t)
                                    ((eq voice 'off) nil)
                                    (t voice))
+                      :halfop (cond ((eq halfop 'on) t)
+                                 ((eq halfop 'off) nil)
+                                 (t halfop))
+                      :op (cond ((eq op 'on) t)
+                                ((eq op 'off) nil)
+                                (t op))
+                      :admin (cond ((eq admin 'on) t)
+                                   ((eq admin 'off) nil)
+                                   (t admin))
+                      :owner (cond ((eq owner 'on) t)
+                                   ((eq owner 'off) nil)
+                                   (t owner))
                       :last-message-time
                       (if update-message-time (current-time))))
          (puthash (erc-downcase nick) (cons user cuser)
***************
*** 4872,4878 ****
      (or changed user-changed add)))
  
  (defun erc-update-channel-member (channel nick new-nick
! 				  &optional add op voice host login
  				  full-name info update-message-time)
    "Update user and channel information for the user with
  nickname NICK in channel CHANNEL.
--- 4957,4963 ----
      (or changed user-changed add)))
  
  (defun erc-update-channel-member (channel nick new-nick
!                                           &optional add voice halfop op admin owner host login
                                            full-name info update-message-time)
    "Update user and channel information for the user with
  nickname NICK in channel CHANNEL.
***************
*** 4880,4886 ****
  See also: `erc-update-current-channel-member'."
    (erc-with-buffer
     (channel)
!    (erc-update-current-channel-member nick new-nick add op voice host
  				      login full-name info
  				      update-message-time)))
  
--- 4965,4971 ----
  See also: `erc-update-current-channel-member'."
    (erc-with-buffer
        (channel)
!     (erc-update-current-channel-member nick new-nick add voice halfop op admin owner host
                                         login full-name info
                                         update-message-time)))
  
***************
*** 4979,4985 ****
  	(while chars
  	  (cond ((string= (car chars) "+") (setq add-p t))
  		((string= (car chars) "-") (setq add-p nil))
! 		((string-match "^[ovbOVB]" (car chars))
  		 (setq arg-modes (cons (list (car chars)
  					     (if add-p 'on 'off)
  					     (if args (car args) nil))
--- 5064,5070 ----
          (while chars
            (cond ((string= (car chars) "+") (setq add-p t))
                  ((string= (car chars) "-") (setq add-p nil))
!                 ((string-match "^[qaovhbQAOVHB]" (car chars))
                   (setq arg-modes (cons (list (car chars)
                                               (if add-p 'on 'off)
                                               (if args (car args) nil))
***************
*** 5035,5045 ****
  		 (let ((mode (nth 0 (car arg-modes)))
  		       (onoff (nth 1 (car arg-modes)))
  		       (arg (nth 2 (car arg-modes))))
! 		   (cond ((string-match "^[oO]" mode)
  			  (erc-update-channel-member tgt arg arg nil onoff))
! 			 ((string-match "^[Vv]" mode)
! 			  (erc-update-channel-member tgt arg arg nil nil
! 						     onoff))
  			 ((string-match "^[Ll]" mode)
  			  (erc-update-channel-limit tgt onoff arg))
  			 ((string-match "^[Kk]" mode)
--- 5120,5135 ----
                   (let ((mode (nth 0 (car arg-modes)))
                         (onoff (nth 1 (car arg-modes)))
                         (arg (nth 2 (car arg-modes))))
!                    (cond ((string-match "^[Vv]" mode)
                            (erc-update-channel-member tgt arg arg nil onoff))
!                          ((string-match "^[hH]" mode)
!                           (erc-update-channel-member tgt arg arg nil nil onoff))
!                          ((string-match "^[oO]" mode)
!                           (erc-update-channel-member tgt arg arg nil nil nil onoff))
!                          ((string-match "^[aA]" mode)
!                           (erc-update-channel-member tgt arg arg nil nil nil nil onoff))
!                          ((string-match "^[qQ]" mode)
!                           (erc-update-channel-member tgt arg arg nil nil nil nil nil onoff))
                           ((string-match "^[Ll]" mode)
                            (erc-update-channel-limit tgt onoff arg))
                           ((string-match "^[Kk]" mode)
***************
*** 5978,6003 ****
  	 (user (if channel-data
  		   (car channel-data)
  		 (erc-get-server-user word)))
! 	 host login full-name nick op voice)
      (when user
        (setq nick (erc-server-user-nickname user)
  	    host (erc-server-user-host user)
  	    login (erc-server-user-login user)
  	    full-name (erc-server-user-full-name user))
        (if cuser
! 	  (setq op (erc-channel-user-op cuser)
! 		voice (erc-channel-user-voice cuser)))
        (if (called-interactively-p 'interactive)
  	  (message "%s is %s@%s%s%s"
  		   nick login host
  		   (if full-name (format " (%s)" full-name) "")
! 		   (if (or op voice)
  			       (format " and is +%s%s on %s"
- 			       (if op "o" "")
  			       (if voice "v" "")
  			       (erc-default-target))
  			     ""))
! 	user))))
  
  (defun erc-away-time ()
    "Return non-nil if the current ERC process is set away.
--- 6068,6099 ----
           (user (if channel-data
                     (car channel-data)
                   (erc-get-server-user word)))
!          host login full-name nick voice halfop op admin owner)
      (when user
        (setq nick (erc-server-user-nickname user)
              host (erc-server-user-host user)
              login (erc-server-user-login user)
              full-name (erc-server-user-full-name user))
        (if cuser
!           (setq voice (erc-channel-user-voice cuser)
!                 halfop (erc-channel-user-halfop cuser)
!                 op (erc-channel-user-op cuser)
!                 admin (erc-channel-user-admin cuser)
!                 owner (erc-channel-user-owner cuser))))
      (if (called-interactively-p 'interactive)
          (message "%s is %s@%s%s%s"
                   nick login host
                   (if full-name (format " (%s)" full-name) "")
!                  (if (or voice halfop op admin owner)
                       (format " and is +%s%s on %s"
                               (if voice "v" "")
+                              (if halfop "h" "")
+                              (if op "o" "")
+                              (if admin "a" "")
+                              (if owner "q" "")
                               (erc-default-target))
                     ""))
!       user)))
  
  (defun erc-away-time ()
    "Return non-nil if the current ERC process is set away.

  reply	other threads:[~2014-06-18 14:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 10:34 bug#17755: 24.3; ERC user mode support kelvin.white77
2014-06-11 11:45 ` Kelvin White
2014-06-17 16:03   ` Stefan Monnier
2014-06-18 14:40     ` Kelvin White [this message]
2014-06-18 16:08       ` Kelvin White
2014-06-18 18:32       ` Stefan Monnier
2014-06-18 18:51         ` Kelvin White
2014-10-02 19:31 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG-q9=bAthyQOJMOFNUEyBV7iPp4Yom-f-d=2yM-Ouy_C75_nw@mail.gmail.com' \
    --to=kelvin.white77@gmail.com \
    --cc=17755@debbugs.gnu.org \
    --cc=alex@gnu.org \
    --cc=disumu@x3y2z1.net \
    --cc=forcer@users.sourceforge.net \
    --cc=franl@users.sourceforge.net \
    --cc=julien@danjou.info \
    --cc=mlang@delysid.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=mwolson@gnu.org \
    --cc=wence@gmx.li \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).