emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/rcirc-update f6e18c6 13/18: Implement invite-notify capability


From: Philip Kaludercic
Subject: feature/rcirc-update f6e18c6 13/18: Implement invite-notify capability
Date: Thu, 10 Jun 2021 11:43:40 -0400 (EDT)

branch: feature/rcirc-update
commit f6e18c63a63fdac0d6abc6a6f68d670ab2923269
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Implement invite-notify capability
    
    * rcirc.el (rcirc-implemented-capabilities): Add invite-notify
    (rcirc-handler-INVITE): Handle invite notifications
---
 lisp/net/rcirc.el | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 60cafd4..b3b70a6 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -580,6 +580,7 @@ See `rcirc-connect' for more details on these variables.")
     "server-time"                       
;https://ircv3.net/specs/extensions/server-time
     "batch"                             
;https://ircv3.net/specs/extensions/batch
     "message-ids"                       
;https://ircv3.net/specs/extensions/message-ids
+    "invite-notify"                     
;https://ircv3.net/specs/extensions/invite-notify
     )
   "A list of capabilities that rcirc supports.")
 (defvar-local rcirc-requested-capabilities nil
@@ -3247,11 +3248,21 @@ Passwords are stored in `rcirc-authinfo' (which see)."
                (format "AUTH %s %s" nick (car args))))))))))
 
 (defun rcirc-handler-INVITE (process sender args _text)
-  "Notify user of an invitation.
-SENDER and ARGS (in concatenated form) are passed on to
-`rcirc-print'.  PROCESS is the process object for the current
-connection."
-  (rcirc-print process sender "INVITE" nil (mapconcat 'identity args " ") t))
+  "Notify user of an invitation from SENDER.
+ARGS should have the form (TARGET CHANNEL).  PROCESS is the
+process object for the current connection."
+  (let ((self (buffer-local-value 'rcirc-nick rcirc-process))
+        (target (car args))
+        (chan (cadr args)))
+    (if (string= target self)
+        (rcirc-print process sender "INVITE" nil
+                     (format "%s invited you to %s"
+                             sender chan)
+                     t)
+      (rcirc-print process sender "INVITE" chan
+                   (format "%s invited %s"
+                           sender target)
+                   t))))
 
 (defun rcirc-handler-ERROR (process sender args _text)
   "Print a error message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]