Example #1
0
	def on_mode(self, serv, ev):
		channel = ev.target()
		if net.ProtocolMgr._is_a_channel(channel):
			modes = ev.arguments()[0]
			if len(ev.arguments()) > 1:
				targets = ev.arguments()[1:]
			else:
				targets = None
			
			current_md = ''
			idx = 0
			for m in modes:
				if m == '+' or m == '-':
					current_md = m
				else:
					if targets is None:
						if current_md == '+':
							self.server.add_channel_mode(channel, m)
						elif current_md == '-':
							self.server.remove_channel_mode(channel, m)
					else:
						if current_md == '+':
							self.server.get_channel_by_name(channel).add_user_mode(targets[idx], m)
						elif current_md == '-':
							self.server.get_channel_by_name(channel).remove_user_mode(targets[idx], m)
					idx = idx + 1
			if settings.LOG:
				log.statify(serv.servername(), ev.target(), ev.source(), ev.eventtype(), ' '.join(ev.arguments()))
		
		self.dispatch_event(ev)
Example #2
0
	def on_nick(self, serv, ev):
		if settings.LOG:
			for c in self.server._channels:
				if self.server.is_user_on_channel(ev.source().nickname, c):
					log.statify(serv.servername(), c, ev.source(), ev.eventtype(), ev.arguments()[0])
		self.server.nick_user(ev.source().nickname, ev.arguments()[0])
		self.dispatch_event(ev)
Example #3
0
	def on_part(self, serv, ev):
		# self.server.get_channel_by_name(ev.target()).remove_user(irclib.nm_to_n(ev.source()))
		if settings.LOG:
			if len(ev.arguments()) == 0:
				arg = ''
			else:
				arg = ev.arguments()[0]
			log.statify(serv.servername(), ev.target(), ev.source(), ev.eventtype(), arg)
		self.server.get_channel_by_name(ev.target()).remove_user(ev.source().nickname)
		self.dispatch_event(ev)
Example #4
0
	def on_join(self, serv, ev):
		if settings.LOG:
			log.statify(serv.servername(), ev.arguments()[0], ev.source(), ev.eventtype(), '')
		if ev.source().nickname == self.server._current_nickname:
			debug.debug('New channel: ' + ev.target())
			self.server.add_channel(ev.target(), '')
		else:
			debug.debug('Received Join Event: ' + str(ev.source()) + ' on ' + ev.arguments()[0])
			self.server.get_channel_by_name(ev.arguments()[0]).add_user(ev.source().nickname, ev.source().ident, ev.source().hostname)
		self.dispatch_event(ev)
Example #5
0
	def on_quit(self, serv, ev):
		# self.server.quit_user(irclib.nm_to_n(ev.source()))
		debug.info(ev.source().nickname + " has quit.")
		if settings.LOG:
			if len(ev.arguments()) == 0:
				arg = 'Quit.'
			else:
				arg = ev.arguments()[0]
			for c in self.server._channels:
				if self.server.is_user_on_channel(ev.source().nickname, c):
					debug.debug("Statify quit of " + ev.source().nickname + " for channel " + c + "...")
					log.statify(serv.servername(), c, ev.source(), ev.eventtype(), arg)
		self.server.quit_user(ev.source().nickname)
		self.dispatch_event(ev)
Example #6
0
	def on_pubaction(self, serv, ev):
		actionmsg = ev.arguments()[0][len('\x01ACTION '):-1]
		if settings.LOG:
			log.statify(serv.servername(), ev.target(), ev.source(), ev.eventtype(), actionmsg)
		self.dispatch_event(ev)
Example #7
0
	def on_kick(self, serv, ev):
		if ev.arguments()[0].lower() != self.server._current_nickname.lower():
			self.server.get_channel_by_name(ev.target()).remove_user(ev.arguments()[0])
			if settings.LOG:
				log.statify(serv.servername(), ev.target(), ev.source(), ev.eventtype(), ev.arguments()[0])
		self.dispatch_event(ev)
Example #8
0
	def on_pubmsg(self, serv, ev):
		if settings.LOG:
			log.statify(serv.servername(), ev.target(), ev.source(), ev.eventtype(), ev.arguments()[0])
		if not self.is_ignored(ev.source()):
			self.dispatch_event(ev)