From f78c8d28515d7f5af63f9493877d77b94d6863fe Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Tue, 11 Dec 2007 08:38:49 +0000 Subject: [PATCH] [project @ add a parser to spoolwatcher] also simplify the I don't understand your command message so it doesn't thrown a exception about formatting the string. --- gaworkflow/copier.py | 2 +- gaworkflow/spoolwatcher.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gaworkflow/copier.py b/gaworkflow/copier.py index a7f1c5c..f7a0e88 100644 --- a/gaworkflow/copier.py +++ b/gaworkflow/copier.py @@ -233,7 +233,7 @@ class CopierBot(rpc.XmlRpcBot): msg.append(u" " + d) reply = os.linesep.join(msg) else: - reply = u"I didn't understand '%s'"+os.linesep+help % (unicode(msg)) + reply = u"I didn't understand '%s'" % (unicode(msg)) return reply def main(args=None): diff --git a/gaworkflow/spoolwatcher.py b/gaworkflow/spoolwatcher.py index e3da123..ba566cb 100644 --- a/gaworkflow/spoolwatcher.py +++ b/gaworkflow/spoolwatcher.py @@ -130,6 +130,27 @@ class SpoolWatcher(rpc.XmlRpcBot): self.startCopy() self.handler.last_event_time = None + def _parser(self, msg, who): + """ + Parse xmpp chat messages + """ + help = u"I can send [copy] message, or squencer [finished]" + if re.match(u"help", msg): + reply = help + elif re.match("copy", msg): + self.startCopy() + reply = u"sent copy message" + elif re.match(u"finished", msg): + words = msg.split() + if len(words) == 2: + self.sequencingFinished(words[1]) + reply = u"sending sequencing finished for %s" % (words[1]) + else: + reply = u"need runfolder name" + else: + reply = u"I didn't understand '%s'" %(msg) + return reply + def start(self, daemonize): """ Start application -- 2.30.2