Jason R. Coombs avatar 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.

Comments (0)

Files changed (1)

 			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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.