View/Edit #47:www_read

Switch to edit mode.

Name(s): www_read
1:  "Return a nice HTML rendering of the requested message."
2:  "Bits of this verb are similar to $mail_agent:to_text"
3:  set_task_perms(caller_perms())
4:  {ng, msgnum} = args
5:  try
6:    "call_verb is used here to drop $mail_agent's super perm bypassing abilities by making $mail_agent not the caller of get_message."
7:    message = $call_verb(ng, "get_message", msgnum)
8:  except error (ANY)
9:    "Oops - no such message?"
10:   return 0
11: endtry
12: if (typeof(message) == $ERR)
13:   return message
14: endif
15: date = message[1]
16: "Find out who sent the message (for their signature)"
17: try
18:   delim = match(message[2], "(%(#[0-9]*%))")[$][3][2..$ - 1]
19: except (E_RANGE)
20:   delim = {1, length(message[2])}
21: endtry
22: sender = toobj(delim)
23: from = message[2]
24: from = $newsgroup:parse_address4web(from)
25: to = message[3]
26: to = $newsgroup:parse_address4web(to)
27: subj = message[4]
28: ret = "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>"
29: ret = tostr(ret, "<TR><TD VALIGN='top'><B>Subject: </B></TD><TD> <B>", subj, "</B></TD></TR>")
30: ret = tostr(ret, "<TR><TD VALIGN='top'><B>From: </B></TD><TD> ", from, "</TD></TR>")
31: ret = tostr(ret, "<TR><TD VALIGN='top'><B>Date: </B></TD><TD> ", player.user:ctime(date), "</TD></TR>")
32: ret = tostr(ret, "<TR><TD VALIGN='top'><B>To: </B></TD><TD> ", to, "</TD></TR>")
33: ret = {ret + "</TABLE><BR>", "<TT>"}
34: for x in (message[6..$])
35:   ret = {@ret, tostr($html_utils:munge_by_autohyperlink($html_utils:structured_phrase_recognition(x)), "<br>")}
36: endfor
37: ret = {@ret, "</TT>"}
38: sig = ""
39: if (player.user:mail_option("sigs") && $mail_agent:is_recipient(sender))
40:   try
41:     sig = $code_utils:verb_or_property(sender, "sig", message[3], message[1], message[4])
42:   except v (ANY)
43:     sig = tostr("Signature error: ", v[1])
44:   endtry
45:   if (typeof(sig) == $LIST)
46:     sig = $su:uncrunch(sig)
47:     sig = $su:from_list(sig, "<BR>")
48:   endif
49:   if (sig)
50:     sig = strsub(sig, "  ", "  ")
51:     sig = strsub(sig, "<BR> ", "<BR> ")
52:     sig = "<br><table CELLPADDING=0 CELLSPACING=0 border=1 width='100%'><tr><td><TT>" + sig + "</TT></td></tr></table>"
53:   endif
54: else
55:   sig = {}
56: endif
57: ret = {@ret, @sig}
58: id = ng:get_message_id(toint(msgnum))
59: if (player.user != $no_one)
60:   $mail_db:set_message_read(id, player.user, ng)
61: endif
62: return ret
63: "Last modified by whiz (#3135) on Tue Mar 25 12:42:24 2008 EDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

[home | help | who | search | setup | code]