diff options
Diffstat (limited to 'wmd/parser.py')
| -rw-r--r-- | wmd/parser.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/wmd/parser.py b/wmd/parser.py new file mode 100644 index 0000000..ecb2e55 --- /dev/null +++ b/wmd/parser.py | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | class ircparse(object): | ||
| 2 | #http://www.irchelp.org/irchelp/rfc/rfc.html | ||
| 3 | |||
| 4 | def __init__(self, data): | ||
| 5 | self.prefix ='' | ||
| 6 | self.command = '' | ||
| 7 | |||
| 8 | self._rawdata = data | ||
| 9 | |||
| 10 | #print "x" * 80 | ||
| 11 | #print data | ||
| 12 | #print "xo" * 40 | ||
| 13 | |||
| 14 | self._process_data(data) | ||
| 15 | |||
| 16 | def _process_data(self, data): | ||
| 17 | data = data.strip() | ||
| 18 | |||
| 19 | # The presence of a prefix is indicated with a single leading ASCII | ||
| 20 | # colon character (':', 0x3b), which must be the first character of | ||
| 21 | # the message itself. There must be no gap (whitespace) between the | ||
| 22 | # colon and the prefix. | ||
| 23 | if data[0] == ':': | ||
| 24 | self.prefix = data[1:].split(' ')[0] | ||
| 25 | else: | ||
| 26 | # If the prefix is missing from the message, it is assumed to have | ||
| 27 | # originated from the connection from which it was received. | ||
| 28 | # | ||
| 29 | # TODO: Get the server name from the parent object. | ||
| 30 | pass | ||