# provided in the LICENSE file distributed with this software.
import codecs
+import datetime
import os
import random
import re
self.error = False
self.adjust_echoing()
+ def prompt(self):
+ """"Generate and return an input prompt."""
+
+ # Start with the user's preference, if one was provided
+ prompt = self.account.get("prompt")
+
+ # If the user has not set a prompt, then immediately return the default
+ # provided for the current state
+ if not prompt:
+ return get_menu_prompt(self.state)
+
+ # Return the cooked prompt
+ return "%s " % prompt
+
def adjust_echoing(self):
"""Adjust echoing to match state menu requirements."""
if mudpy.telnet.is_enabled(self, mudpy.telnet.TELOPT_ECHO,
if not just_prompt:
output += "$(eol)"
if add_prompt:
- output += self.account.get("prompt", ">") + " "
+ output += self.prompt()
mode = self.avatar.get("mode")
if mode:
output += "(" + mode + ") "
file_name = ""
max_log_lines = 0
syslog_name = ""
- timestamp = time.asctime()[4:19]
+ timestamp = datetime.datetime.now().isoformat(' ')
# turn the message into a list of nonempty lines
lines = [x for x in [(x.rstrip()) for x in message.split("\n")] if x != ""]