- (irc-bot-dispatch-line irc-bot line)
- (cond
- ;; The port's been closed for some reason, so stop looping
- ((port-closed? socket)
- 'done)
- ;; We've reached the EOF object, which means we should close
- ;; the port ourselves and stop looping
- ((eof-object? (peek-char socket))
- (close socket)
- 'done)
- ;; ;; Looks like we've been killed somehow... well, stop running
- ;; ;; then!
- ;; ((actor-am-i-dead? irc-bot)
- ;; (if (not (port-closed? socket))
- ;; (close socket))
- ;; 'done)
- ;; Otherwise, let's read till the next line!
- (else
- (<- irc-bot (actor-id irc-bot) 'main-loop))))
-
-(define-method (irc-bot-dispatch-line (irc-bot <irc-bot>) line)
+ (with-actor-nonblocking-ports
+ (lambda ()
+ (dispatch-raw-line irc-bot line)
+ (cond
+ ;; The port's been closed for some reason, so stop looping
+ ((port-closed? socket)
+ 'done)
+ ;; We've reached the EOF object, which means we should close
+ ;; the port ourselves and stop looping
+ ((eof-object? (peek-char socket))
+ (close socket)
+ 'done)
+ (else
+ (<- (actor-id irc-bot) 'main-loop))))))
+
+(define* (irc-bot-send-line-action irc-bot message
+ channel line #:key emote?)
+ "Action handler for sending lines. Real behavior happens in
+irc-bot-send-line."
+ (irc-bot-send-line irc-bot channel line #:emote? emote?))
+
+(define* (irc-bot-send-line irc-bot channel line #:key emote?)
+ ;; TODO: emote? handling
+ (format (irc-bot-socket irc-bot) "PRIVMSG ~a :~a~a"
+ channel line irc-eol))
+
+
+;;; Likely-to-be-overridden generic methods
+
+(define-method (dispatch-raw-line (irc-bot <irc-bot>) raw-line)
+ "Dispatch a raw line of input"