From 57d3c622af5045dcfe1566cf6600de48e4924265 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 17 May 2009 11:26:00 +0100 Subject: [PATCH] Make /off /a and /off /d work for vessels other than the one we're on --- TODO | 2 -- yoweb-scrape | 53 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/TODO b/TODO index 037b7ad..1bf2cee 100644 --- 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. diff --git a/yoweb-scrape b/yoweb-scrape index 0ceeaa1..7db7afa 100755 --- a/yoweb-scrape +++ b/yoweb-scrape @@ -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'); -- 2.30.2