News #53
Aliases: News
21 verbs · 35 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
description | this none this | rxd | #53 | 6 |
is_writable_by | this none this | rxd | #53 | 1 |
rm_message_seq | this none this | rxd | #53 | 8 |
undo_rmm | this none this | rxd | #53 | 7 |
expunge_rmm | this none this | rxd | #53 | 5 |
set_current_news | this none this | rxd | #53 | 17 |
add_current_news | this none this | rxd | #53 | 5 |
rm_current_news | this none this | rxd | #53 | 5 |
news_display_seq_full | this none this | rxd | #53 | 15 |
to_text | this none this | rxd | #53 | 9 |
check | this none this | rxd | #53 | 10 |
touch | this none none | rxd | #53 | 12 |
@addnews | any at/to this | rxd | #53 | 17 |
@rmnews | any out of/from inside/from this | rxd | #53 | 17 |
@setnews | this at/to any | rxd | #53 | 19 |
_parse | this none this | rxd | #53 | 13 |
init_for_core | this none this | rxd | #53 | 18 |
add_news | this none this | rxd | #53 | 15 |
rm_news | this none this | rxd | #53 | 15 |
@listnews | none on top of/on/onto/upon this | rxd | #53 | 2 |
@clearnews | this none none | rxd | #53 | 7 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
current_news | #53 | rc | #29 | {1} |
last_news_time | #53 | rc | #29 | 0 |
current_news_going | #53 | rc | #29 | {} |
archive_news | #53 | rc | #29 | {} |
moderator_notify | #37 | rc | #29 | <clear> |
last_msg_date | #37 | r | #29 | 0 |
messages_going | #37 | | #29 | {} |
moderated | #37 | rc | #29 | 1 |
moderator_forward | #37 | rc | #29 | "%n (%#) can't send to moderated list %t (%[#t]) directly." |
writers | #37 | rc | #29 | {} |
readers | #37 | rc | #29 | 1 |
mail_notify | #37 | r | #29 | {} |
mail_forward | #37 | r | #29 | {} |
expire_period | #37 | r | #29 | 0 |
last_used_time | #37 | r | #29 | 0 |
messages | #37 | | #29 | {} |
rmm_own_msgs | #37 | rc | #29 | <clear> |
guests_can_send_here | #37 | rc | #29 | <clear> |
messages_kept | #37 | r | #29 | {} |
registered_email | #37 | | #29 | <clear> |
email_validated | #37 | | #29 | <clear> |
validation_password | #37 | | #29 | <clear> |
barcolor | #37 | rc | #29 | <clear> |
hidden_subjects | #37 | rc | #29 | <clear> |
hidden_content | #37 | rc | #29 | <clear> |
aliases | #1 | r | #29 | {"News"} |
description | #1 | rc | #29 | "It's the current issue of the News, dated %d." |
object_size | #1 | r | #29 | {41569, 1298433815} |
hidden_verbs | #1 | rc | #29 | <clear> |
phelp_msg | #1 | rc | #29 | <clear> |
weight | #1 | rc | #29 | <clear> |
owner_verbs | #1 | rc | #29 | <clear> |
plural_name | #1 | rc | #29 | <clear> |
client_image | #1 | rc | #29 | <clear> |
listening | #1 | rc | #29 | <clear> |
Ancestry
Ancestors (nearest first): #37 Generic Mail Recipient → #1 root
Children: none
Call graph
Source
description
Referenced by
- #53:news_display_seq_full line 4:
this:description
Source
1raw = ctime(this.last_news_time); 2" 111111111122222"; 3"123456789012345678901234"; 4"Fri Nov 30 14:31:21 1990"; 5date = (raw[1..10] + ",") + raw[20..24]; 6return strsub(this.description, "%d", date);
is_writable_by
Referenced by
- #53:@addnews line 5:
this:is_writable_by - #53:@rmnews line 5:
this:is_writable_by - #53:@setnews line 2:
this:is_writable_by - #53:@clearnews line 2:
this:is_writable_by
Source
1return pass(@args) || (args[1] in $list_utils:map_prop($object_utils:descendants($wiz), "mail_identity"));
rm_message_seq
Referenced by
- #53:init_for_core line 3:
this:rm_message_seq
Source
1if (this:ok_write(caller, caller_perms())) 2seq = args[1]; 3this.current_news_going = $seq_utils:intersection(this.current_news, seq); 4this.current_news = $seq_utils:contract(this.current_news, seq); 5return $mail_agent:(verb)(@args); 6else 7return E_PERM; 8endif
undo_rmm
Referenced by
none
Source
1if (!this:ok_write(caller, caller_perms())) 2return E_PERM; 3endif 4seq = $mail_agent:(verb)(@args); 5this.current_news = $seq_utils:union(this.current_news_going, $seq_utils:expand(this.current_news, seq)); 6this.current_news_going = {}; 7return seq;
expunge_rmm
Referenced by
- #53:init_for_core line 4:
this:expunge_rmm
Source
1if (!this:ok_write(caller, caller_perms())) 2return E_PERM; 3endif 4this.current_news_going = {}; 5return $mail_agent:(verb)(@args);
set_current_news
Referenced by
- #53:add_current_news line 4:
this:set_current_news - #53:rm_current_news line 4:
this:set_current_news - #53:@setnews line 11:
this:set_current_news - #53:add_news line 14:
this:set_current_news - #53:rm_news line 14:
this:set_current_news - #53:@clearnews line 3:
this:set_current_news
Source
1if (!this:ok_write(caller, caller_perms())) 2return E_PERM; 3else 4this.current_news = new = args[1]; 5if (new) 6newlast = $seq_utils:last(new); 7newlasttime = this:messages_in_seq(newlast)[2][1]; 8if (newlasttime > this.last_news_time) 9"... only notify people if there exists a genuinely new item..."; 10this.last_news_time = newlasttime; 11this:touch(); 12endif 13else 14"...flush everything..."; 15this.last_news_time = 0; 16endif 17endif
add_current_news
Referenced by
none
Source
1if (!this:ok_write(caller, caller_perms())) 2return E_PERM; 3else 4return this:set_current_news($seq_utils:union(this.current_news, args[1])); 5endif
rm_current_news
Referenced by
none
Source
1if (!this:ok_write(caller, caller_perms())) 2return E_PERM; 3else 4return this:set_current_news($seq_utils:intersection(this.current_news, $seq_utils:complement(args[1]))); 5endif
news_display_seq_full
Referenced by
- #6:news line 45:
$news:news_display_seq_full
Source
1":news_display_seq_full(msg_seq) => {cur, last-read-date}"; 2"Display the given msg_seq as a collection of news items"; 3set_task_perms(caller_perms()); 4desc = this:description(); 5player:notify((typeof(desc) == LIST) ? desc[1] | desc); 6player:notify(""); 7msgs = $lu:reverse(this:messages_in_seq(args[1])); 8for i in [-(n = length(msgs))..-1] 9x = msgs[-i]; 10player:notify_lines(this:to_text(@x[2])); 11player:notify(""); 12$command_utils:suspend_if_needed(0); 13endfor 14player:notify("(end)"); 15return {msgs[n][1], msgs[n][2][1]};
to_text
Referenced by
- #53:news_display_seq_full line 10:
this:to_text
Source
1":to_text(@msg) => message in text form -- formatted like a $news entry circa October, 1993"; 2date = args[1]; 3by = args[2]; 4"by = by[1..index(by, \"(\") - 2]"; 5subject = (args[4] == " ") ? "-*-NEWS FLASH-*-" | $string_utils:uppercase(args[4]); 6text = args[("" in {@args, ""}) + 1..$]; 7ctime = $time_utils:time_sub("$D, $N $3, $Y", date); 8return {ctime, subject, @text}; 9return {subject, tostr(" by ", by, " on ", ctime), "", @text};
check
Referenced by
- #6:confunc line 15:
$news:check
Source
1set_task_perms(caller_perms()); 2if ((player:get_current_message(this) || {0, 0})[2] < this.last_news_time) 3if ((n = player:mail_option("news")) in {0, "all"}) 4player:tell("There is new news. Type `news' to read all news or `news new' to read just new news."); 5elseif (n == "contents") 6player:tell("There is new news. Type `news all' to read all news or `news new' to read just new news."); 7elseif (n == "new") 8player:tell("There is new news. Type `news' to read new news, or `news all' to read all news."); 9endif 10endif
touch
Referenced by
- #53:set_current_news line 11:
this:touch
Source
1if (!this:ok_write(caller, valid(who = caller_perms()) ? who | player)) 2player:notify("Permission denied."); 3return; 4endif 5fork (0) 6for p in (connected_players()) 7$command_utils:suspend_if_needed(0); 8if ((p:get_current_message(this) || {0, 0})[2] < this.last_news_time) 9p:notify("There's a new edition of the newspaper. Type 'news new' to see the new article(s)."); 10endif 11endfor 12endfork
@addnews
Referenced by
none
Source
1if ((caller_perms() != #-1) && (caller_perms() != player)) 2raise(E_PERM); 3endif 4set_task_perms(player); 5if (!this:is_writable_by(player)) 6player:notify("You can't write the news."); 7elseif (typeof(result = this:add_news(args[1..(prepstr in args) - 1], player:get_current_message(this) || {0, 0})) == STR) 8player:notify(result); 9else 10new = this.current_news; 11if (new) 12player:notify("Current newspaper set."); 13this:display_seq_headers(new); 14else 15player:notify("Current newspaper is now empty."); 16endif 17endif
@rmnews
Referenced by
none
Source
1if ((caller_perms() != #-1) && (caller_perms() != player)) 2raise(E_PERM); 3endif 4set_task_perms(player); 5if (!this:is_writable_by(player)) 6player:notify("You can't write the news."); 7elseif (typeof(result = this:rm_news(args[1..(prepstr in args) - 1], player:get_current_message(this) || {0, 0})) == STR) 8player:notify(result); 9else 10new = this.current_news; 11if (new) 12player:notify("Current newspaper set."); 13this:display_seq_headers(new); 14else 15player:notify("Current newspaper is now empty."); 16endif 17endif
@setnews
Referenced by
none
Source
1set_task_perms(player); 2if (!this:is_writable_by(player)) 3player:notify("You can't write the news."); 4elseif (typeof(seq = this:_parse(strings = args[(prepstr in args) + 1..$], @player:get_current_message(this) || {0, 0})) == STR) 5player:notify(seq); 6else 7old = this.current_news; 8if (old == seq) 9player:notify("No change."); 10else 11this:set_current_news(seq); 12if (seq) 13player:notify("Current newspaper set."); 14this:display_seq_headers(seq); 15else 16player:notify("Current newspaper is now empty."); 17endif 18endif 19endif
_parse
Referenced by
- #6:news line 27:
$news:_parse - #53:@setnews line 4:
this:_parse - #53:add_news line 5:
this:_parse - #53:rm_news line 5:
this:_parse
Source
1if (!(strings = args[1])) 2return "You need to specify a message sequence"; 3elseif (typeof(pms = this:parse_message_seq(@args)) == STR) 4return $string_utils:substitute(pms, {{"%f", "The news"}, {"%<has>", "has"}, {"%%", "%"}}); 5elseif (typeof(pms) != LIST) 6return tostr(pms); 7elseif (length(pms) > 1) 8return tostr("I don't understand `", pms[2], "'."); 9elseif (!(seq = pms[1])) 10return tostr("The News (", this, ") has no `", $string_utils:from_list(pms[2][1..used], " "), "' messages."); 11else 12return seq; 13endif
init_for_core
Referenced by
none
Source
1if (caller_perms().wizard) 2pass(); 3this:rm_message_seq($seq_utils:range(1, this:length_all_msgs())); 4this:expunge_rmm(); 5this.description = "It's the current issue of the News, dated %d."; 6this.mail_forward = {}; 7for p in ({"moderator_forward", "writers", "last_used_time", "mail_notify"}) 8this.(p) = $mail_recipient.(p); 9endfor 10this.moderated = 1; 11this.last_news_time = 0; 12this.readers = 1; 13this.archive_news = {}; 14$mail_agent:send_message(#2, this, "Welcome to LambdaCore", $wiz_utils.new_core_message); 15this:add_news("$"); 16else 17return E_PERM; 18endif
add_news
Referenced by
- #53:@addnews line 7:
this:add_news - #53:init_for_core line 15:
this:add_news
Source
1if (!this:ok_write(caller, caller_perms())) 2$error:raise(E_PERM); 3endif 4{specs, ?cur = {0, 0}} = args; 5seq = this:_parse(specs, @cur); 6if (typeof(seq) == STR) 7return seq; 8endif 9old = this.current_news; 10new = $seq_utils:union(old, seq); 11if (old == new) 12return "Those messages are already in the news."; 13endif 14this:set_current_news(new); 15return 1;
rm_news
Referenced by
- #53:@rmnews line 7:
this:rm_news
Source
1if (!this:ok_write(caller, caller_perms())) 2raise(E_PERM); 3endif 4{specs, ?cur = {0, 0}} = args; 5seq = this:_parse(specs, @cur); 6if (typeof(seq) == STR) 7return seq; 8endif 9old = this.current_news; 10new = $seq_utils:intersection(old, $seq_utils:complement(seq)); 11if (old == new) 12return "Those messages were not in the news."; 13endif 14this:set_current_news(new); 15return 1;
@listnews
Referenced by
none
Source
1player:notify("The following articles are currently in the newspaper:"); 2this:display_seq_headers(this.current_news);
@clearnews
Referenced by
none
Source
1set_task_perms(player); 2if (this:is_writable_by(player)) 3this:set_current_news({}); 4player:notify("Current newspaper is now empty."); 5else 6player:notify("You can't write the news."); 7endif