From f51c7345dd4cfc7f0cb0f2899425a5e8d820ac43 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 30 Nov 2013 09:14:35 -0500 Subject: [PATCH] I think this would work to terminate immediaate mode... ...if we could see message traffic! --- irkerd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/irkerd b/irkerd index f7a1adc..40cef48 100755 --- a/irkerd +++ b/irkerd @@ -684,6 +684,7 @@ class Irker: self.irc.add_event_handler("kick", self._handle_kick) self.irc.add_event_handler("every_raw_message", self._handle_every_raw_message) self.servers = {} + self.until = None def thread_launch(self): thread = threading.Thread(target=self.irc.spin) thread.setDaemon(True) @@ -749,6 +750,9 @@ class Irker: with open(logfile, "a") as logfp: logfp.write("%03f|%s|%s\n" % \ (time.time(), event.source, event.arguments[0])) + if self.until is not None: + if self.until == event.arguments[0]: + raise SystemExit, 1 def pending(self): "Do we have any pending message traffic?" return [k for (k, v) in self.servers.items() if v.pending()] @@ -870,8 +874,8 @@ if __name__ == '__main__': if immediate: (to, privmsg) = val.split(",") irker.handle('{"to":"%s","privmsg":"%s"}' % (to, privmsg)) + irker.until = privmsg irker.irc.spin() - # FIXME: This mode does not yet terminate else: irker.thread_launch() try: -- 2.26.2