--- a/plugins/aspell_plugin.py Wed May 02 19:38:00 2007 +0200
+++ b/plugins/aspell_plugin.py Wed May 02 20:10:16 2007 +0200
@@ -12,18 +12,23 @@
aspell = ASPELL
reply = ""
+ # Check if the language is specified (two-letter code)
if len(splitdata) > 1:
lang = parameters.lower()
if re.match(r"\w\w ", lang):
parameters = parameters[3:].lstrip()
aspell += " --lang=" + lang
+ # Spawn an aspell process
stdout, stdin = popen2.popen2(aspell)
stdin.write(parameters.encode('iso-8859-15'))
stdin.close()
+ # Skip the first line (banner)
r = stdout.readline()
+
+ # Process all result lines
for r in stdout.readlines():
r = r.decode('iso-8859-15')
if r == "*\n":
@@ -33,10 +38,11 @@
reply += "* Let me suggest " + r[r.find(": ")+2:].strip()
reply += ".\n"
else:
+ # I don't know if it can happen
reply += r
if not reply:
- reply = "Unknown error"
+ reply = "Unknown error (no reply)"
smsg(type, source, reply.rstrip())
--- a/plugins/wtf_plugin.py Wed May 02 19:38:00 2007 +0200
+++ b/plugins/wtf_plugin.py Wed May 02 20:10:16 2007 +0200
@@ -7,6 +7,8 @@
def handler_wtf(type, source, parameters):
parameters = parameters.rstrip(" ?\n").lstrip()
+
+ # 1 entry = "keyword\tdefinition"
word = parameters.upper() + "\t"
if not parameters:
@@ -14,6 +16,7 @@
smsg(type, source, "Gimme an acronym!")
return
+ # Look up the keyword in the wtf file... We may have several hits.
reply = ''.join(line for line in file(WTF_FILE) if line.startswith(word))
if not reply: