def handleCmd_PRIVMSG(self, prefix, args): src_nick = prefix target = args[0] text = args[1] flags = 0 if (text[:8], text[-1:]) == ('\001ACTION ', '\001'): text = text[8:-1] flags |= core.SLASHME_BIT text = irc_strip(text) scfg = getServiceConfig() if target == scfg.channel: self.ism.sendChannelMessage(src_nick, text, flags) #Format> :Global PRIVMSG $irc3.dhirc.com :TESTING.... #Handle global messages delivered to the bridge. elif target == "$" + scfg.my_host: flags |= core.NOTICE_BIT self.ism.sendChannelMessage(src_nick, text, flags) else: n = self.ism.findDtellaNode(inick=target) if n: self.ism.sendPrivateMessage(n, src_nick, text, flags)
def handleCmd_KICK(self, prefix, args): chan = args[0] l33t = prefix n00b = args[1] reason = irc_strip(args[2]) scfg = getServiceConfig() if chan != scfg.channel: return # Rejoin the bot if it's killed. if self.ism.isMyBot(n00b): if self.ism.syncd: self.pushBotJoin() return l33t = self.ism.findUser(l33t).inick n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode(n, l33t, reason) else: n00b_u = self.ism.findUser(n00b) message = ("%s has kicked %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b_u.inick), reason)) CHECK(self.ism.partChannel(n00b_u, message))
def handleCmd_KICK(self, prefix, args): chan = args[0] l33t = prefix n00b = args[1] reason = irc_strip(args[2]) scfg = getServiceConfig() if chan != scfg.channel: return # Rejoin the bot if it's killed. if self.ism.isMyBot(n00b): if self.ism.syncd: self.pushBotJoin() return l33t = self.ism.findUser(l33t).inick n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode(n, l33t, reason) else: n00b_u = self.ism.findUser(n00b) message = ( "%s has kicked %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b_u.inick), reason)) CHECK(self.ism.partChannel(n00b_u, message))
def handleCmd_KILL(self, prefix, args): l33t = prefix n00b = args[0] reason = irc_strip(args[1]) # In most cases, n00b is a UUID, but Anope seems to still use a nick. # Thus, we have to try both everywhere :-/ # Reconnect the bot if it's killed. if self.ism.isMyBot(n00b): if self.ism.syncd: self.pushBotJoin(do_nick=True) return l33t = self.ism.findUser(l33t).inick # If n00b is a Dtella node, kick 'em. n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode( n, l33t, "KILL: " + reason, send_quit=False) return # If n00b is an IRC user, treat it like a QUIT. try: n00b_u = self.ism.findUser(n00b) except KeyError: LOG.warning("Tried to KILL unknown user: %s" % n00b) return message = ( "%s has KILL'd %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b_u.inick), reason)) self.ism.removeUser(n00b_u, message)
def handleCmd_KILL(self, prefix, args): l33t = prefix n00b = args[0] reason = irc_strip(args[1]) # In most cases, n00b is a UUID, but Anope seems to still use a nick. # Thus, we have to try both everywhere :-/ # Reconnect the bot if it's killed. if self.ism.isMyBot(n00b): if self.ism.syncd: self.pushBotJoin(do_nick=True) return l33t = self.ism.findUser(l33t).inick # If n00b is a Dtella node, kick 'em. n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode(n, l33t, "KILL: " + reason, send_quit=False) return # If n00b is an IRC user, treat it like a QUIT. try: n00b_u = self.ism.findUser(n00b) except KeyError: LOG.warning("Tried to KILL unknown user: %s" % n00b) return message = ("%s has KILL'd %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b_u.inick), reason)) self.ism.removeUser(n00b_u, message)
def handleCmd_TOPIC(self, prefix, args): # :Paul TOPIC #dtella Paul 1169420711 :Dtella :: Development Stage chan = args[0] whoset = args[1] text = irc_strip(args[-1]) scfg = getServiceConfig() if chan == scfg.channel: self.ism.setTopic(whoset, text)
def handleCmd_FTOPIC(self, prefix, args): # :268 FTOPIC #dtella 1238306219 nick!host :hello chan = args[0] whoset = args[2].split('!', 1)[0] text = irc_strip(args[-1]) scfg = getServiceConfig() if chan == scfg.channel: self.ism.setTopic(whoset, text)
def handleCmd_TOPIC(self, prefix, args): # :268AAAAAO TOPIC #dtella :hello world whoset_uuid = prefix chan = args[0] text = irc_strip(args[-1]) scfg = getServiceConfig() if chan == scfg.channel: whoset = self.ism.findUser(whoset_uuid).inick self.ism.setTopic(whoset, text)
def handleCmd_NOTICE(self, prefix, args): src_nick = prefix target = args[0] text = irc_strip(args[1]) flags = core.NOTICE_BIT scfg = getServiceConfig() if target == scfg.channel: self.ism.sendChannelMessage(src_nick, text, flags) else: n = self.ism.findDtellaNode(inick=target) if n: self.ism.sendPrivateMessage(n, src_nick, text, flags)
def handleCmd_KILL(self, prefix, args): # :darkhorse KILL }darkhorse :dhirc.com!darkhorse (TEST!!!) l33t = prefix n00b = args[0] reason = "KILL: " + irc_strip(args[1]) if n00b.lower() == self.ism.bot_user.inick.lower(): if self.ism.syncd: self.pushBotJoin(do_nick=True) return n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode(n, l33t, reason, send_quit=False) else: message = "%s has KILL'd %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b), reason) self.ism.removeUser(self.ism.findUser(n00b), message)
def handleCmd_KILL(self, prefix, args): # :darkhorse KILL }darkhorse :dhirc.com!darkhorse (TEST!!!) l33t = prefix n00b = args[0] reason = "KILL: " + irc_strip(args[1]) if n00b.lower() == self.ism.bot_user.inick.lower(): if self.ism.syncd: self.pushBotJoin(do_nick=True) return n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode(n, l33t, reason, send_quit=False) else: message = ("%s has KILL'd %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b), reason)) self.ism.removeUser(self.ism.findUser(n00b), message)
def handleCmd_KICK(self, prefix, args): chan = args[0] l33t = prefix n00b = args[1] reason = irc_strip(args[2]) scfg = getServiceConfig() if chan != scfg.channel: return if n00b.lower() == self.ism.bot_user.inick.lower(): if self.ism.syncd: self.pushBotJoin() return n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode(n, l33t, reason) else: message = "%s has kicked %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b), reason) CHECK(self.ism.partChannel(self.ism.findUser(n00b), message))
def handleCmd_KICK(self, prefix, args): chan = args[0] l33t = prefix n00b = args[1] reason = irc_strip(args[2]) scfg = getServiceConfig() if chan != scfg.channel: return if n00b.lower() == self.ism.bot_user.inick.lower(): if self.ism.syncd: self.pushBotJoin() return n = self.ism.findDtellaNode(inick=n00b) if n: self.ism.kickDtellaNode(n, l33t, reason) else: message = ("%s has kicked %s: %s" % (irc_to_dc(l33t), irc_to_dc(n00b), reason)) CHECK(self.ism.partChannel(self.ism.findUser(n00b), message))