Exemple #1
0
    def handleCmd_WHOIS(self, prefix, args):
        # Somewhat simplistic handling of WHOIS requests
        if not (prefix and len(args) >= 1):
            return

        src = prefix
        who = args[-1]
        scfg = getServiceConfig()

        if who.lower() == self.ism.bot_user.inick.lower():
            self.pushWhoisReply(311, src, who, B_USER, scfg.my_host, '*',
                                B_REALNAME)
            self.pushWhoisReply(312, src, who, scfg.my_host, scfg.my_name)
            self.pushWhoisReply(319, src, who, scfg.channel)
        else:
            n = self.ism.findDtellaNode(inick=who)
            if not (n and hasattr(n, 'hostmask')):
                return

            self.pushWhoisReply(311, src, who, n_user(n.ipp), n.hostmask, '*',
                                "Dtella %s" % n.dttag[3:])
            self.pushWhoisReply(312, src, who, scfg.my_host, scfg.my_name)
            self.pushWhoisReply(319, src, who, scfg.channel)

            if local.use_locations:
                self.pushWhoisReply(
                    320, src, who,
                    "Location: %s" % local.hostnameToLocation(n.hostname))

        self.pushWhoisReply(318, src, who, "End of /WHOIS list.")
Exemple #2
0
    def handleCmd_WHOIS(self, prefix, args):
        # Somewhat simplistic handling of WHOIS requests
        if not (prefix and len(args) >= 1):
            return

        src = prefix
        who = args[-1]
        scfg = getServiceConfig()

        if who.lower() == self.ism.bot_user.inick.lower():
            self.pushWhoisReply(311, src, who, B_USER, scfg.my_host, "*", B_REALNAME)
            self.pushWhoisReply(312, src, who, scfg.my_host, scfg.my_name)
            self.pushWhoisReply(319, src, who, scfg.channel)
        else:
            n = self.ism.findDtellaNode(inick=who)
            if not (n and hasattr(n, "hostmask")):
                return

            self.pushWhoisReply(311, src, who, n_user(n.ipp), n.hostmask, "*", "Dtella %s" % n.dttag[3:])
            self.pushWhoisReply(312, src, who, scfg.my_host, scfg.my_name)
            self.pushWhoisReply(319, src, who, scfg.channel)

            if local.use_locations:
                self.pushWhoisReply(320, src, who, "Location: %s" % local.hostnameToLocation(n.hostname))

        self.pushWhoisReply(318, src, who, "End of /WHOIS list.")
Exemple #3
0
        def cb(hostname):

            # Use local_config to transform this hostname into a
            # human-readable location
            loc = local.hostnameToLocation(hostname)

            # If we got a location, save it, otherwise dump the
            # dictionary entry
            if loc:
                self.location[my_ip] = loc
            else:
                del self.location[my_ip]

            # Maybe send an info update
            if self.osm:
                self.osm.updateMyInfo()
Exemple #4
0
        def cb(hostname):

            # Use local_config to transform this hostname into a
            # human-readable location
            loc = local.hostnameToLocation(hostname)

            # If we got a location, save it, otherwise dump the
            # dictionary entry
            if loc:
                self.location[my_ip] = loc
            else:
                del self.location[my_ip]

            # Maybe send an info update
            if self.osm:
                self.osm.updateMyInfo()