Ejemplo n.º 1
0
    def func(self):
        "Implementing the function"
        caller = self.caller
        args = self.args

        if not args:
            caller.msg("Usage: @boot[/switches] <player> [:reason]")
            return

        if ':' in args:
            args, reason = [a.strip() for a in args.split(':', 1)]
        else:
            args, reason = args, ""

        boot_list = []

        if 'port' in self.switches:
            # Boot a particular port.
            sessions = SESSIONS.get_session_list(True)
            for sess in sessions:
                # Find the session with the matching port number.
                if sess.getClientAddress()[1] == int(args):
                    boot_list.append(sess)
                    break
        else:
            # Boot by player object
            pobj = search.player_search(args)
            if not pobj:
                self.caller("Player %s was not found." % pobj.key)
                return
            pobj = pobj[0]
            if not pobj.access(caller, 'boot'):
                string = "You don't have the permission to boot %s."
                pobj.msg(string)
                return
            # we have a bootable object with a connected user
            matches = SESSIONS.sessions_from_player(pobj)
            for match in matches:
                boot_list.append(match)

        if not boot_list:
            caller.msg(
                "No matching sessions found. The Player does not seem to be online."
            )
            return

        # Carry out the booting of the sessions in the boot list.

        feedback = None
        if not 'quiet' in self.switches:
            feedback = "You have been disconnected by %s.\n" % caller.name
            if reason:
                feedback += "\nReason given: %s" % reason

        for session in boot_list:
            session.msg(feedback)
            pobj.disconnect_session_from_player(session.sessid)
Ejemplo n.º 2
0
    def func(self):
        "Implementing the function"
        caller = self.caller
        args = self.args

        if not args:
            caller.msg("Usage: @boot[/switches] <player> [:reason]")
            return

        if ":" in args:
            args, reason = [a.strip() for a in args.split(":", 1)]
        else:
            args, reason = args, ""

        boot_list = []

        if "port" in self.switches:
            # Boot a particular port.
            sessions = SESSIONS.get_session_list(True)
            for sess in sessions:
                # Find the session with the matching port number.
                if sess.getClientAddress()[1] == int(args):
                    boot_list.append(sess)
                    break
        else:
            # Boot by player object
            pobj = search.player_search(args)
            if not pobj:
                self.caller("Player %s was not found." % pobj.key)
                return
            pobj = pobj[0]
            if not pobj.access(caller, "boot"):
                string = "You don't have the permission to boot %s."
                pobj.msg(string)
                return
            # we have a bootable object with a connected user
            matches = SESSIONS.sessions_from_player(pobj)
            for match in matches:
                boot_list.append(match)

        if not boot_list:
            caller.msg("No matching sessions found. The Player does not seem to be online.")
            return

        # Carry out the booting of the sessions in the boot list.

        feedback = None
        if not "quiet" in self.switches:
            feedback = "You have been disconnected by %s.\n" % caller.name
            if reason:
                feedback += "\nReason given: %s" % reason

        for session in boot_list:
            session.msg(feedback)
            pobj.disconnect_session_from_player(session.sessid)
Ejemplo n.º 3
0
    def func(self):
        "Implements the command."

        caller = self.caller
        args = self.args

        if hasattr(caller, "player"):
            caller = caller.player

        if not args:
            self.msg("Usage: @delplayer <player/user name or #id> [: reason]")
            return

        reason = ""
        if ":" in args:
            args, reason = [arg.strip() for arg in args.split(":", 1)]

        # We use player_search since we want to be sure to find also players
        # that lack characters.
        players = search.player_search(args)

        if not players:
            self.msg("Could not find a player by that name.")
            return

        if len(players) > 1:
            string = "There were multiple matches:"
            for player in players:
                string += "\n %s %s" % (player.id, player.key)
            return

        # one single match

        player = players.pop()

        if not player.access(caller, "delete"):
            string = "You don't have the permissions to delete that player."
            self.msg(string)
            return

        uname = player.username
        # boot the player then delete
        self.msg("Informing and disconnecting player ...")
        string = "\nYour account '%s' is being *permanently* deleted.\n" % uname
        if reason:
            string += " Reason given:\n  '%s'" % reason
        player.msg(string)
        player.delete()
        self.msg("Player %s was successfully deleted." % uname)
Ejemplo n.º 4
0
    def func(self):
        "Implements the command."

        caller = self.caller
        args = self.args

        if hasattr(caller, 'player'):
            caller = caller.player

        if not args:
            self.msg("Usage: @delplayer <player/user name or #id> [: reason]")
            return

        reason = ""
        if ':' in args:
            args, reason = [arg.strip() for arg in args.split(':', 1)]

        # We use player_search since we want to be sure to find also players
        # that lack characters.
        players = search.player_search(args)

        if not players:
            self.msg('Could not find a player by that name.')
            return

        if len(players) > 1:
            string = "There were multiple matches:"
            for player in players:
                string += "\n %s %s" % (player.id, player.key)
            return

        # one single match

        player = players.pop()

        if not player.access(caller, 'delete'):
            string = "You don't have the permissions to delete that player."
            self.msg(string)
            return

        uname = player.username
        # boot the player then delete
        self.msg("Informing and disconnecting player ...")
        string = "\nYour account '%s' is being *permanently* deleted.\n" % uname
        if reason:
            string += " Reason given:\n  '%s'" % reason
        player.msg(string)
        player.delete()
        self.msg("Player %s was successfully deleted." % uname)