Ejemplo n.º 1
0
	def onCtcp(self, chan, who, cmd, arg):
		if cmd == "VERSION":
			self.notice(who.nick, "\x01VERSION Schongo Bot %s\x01" % version)
		elif cmd == "PING":
			self.notice(who.nick, "\x01PING %s\x01" % arg)
		else:
			modules.fire_hook("ctcp", modules.IrcContext(self, chan, who), cmd, arg)
Ejemplo n.º 2
0
	def onMessage(self, msg):
		# Call the parent so we still function.
		IrcClient.onMessage(self, msg)
		# Fire off an event for modules to eat
		modules.fire_hook("irc_%s" % msg.command, 
				modules.IrcContext(self, None, msg.origin),
				msg)
Ejemplo n.º 3
0
 def onNotice(self, target, who, message):
     if not self._ns_authed and who.nick == self._ns_name:
         if self._ns_find in message:
             self.say(self._ns_name, "IDENTIFY %s" % self._ns_pass)
     else:  # Intentionally don't allow it to intercept NickServ messages.
         modules.fire_hook("notice", modules.IrcContext(self, target, who),
                           message)
Ejemplo n.º 4
0
 def onCtcp(self, chan, who, cmd, arg):
     if cmd == "VERSION":
         self.notice(who.nick, "\x01VERSION Schongo Bot %s\x01" % version)
     elif cmd == "PING":
         self.notice(who.nick, "\x01PING %s\x01" % arg)
     else:
         modules.fire_hook("ctcp", modules.IrcContext(self, chan, who), cmd,
                           arg)
Ejemplo n.º 5
0
    def onConnected(self):
        IrcClient.onConnected(self)

        if self.user_modes is not None:
            self.sendMessage("MODE", self.nick, self.user_modes)

        modules.fire_hook("connected", self)
        for i in self.channels:
            self.join_channel(i)
Ejemplo n.º 6
0
	def onConnected(self):
		IrcClient.onConnected(self)

		if self.user_modes is not None:
			self.sendMessage("MODE", self.nick, self.user_modes)

		modules.fire_hook("connected", self)
		for i in self.channels:
			self.join_channel(i)	
Ejemplo n.º 7
0
    def onDisconnected(self):
        modules.fire_hook("disconnected", self)
        IrcClient.onDisconnected(self)
        global connections

        connections -= 1

        if connections == 0:
            self.logger.info("Shutting down.")
            modules.shutdown()
Ejemplo n.º 8
0
	def onDisconnected(self):
		modules.fire_hook("disconnected", self)
		IrcClient.onDisconnected(self)
		global connections

		connections -= 1

		if connections == 0:
			self.logger.info("Shutting down.")
			modules.shutdown()
Ejemplo n.º 9
0
Archivo: irc.py Proyecto: hcit/HxIRC
    def lineReceived(self, line):
        prefix = ""
        line_split = line.split(" ")
        if line_split[0].startswith(":"):
            line_split[0] = line_split[0][1:]
            prefix = line_split[0]
            line_split = line_split[1:]

        command = line_split[0]
        params = line_split[1:]
        parsed_params = []
        index = 0
        for param in params:
            if param.startswith(':'):
                param = param[1:]
                params[index] = param
                parsed_params.append(' '.join(params[index:]))
                break
            else:
                parsed_params.append(param)
            index += 1

            logging.debug("Recieved command {0}".format(command))
            modules.fire_hook(command, self, prefix, parsed_params)
Ejemplo n.º 10
0
	def onNick(self, old, new):
		modules.fire_hook("nick", modules.IrcContext(self, None, old), new)
Ejemplo n.º 11
0
	def onTopic(self, who, chan, topic):
		modules.fire_hook("topic", modules.IrcContext(self,chan,who),topic)
Ejemplo n.º 12
0
	def onQuit(self, who, message):
		modules.fire_hook("quit", modules.IrcContext(self, None, who))
Ejemplo n.º 13
0
	def onPart(self, who, chan, msg):
		modules.fire_hook("part", modules.IrcContext(self, chan, who))
Ejemplo n.º 14
0
	def onJoin(self, who, chan):
		modules.fire_hook("join", modules.IrcContext(self, chan, who))
Ejemplo n.º 15
0
 def onNick(self, old, new):
     modules.fire_hook("nick", modules.IrcContext(self, None, old), new)
Ejemplo n.º 16
0
 def onAction(self, chan, who, what):
     modules.fire_hook("action", modules.IrcContext(self, chan, who), what)
Ejemplo n.º 17
0
 def onMsg(self, chan, who, what):
     modules.fire_hook("message", modules.IrcContext(self, chan, who), what)
Ejemplo n.º 18
0
 def onPart(self, who, chan, msg):
     modules.fire_hook("part", modules.IrcContext(self, chan, who))
Ejemplo n.º 19
0
 def onMessage(self, msg):
     # Call the parent so we still function.
     IrcClient.onMessage(self, msg)
     # Fire off an event for modules to eat
     modules.fire_hook("irc_%s" % msg.command,
                       modules.IrcContext(self, None, msg.origin), msg)
Ejemplo n.º 20
0
 def onQuit(self, who, message):
     modules.fire_hook("quit", modules.IrcContext(self, None, who))
Ejemplo n.º 21
0
 def onMode(self, who, chan, mode, args):
     modules.fire_hook("mode", modules.IrcContext(self, chan, who), mode,
                       args)
Ejemplo n.º 22
0
	def onMode(self, who, chan, mode, args):
		modules.fire_hook("mode", modules.IrcContext(self, chan, who), mode, args)
Ejemplo n.º 23
0
	def onNotice(self, target, who, message):
		if not self._ns_authed and who.nick == self._ns_name:
			if self._ns_find in message:
				self.say(self._ns_name, "IDENTIFY %s" % self._ns_pass)
		else: # Intentionally don't allow it to intercept NickServ messages.
			modules.fire_hook("notice", modules.IrcContext(self, target, who), message);
Ejemplo n.º 24
0
	def onAction(self, chan, who, what):
		modules.fire_hook("action", modules.IrcContext(self, chan, who), what)
Ejemplo n.º 25
0
 def onJoin(self, who, chan):
     modules.fire_hook("join", modules.IrcContext(self, chan, who))
Ejemplo n.º 26
0
 def onTopic(self, who, chan, topic):
     modules.fire_hook("topic", modules.IrcContext(self, chan, who), topic)
Ejemplo n.º 27
0
	def onMsg(self, chan, who, what):
		modules.fire_hook("message", modules.IrcContext(self, chan, who), what)
Ejemplo n.º 28
0
	def onConnected(self):

		IrcClient.onConnected(self)
		modules.fire_hook("connected", self)
		for i in self.channels:
			self.join_channel(i)