From 674fe773867ffa27b9042d4744ff6de7a5a2cc64 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sun, 20 Apr 2003 07:17:40 +0000 Subject: [PATCH] Added some asserts to match RFC more. --- src/ircmsgs.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 3389c429f..a26ea4f2f 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -373,6 +373,14 @@ def join(channel, key=None, prefix=''): if key is None: return IrcMsg(prefix=prefix, command='JOIN', args=(channel,)) else: + assert key.translate(string.ascii, string.ascii[128:]) == '' and \ + '\x00' not in key and \ + '\r' not in key and \ + '\n' not in key and \ + '\f' not in key and \ + '\t' not in key and \ + '\v' not in key and \ + ' ' not in key return IrcMsg(prefix=prefix, command='JOIN', args=(channel, key)) def joins(channels, keys=None, prefix=''): @@ -386,6 +394,15 @@ def joins(channels, keys=None, prefix=''): command='JOIN', args=(','.join(channels),)) else: + for key in keys: + assert key.translate(string.ascii, string.ascii[128:]) == '' and \ + '\x00' not in key and \ + '\r' not in key and \ + '\n' not in key and \ + '\f' not in key and \ + '\t' not in key and \ + '\v' not in key and \ + ' ' not in key return IrcMsg(prefix=prefix, command='JOIN', args=(','.join(channels), ','.join(keys))) @@ -427,6 +444,11 @@ def nick(nick, prefix=''): def user(ident, user, prefix=''): """Returns a USER with ident ident and user user.""" + assert '\x00' not in user and \ + '\r' not in user and \ + '\n' not in user and \ + ' ' not in user and \ + '@' not in user return IrcMsg(prefix=prefix, command='USER', args=(ident, '0', '*', user)) def who(hostmaskOrChannel, prefix=''):