Switch to edit mode.
Name(s): display_message1: ":display_message(preamble, msg, postscript) --- prints msg to player. postscript is text to go after the message body." 2: {preamble, message, ?postscript = {}} = args 3: "Timezone hack. Originally done to the date field, expanded to the entire message after Quadir proposed the idea. Quite the messy little hack." 4: newmessage = {} 5: for x in (message) 6: newline = "" 7: while (match = match(x, $time_utils.ctime_regexp)) 8: newline = tostr(newline, x[1..match[$][1] - 1]) 9: newline = `tostr(newline, this:ctime(x[match[$][1]..match[$][2]])) ! ANY => tostr(newline, x[match[$][1]..match[$][2]])' 10: x = x[match[$][2] + 1..$] 11: endwhile 12: newline = tostr(newline, x) 13: newmessage = {@newmessage, newline} 14: endfor 15: try 16: player:tell({@preamble, @newmessage, @postscript, "--------------------------"}) 17: except e (ANY) 18: try 19: oro = player.output_rendering_object 20: player.output_rendering_object = $stripped_renderer 21: player:tell({"--- WARNING: This message contained broken HTML, which was removed ---", @preamble, @newmessage, @postscript, "--------------------------"}) 22: player.output_rendering_object = oro 23: except e2 (ANY) 24: player.output_rendering_object = oro 25: player:tell({tostr("An error was encountered while trying to display the message: ", e[1], " (", toliteral(e[1]), ")"), "", "This message cannot be displayed in-MOO, probably due to excessive or poorly written HTML markup. To avoid seeing this message, discourage the sender from sending HTML emails in the future. Plain text works great!", "", "In the meantime, if you really need to read the message, try @netforwarding it to your real email address and see if that helps."}) 26: raise(e) 27: endtry 28: endtry 29: "Last modified by whiz (#3135) on Sat Jan 19 16:52:35 2008 EST."