comparison irclib.py @ 138:f3a9c891f7c0

fixed a DeprecationWarning in irclib Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sat, 16 Jan 2010 17:21:03 +0100
parents 7dc6a1764c4f
children e077dc9f14e5
comparison
equal deleted inserted replaced
137:9f39cead20cb 138:f3a9c891f7c0
880 """Send a PRIVMSG command.""" 880 """Send a PRIVMSG command."""
881 for l in text.split('\n'): 881 for l in text.split('\n'):
882 l_size = len(l.encode('utf-8')) 882 l_size = len(l.encode('utf-8'))
883 available_size = float(510-len('%s PRIVMSG %s :' % (self.irc_id, target))) # 510 is the size limit for IRC messages defined in RFC 2812 883 available_size = float(510-len('%s PRIVMSG %s :' % (self.irc_id, target))) # 510 is the size limit for IRC messages defined in RFC 2812
884 e = 0 884 e = 0
885 for i in range(math.ceil(l_size/available_size)): 885 for i in range(int(math.ceil(l_size/available_size))):
886 s = e 886 s = e
887 e = s+int(available_size) 887 e = s+int(available_size)
888 while len(l[s:e].encode('utf-8')) >= available_size: 888 while len(l[s:e].encode('utf-8')) >= available_size:
889 e -= 1 889 e -= 1
890 self.send_raw("PRIVMSG %s :%s" % (target, l[s:e])) 890 self.send_raw("PRIVMSG %s :%s" % (target, l[s:e]))