示例#1
0
 def botErrorReporter(text):
     dch = dtMain.dch
     if dch:
         dch.bot.say(
             "Something bad happened.  You might want to email this to "
             "[email protected] so we'll know about it:\n"
             "Version: %s %s\n%s" %
             (local.hub_name, get_version_string()[3:], text))
示例#2
0
 def botErrorReporter(text):
     dch = dtMain.dch
     if dch:
         dch.bot.say(
             "Something bad happened.  You might want to email this to "
             "[email protected] so we'll know about it:\n"
             "Version: %s %s\n%s" %
             (local.hub_name, get_version_string()[3:], text))
示例#3
0
文件: dc.py 项目: LiPeK/dtella
    def formatMyInfo(self):
        # Build and return a hacked-up version of my info string.

        # Get version string
        ver_string = get_version_string()

        # Split info string
        try:
            info = split_info(self.info)
        except ValueError:
            # No info.  Just use the offline version tag
            return "<%s>" % ver_string

        # Split description into description and <tag>
        desc, tag = split_tag(info[0])

        # Update tag
        if tag:
            info[0] = "%s<%s,%s>" % (desc, tag, ver_string)
        else:
            info[0] = "%s<%s>" % (desc, ver_string)

        if local.use_locations:
            # Try to get my location name.
            try:
                ad = Ad().setRawIPPort(self.main.osm.me.ipp)
                loc = self.main.location[ad.getTextIP()]
            except (AttributeError, KeyError):
                loc = None

            # If I got a location name, splice it into my connection field
            if loc:
                # Append location suffix, if it exists
                suffix = self.main.state.suffix
                if suffix:
                    loc = '%s|%s' % (loc, suffix)
                
                info[2] = loc + info[2][-1:]

        info = '$'.join(info)

        if len(info) > 255:
            self.pushStatus("*** Your info string is too long!")
            info = ''

        return info
示例#4
0
    def formatMyInfo(self):
        # Build and return a hacked-up version of my info string.

        # Get version string
        ver_string = get_version_string()

        # Split info string
        try:
            info = split_info(self.info)
        except ValueError:
            # No info.  Just use the offline version tag
            return "<%s>" % ver_string

        # Split description into description and <tag>
        desc, tag = split_tag(info[0])

        # Update tag
        if tag:
            info[0] = "%s<%s,%s>" % (desc, tag, ver_string)
        else:
            info[0] = "%s<%s>" % (desc, ver_string)

        if local.use_locations:
            # Try to get my location name.
            try:
                ad = Ad().setRawIPPort(self.main.osm.me.ipp)
                loc = self.main.location[ad.getTextIP()]
            except (AttributeError, KeyError):
                loc = None

            # If I got a location name, splice it into my connection field
            if loc:
                # Append location suffix, if it exists
                suffix = self.main.state.suffix
                if suffix:
                    loc = '%s|%s' % (loc, suffix)

                info[2] = loc + info[2][-1:]

        info = '$'.join(info)

        if len(info) > 255:
            self.pushStatus("*** Your info string is too long!")
            info = ''

        return info