chiark / gitweb /
Make /off /a and /off /d work for vessels other than the one we're on
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 17 May 2009 10:26:00 +0000 (11:26 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 17 May 2009 10:26:00 +0000 (11:26 +0100)
TODO
yoweb-scrape

diff --git a/TODO b/TODO
index 037b7ad..1bf2cee 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
 yoweb-scrape
        improve the docs
-       make /a and /d work for non-current vessels (even ones
-               you have yet to board)
        match these msgs
                Ladyhratt has driven Kybernete from the ship!
                Kybernete has bested Ryston, and turns to the rest of the ship.
index 0ceeaa1..7db7afa 100755 (executable)
@@ -576,24 +576,43 @@ class ChatLogTracker:
                        if not m2: return chat(what)
 
                        (cmd, vn, targets) = m2.groups()
+                       dml = ['metachat', cmd]
 
-                       if cmdr == self._myself.name: how = 'manual: /%s' % cmd
-                       else: how = '/%s %s' % (cmd,cmdr)
-                       if cmd == 'a': each = ob_x
-                       else: each = lambda who,how: disembark(
-                               self._v, timestamp, who, how)
-
-                       if vn is not None:
-                               vn = vn.title()
-                               if not regexp.match(
-                                               '(?:.* )?' + vn + '$',
-                                               self._vessel):
-                                       return chat('/%s %s:' % (cmd,vn))
-
-                       for target in targets.split(' '):
-                               if not target: continue
-                               each(target.title(), how)
-                       return d('/%s' % cmd)
+                       if cmd == 'a': each = self._onboard_event
+                       else: each = disembark
+
+                       if cmdr == self._myself.name:
+                               dml.append('self')
+                               how = 'manual: /%s' % cmd
+                       else:
+                               dml.append('other')
+                               how = '/%s %s' % (cmd,cmdr)
+
+                       v = None
+                       if vn is not None and len(vn.split(' ')) == 2:
+                               v = self._update_vessel_lookup(
+                                       vn.title(), timestamp, dml)
+                       elif self._v is None:
+                               dml.append('no-current')
+                       elif vn is None:
+                               dml.append('current')
+                               v = self._v
+                       elif regexp.match('(?:.* )?%s$' % vn.title(),
+                                       self._vessel):
+                               dml.append('match')
+                               v = self._v
+                       else:
+                               dml.append('unk-abbrev')
+
+                       if v is None:
+                               return d(' '.join(dml))
+
+                       targets = targets.strip().split(' ')
+                       dml.append(`len(targets)`)
+                       for target in targets:
+                               each(v, timestamp, target.title(), how)
+
+                       return d(' '.join(dml))
 
                m = rm('(\\w+) (?:issued an order|ordered everyone) "')
                if m: return ob1('general order');