changeset 15:a472d6eab97e

Play back the last 5 lines to newly connected clients rather than 1.
author darius@Inchoate
date Sat, 17 Jan 2009 21:43:59 +1030
parents ac60a9244bdf
children ce3712110055
files zbmux.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/zbmux.py	Sat Jan 17 14:42:51 2009 +1030
+++ b/zbmux.py	Sat Jan 17 21:43:59 2009 +1030
@@ -53,8 +53,8 @@
         self.terminal.resetPrivateModes([])
         
         # Send the last whole line we've seen out
-        if self.factory.lastline != None:
-            self.message(self.factory.lastline)
+        for l in self.factory.lastlines:
+            self.message(l + '\n')
             
         self.pending = ""
         self.pendtimer = None
@@ -99,7 +99,7 @@
         self.zbid = zbid
         self.clients = []
         self.tmpline = ""
-        self.lastline = None
+        self.lastlines = []
 
         # Open logger
         self.logger = logging.getLogger('Zigbee-%d' % (zbid))
@@ -123,7 +123,8 @@
         self.tmpline = self.tmpline + message
         tmp = self.tmpline.split('\n')
         for l in tmp[0:-1]:
-            self.lastline = l # Stores last seen line for new clients
+            self.lastlines.append(l)
+            self.lastlines = self.lastlines[-5:]
             self.logger.debug(l.replace('\n', ''))
         self.tmpline = tmp[-1]