chiark / gitweb /
ChatLogTracker._onboard_event takes a vessel argument
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 17 May 2009 10:00:37 +0000 (11:00 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 17 May 2009 10:00:37 +0000 (11:00 +0100)
yoweb-scrape

index 720e886..93ce317 100755 (executable)
@@ -436,18 +436,17 @@ class ChatLogTracker:
        def force_redisplay(self):
                self._need_redisplay = True
 
-       def _onboard_event(self,timestamp,pirate,event):
-               try: pa = self._pl[pirate]
-               except KeyError: pa = None
-               if pa is not None and pa.v is self._v:
+       def _onboard_event(self,v,timestamp,pirate,event):
+               pa = self._pl.get(pirate, None)
+               if pa is not None and pa.v is v:
                        pa.last_time = timestamp
                        pa.last_event = event
                else:
                        if pa is not None: del pa.v[pirate]
-                       pa = PirateAboard(pirate, self._v, timestamp, event)
+                       pa = PirateAboard(pirate, v, timestamp, event)
                        self._pl[pirate] = pa
-                       self._v[pirate] = pa
-               self._v['#lastinfo'] = timestamp
+                       v[pirate] = pa
+               v['#lastinfo'] = timestamp
                self.force_redisplay()
                return pa
 
@@ -518,15 +517,16 @@ class ChatLogTracker:
 
                l = l[l.find(' ')+1:]
 
-               def ob_x(who,event):
-                       return self._onboard_event(timestamp, who, event)
+               def ob_x(pirate,event):
+                       return self._onboard_event(
+                                       self._v, timestamp, pirate, event)
                def ob1(did): ob_x(m.group(1), did); return d(did)
                def oba(did): return ob1('%s %s' % (did, m.group(2)))
 
-               def disembark(who, how):
-                       ob_x(who, 'leaving '+how)
-                       del self._v[who]
-                       del self._pl[who]
+               def disembark(pirate, event):
+                       ob_x(pirate, 'leaving '+event)
+                       del self._v[pirate]
+                       del self._pl[pirate]
 
                m = rm('Going aboard the (\\S.*\\S)\\.\\.\\.$')
                if m: