summaryrefslogtreecommitdiffstats
path: root/wmd/parser.py
diff options
context:
space:
mode:
authorjason2006-08-08 02:12:09 +0000
committerjason2006-08-08 02:12:09 +0000
commit52db8e8ff348f8e9c51ed894015e36458c7c040c (patch)
treee97e14190c53f70b5204bbe1fe8543457aadca63 /wmd/parser.py
parenta0b8a3a265547b5f61114d971d2a9c30dfcda74b (diff)
downloadwarmachine-52db8e8ff348f8e9c51ed894015e36458c7c040c.tar.gz
warmachine-52db8e8ff348f8e9c51ed894015e36458c7c040c.zip
Added irc command parsing in wmd/parser.py
git-svn-id: svn://svn.zzq.org/warmachine/trunk@4 3ede8657-8418-0410-873f-eb3fb5a66eab
Diffstat (limited to 'wmd/parser.py')
-rw-r--r--wmd/parser.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/wmd/parser.py b/wmd/parser.py
index ecb2e55..52a0e9a 100644
--- a/wmd/parser.py
+++ b/wmd/parser.py
@@ -4,6 +4,7 @@ class ircparse(object):
4 def __init__(self, data): 4 def __init__(self, data):
5 self.prefix ='' 5 self.prefix =''
6 self.command = '' 6 self.command = ''
7 self.params = ''
7 8
8 self._rawdata = data 9 self._rawdata = data
9 10
@@ -11,7 +12,8 @@ class ircparse(object):
11 #print data 12 #print data
12 #print "xo" * 40 13 #print "xo" * 40
13 14
14 self._process_data(data) 15 if data != '':
16 self._process_data(data)
15 17
16 def _process_data(self, data): 18 def _process_data(self, data):
17 data = data.strip() 19 data = data.strip()
@@ -28,3 +30,12 @@ class ircparse(object):
28 # 30 #
29 # TODO: Get the server name from the parent object. 31 # TODO: Get the server name from the parent object.
30 pass 32 pass
33
34 # Command comes 2nd (Or first if the prefix is missing)
35 self.command = data.split(' ')[1]
36
37 # Finally we reconstruct the parameters. We'll let the plugins figure out
38 # what they mean since they could potentially be very different.
39 for param in data.split(' ')[2:]:
40 self.params += param + " "
41 self.params.strip()