((and "PART"
(guard (equal lirc-nick (lirc-msg-src msg))))
- (lirc-display-notice "Left channel " lirc-current-channel)
- (setq lirc-current-channel nil)
- (lirc-del-channel (car (lirc-msg-params msg)))
- (lirc-render-prompt))
+ (let ((channel (car (lirc-msg-params msg))))
+ (lirc-display-notice "Left channel " channel)
+ (lirc-del-channel (car (lirc-msg-params msg)))
+ (when (equal lirc-current-channel channel)
+ (setq lirc-current-channel nil)
+ (lirc-render-prompt))))
("PART"
(let ((channel (car (lirc-msg-params msg)))
(list nick "\01VERSION\01")))
(lirc-display-notice "CTCP version request sent to " nick))
- ((rx "PART")
- (lirc-send-msg (lirc-msg nil nil "PART" lirc-current-channel)))
+ ((rx "PART" (opt (: " " (let channel (* not-newline)))))
+ (if (or lirc-current-channel channel)
+ (lirc-send-msg (lirc-msg nil nil "PART" (if channel
+ channel
+ lirc-current-channel)))
+ (lirc-display-error "No current channel to leave.")))
((rx "MSG "
(let target (* (not whitespace)))
nil)))))
(unless (string-empty-p string)
- (lirc-send-msg (lirc-msg nil nil "PRIVMSG" lirc-current-channel string))
- (lirc-display-message lirc-current-channel lirc-nick string))))
+ (if lirc-current-channel
+ (progn
+ (lirc-send-msg (lirc-msg nil nil "PRIVMSG" lirc-current-channel string))
+ (lirc-display-message lirc-current-channel lirc-nick string))
+ (lirc-display-error "No current channel.")))))
(defun lirc-enter ()
"Enter current contents of line after prompt."