Commits

Jason R. Coombs committed 1bbdcfe

No longer decode messages - they should come from the IRC library as unicode.
Use source.nick instead of parsing source directly.

  • Participants
  • Parent commits 39971b6
  • Tags 1103.4.1

Comments (0)

Files changed (1)

File pmxbot/core.py

 			self._schedule_at(*action)
 
 	def on_join(self, c, e):
-		nick = e.source().split('!', 1)[0]
+		nick = e.source().nick
 		channel = e.target()
 		for func in _join_registry:
 			try:
 			c.notice(nick, line)
 
 	def on_pubmsg(self, c, e):
-		msg = (''.join(e.arguments())).decode('utf8', 'ignore')
-		nick = e.source().split('!', 1)[0]
+		msg = u''.join(e.arguments())
+		if not msg.strip():
+			return
+		nick = e.source().nick
 		channel = e.target()
-		if msg.strip() > '':
-			if channel not in self._nolog:
-				pmxbot.logging.Logger.store.message(channel, nick, msg)
-			self.handle_action(c, e, channel, nick, msg)
+		if channel not in self._nolog:
+			pmxbot.logging.Logger.store.message(channel, nick, msg)
+		self.handle_action(c, e, channel, nick, msg)
 
 	def on_privmsg(self, c, e):
-		msg = (''.join(e.arguments())).decode('utf8', 'ignore')
-		nick = e.source().split('!', 1)[0]
+		msg = u''.join(e.arguments())
+		if not msg.strip():
+			return
+		nick = e.source().nick
 		channel = nick
-		if msg.strip() > '':
-			self.handle_action(c, e, channel, nick, msg)
+		self.handle_action(c, e, channel, nick, msg)
 
 	def on_invite(self, c, e):
-		nick = e.source().split('!', 1)[0]
+		nick = e.source().nick
 		channel = e.arguments()[0]
 		if not channel.startswith('#'):
 			channel = '#' + channel