From: Tim Vaughan Date: Sat, 3 Jul 2021 09:37:50 +0000 (+0200) Subject: Replaced dedicated display-action procedure. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=a65cb434a57b716eceb9f85dd5eda20a60dc3d7a;p=lurk.git Replaced dedicated display-action procedure. --- diff --git a/lurk.el b/lurk.el index 8b307fe..48b0611 100644 --- a/lurk.el +++ b/lurk.el @@ -1,4 +1,4 @@ -;;; lurk.el --- Little Unified iRc Klient -*- lexical-binding:t -*- +;;; lurk.el --- Little Uni-buffer iRc Klient -*- lexical-binding:t -*- ;; Copyright (C) 2021 Tim Vaughan @@ -418,16 +418,23 @@ portion of the source component of the message, as LURK doesn't use this.") (let ((context (if (eq 'channel (lurk-get-context-type to)) to (if (equal to lurk-nick) from to)))) - (if (string-match (rx (: "\01ACTION " (group (* (not "\01"))) "\01")) text) - (lurk-display-string context to " * " from " " (match-string 1 text)) - (lurk-display-string - context - (pcase (lurk-get-context-type to) - ('channel (concat to " <" from "> ")) - ('nick (concat "[" from " -> " to "] ")) - (_ - (error "Unsupported context type"))) - text)))) + (lurk-display-string + context + (pcase (lurk-get-context-type to) + ('channel (concat to " <" from "> ")) + ('nick (concat "[" from " -> " to "] ")) + (_ + (error "Unsupported context type"))) + text))) + +(defun lurk-display-action (from to action-text) + (let ((context (if (eq 'channel (lurk-get-context-type to)) + to + (if (equal to lurk-nick) from to)))) + (lurk-display-string + context + "* " from " " action-text))) + (defun lurk-display-notice (context &rest notices) (lurk-display-string @@ -600,10 +607,13 @@ portion of the source component of the message, as LURK doesn't use this.") ((rx (let ping (: "\01PING " (* (not "\01")) "\01"))) (lurk-send-msg (lurk-msg nil nil "NOTICE" (list from ping))) - (lurk-display-notice "CTCP ping received from " from)) + (lurk-display-notice from "CTCP ping received from " from)) ("\01USERINFO\01" - (lurk-display-notice "CTCP userinfo request from " from " (no response sent)")) + (lurk-display-notice from "CTCP userinfo request from " from " (no response sent)")) + + ((rx (: "\01ACTION " (let action-text (* (not "\01"))) "\01")) + (lurk-display-action from to action-text)) (_ (if (and (equal from "BitBot") @@ -632,7 +642,7 @@ portion of the source component of the message, as LURK doesn't use this.") (let ((ctcp-text (concat "\01ACTION " action "\01"))) (lurk-send-msg (lurk-msg nil nil "PRIVMSG" (list lurk-current-context ctcp-text))) - (lurk-display-message lurk-nick lurk-current-context ctcp-text))) + (lurk-display-action lurk-nick lurk-current-context action))) ((rx (: "VERSION" " " (let nick (+ (not whitespace))))) (lurk-send-msg (lurk-msg nil nil "PRIVMSG"