+ ((rx (: "CONNECT " (let network (* not-newline))))
+ (lirc-display-notice "Connecting to " network "...")
+ (lirc-connect network))
+
+ ((rx (: "TOPIC " (let new-topic (* not-newline))))
+ (lirc-send-msg (lirc-msg nil nil "TOPIC" lirc-current-context new-topic)))
+
+ ((rx (: "ME " (let action (* not-newline))))
+ (lirc-send-msg (lirc-msg nil nil "PRIVMSG"
+ (list lirc-current-context
+ (concat "\01ACTION " action "\01"))))
+ (lirc-display-action lirc-nick action))
+
+ ((rx (: "VERSION" " " (let nick (* (not whitespace)))))
+ (lirc-send-msg (lirc-msg nil nil "PRIVMSG"
+ (list nick "\01VERSION\01")))
+ (lirc-display-notice "CTCP version request sent to " nick))
+
+ ((rx "PART" (opt (: " " (let channel (* not-newline)))))
+ (if (or lirc-current-context channel)
+ (lirc-send-msg (lirc-msg nil nil "PART" (if channel
+ channel
+ lirc-current-context)))
+ (lirc-display-error "No current channel to leave.")))
+
+ ((rx "MSG "
+ (let to (* (not whitespace)))
+ " "
+ (let text (* not-newline)))
+ (lirc-send-msg (lirc-msg nil nil "PRIVMSG" target text))
+ (lirc-display-message lirc-nick target text))
+
+ ((rx (: (let cmd-str (+ (not whitespace)))
+ (opt (: " " (let params-str (* not-newline))))))
+ (lirc-send-msg (lirc-msg nil nil (upcase cmd-str)
+ (if params-str
+ (split-string params-str)
+ nil)))))
+
+ (unless (string-empty-p string)
+ (if lirc-current-context
+ (progn
+ (lirc-send-msg (lirc-msg nil nil "PRIVMSG"
+ lirc-current-context
+ string))
+ (lirc-display-message lirc-nick lirc-current-context string))
+ (lirc-display-error "No current context.")))))