/
CDC-1.2b/
CDC-1.2b/src/
parent $note
object $news

var $root child_index 0
var $root owners [$news]
var $root fertile 0
var $has_verbs verbs #[]
var $located location $creation
var $ seperator 0
var $root inited 1
var $root owned [$news]
var $news last_write_time 0
var $news readers #[[$, 794117886]]
var $gendered gender $gender_neuter
var $located obvious 1
var $described prose #[['short, ["The latest comments from your local admins.  Last written on at: %time."]]]
var $root manager $news
var $root writable [$news]
var $root readable ['methods, 'code]
var $root dbref 'news
var $named name ['uniq, "News"]
var $named name_aliases ["news"]
var $text text ["There is a Cold Dark mailing list.  Subscribe/Unsubscribe to it by sending a message to 'majordomo@tiny.mcs.usu.edu' with a mail body of 'subscribe tcd' or 'unsubscribe tcd'.  Send to the list via 'tcd@tiny.mcs.usu.edu'.", "", "If you encounter any problems, feel free to connect at the Cold Dark via:", "", "    telnet://recumbent.declab.usu.edu:1138/", ""]
var $public public ['readable]

method read_vrb
    arg [args];
    
    pass(@args);
    readers = dict_add(readers, sender(), time());
.

method new
    // returns true if the sender has not read recent news
    // first see if they have even read the news
    if (!(sender() in dict_keys(readers)))
        return 1;
    if ((readers[sender()]) < last_write_time)
        return 1;
    return 0;
.

method short_description
    arg [args];
    var text, x;
    
    text = pass(@args);
    for x in [1 .. listlen(text)]
        text = replace(text, x, strsub(text[x], "%time", $time.ldate(last_write_time)));
    return text;
.

method validate_readers
    var x, new;
    
    .perms(sender(), 'system);
    new = #[];
    for x in (readers) {
        if (valid(x[1]))
            new = dict_add(new, x[1], x[2]);
    }
    readers = new;
.

method prose
    arg [args];
    var prose, x, lines;
    
    prose = (> pass(@args) <);
    if (type(prose) == 'dictionary)
        lines = (| prose['short] |);
    else
        lines = prose;
    if (lines) {
        for x in [1 .. listlen(lines)]
            lines = replace(lines, x, strsub(lines[x], "%time", $time.date(last_write_time)));
    }
    if (type(prose) == 'dictionary)
        return dict_add(prose, 'short, lines);
    else
        return lines;
.

method last_updated_on
    arg type;
    
    switch (type) {
        case 'string:
            return $time.date(last_write_time);
        case 'integer:
            return last_write_time;
    }
.

method write_vrb
    arg [args];
    
    pass(@args);
    last_write_time = time();
.

method coreify_news
    (> .perms(caller(), $sys) <);
    .set_text(["There is a Cold Dark mailing list.  Subscribe/Unsubscribe to it by sending a message to 'majordomo@tiny.mcs.usu.edu' with a mail body of 'subscribe tcd' or 'unsubscribe tcd'.  Send to the list via 'tcd@tiny.mcs.usu.edu'.", "", "If you encounter any problems, feel free to connect at the Cold Dark via:", "", "    telnet://recumbent.declab.usu.edu:1138/", ""]);
    readers = #[];
    last_write_time = 0;
.