emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Add support for IRCv3 message tags


From: Vibhav Pant
Subject: [PATCH] Add support for IRCv3 message tags
Date: Sun, 9 Oct 2016 19:13:42 +0530

The following patch adds support for IRCv3(.2) message tags
(http://ircv3.net/specs/core/message-tags-3.2.html), by adding a 'tags' memember
to the `erc-response` struct. Also, (erc-parse-server-response) is modified
so as to detect if the raw message has any tags preset, and if so, adds them to
the parsed message. Feedback would be appreciated.

diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index bbb7ccb..f210e29 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -115,7 +115,8 @@ erc-server-responses
   (sender "" :type string)
   (command "" :type string)
   (command-args '() :type list)
-  (contents "" :type string))
+  (contents "" :type string)
+  (tags '() :type list))

 ;;; User data

@@ -961,10 +962,16 @@ erc-parse-server-response
 PROCs `process-buffer' is `current-buffer' when this function is called."
   (unless (string= string "") ;; Ignore empty strings
     (save-match-data
-      (let ((posn (if (eq (aref string 0) ?:)
-                      (string-match " " string)
-                    0))
-            (msg (make-erc-response :unparsed string)))
+      (let* ((tag-list (when (eq (aref string 0) ?@)
+                         (split-string
+                          (substring string 1 (string-match " " string)) ";")))
+             (msg (make-erc-response :unparsed string :tags tag-list))
+             (string (if tag-list
+                         (substring string (+ 1 (string-match " " string)))
+                       string))
+             (posn (if (eq (aref string 0) ?:)
+                       (string-match " " string)
+                     0)))

         (setf (erc-response.sender msg)
               (if (eq posn 0)

-- 
Vibhav Pant
address@hidden

Attachment: tags.diff
Description: Text document


reply via email to

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