summaryrefslogtreecommitdiffstats
path: root/irc.py
diff options
context:
space:
mode:
authorSean B. Palmer <http://inamidst.com/sbp/>2008-10-29 16:03:12 +0000
committerSean B. Palmer <http://inamidst.com/sbp/>2008-10-29 16:03:12 +0000
commitfe16d21212bacc9704a6cd84d3c85a6676936181 (patch)
tree1bdbc0b340e89fbe3255ebd9985fb482afd9f3d5 /irc.py
parentb91de3886ecb38b6621dc35fa18a4c7f10fde780 (diff)
downloadbot-fe16d21212bacc9704a6cd84d3c85a6676936181.tar.gz
bot-fe16d21212bacc9704a6cd84d3c85a6676936181.tar.bz2
bot-fe16d21212bacc9704a6cd84d3c85a6676936181.zip
Oblique stuff and fixes.
Diffstat (limited to 'irc.py')
-rwxr-xr-xirc.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/irc.py b/irc.py
index e5bfdc3..281f5db 100755
--- a/irc.py
+++ b/irc.py
@@ -52,10 +52,14 @@ class Bot(asynchat.async_chat):
def write(self, args, text=None):
# This is a safe version of __write
+ def safe(input):
+ input = input.replace('\n', '')
+ input = input.replace('\r', '')
+ return input.encode('utf-8')
try:
- args = [arg.encode('utf-8') for arg in args]
+ args = [safe(arg) for arg in args]
if text is not None:
- text = text.encode('utf-8')
+ text = safe(text)
self.__write(args, text)
except Exception, e: pass