-;;; lurk.el --- Little Unified iRc Klient -*- lexical-binding:t -*-
+;;; lurk.el --- Little Uni-buffer iRc Klient -*- lexical-binding:t -*-
;; Copyright (C) 2021 Tim Vaughan
(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
((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")
(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"