News #53

Parent #37Owner #29Flags readSource hellcore/hellcore.db

Aliases: News

21 verbs · 35 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
descriptionthis none thisrxd#536
is_writable_bythis none thisrxd#531
rm_message_seqthis none thisrxd#538
undo_rmmthis none thisrxd#537
expunge_rmmthis none thisrxd#535
set_current_newsthis none thisrxd#5317
add_current_newsthis none thisrxd#535
rm_current_newsthis none thisrxd#535
news_display_seq_fullthis none thisrxd#5315
to_textthis none thisrxd#539
checkthis none thisrxd#5310
touchthis none nonerxd#5312
@addnewsany at/to thisrxd#5317
@rmnewsany out of/from inside/from thisrxd#5317
@setnewsthis at/to anyrxd#5319
_parsethis none thisrxd#5313
init_for_corethis none thisrxd#5318
add_newsthis none thisrxd#5315
rm_newsthis none thisrxd#5315
@listnewsnone on top of/on/onto/upon thisrxd#532
@clearnewsthis none nonerxd#537

Properties

PropertyDefinerFlagsOwnerValue
current_news#53rc#29{1}
last_news_time#53rc#290
current_news_going#53rc#29{}
archive_news#53rc#29{}
moderator_notify#37rc#29<clear>
last_msg_date#37r#290
messages_going#37#29{}
moderated#37rc#291
moderator_forward#37rc#29"%n (%#) can't send to moderated list %t (%[#t]) directly."
writers#37rc#29{}
readers#37rc#291
mail_notify#37r#29{}
mail_forward#37r#29{}
expire_period#37r#290
last_used_time#37r#290
messages#37#29{}
rmm_own_msgs#37rc#29<clear>
guests_can_send_here#37rc#29<clear>
messages_kept#37r#29{}
registered_email#37#29<clear>
email_validated#37#29<clear>
validation_password#37#29<clear>
barcolor#37rc#29<clear>
hidden_subjects#37rc#29<clear>
hidden_content#37rc#29<clear>
aliases#1r#29{"News"}
description#1rc#29"It's the current issue of the News, dated %d."
object_size#1r#29{41569, 1298433815}
hidden_verbs#1rc#29<clear>
phelp_msg#1rc#29<clear>
weight#1rc#29<clear>
owner_verbs#1rc#29<clear>
plural_name#1rc#29<clear>
client_image#1rc#29<clear>
listening#1rc#29<clear>

Ancestry

Ancestors (nearest first): #37 Generic Mail Recipient#1 root

Children: none

Call graph

calls n53_1 #53:is_writable_by n45_22 #45:descendants n53_1->n45_22 n37_2 #37:is_writable_by n53_1->n37_2 n53_2 #53:rm_message_seq n37_14 #37:ok_write n53_2->n37_14 n27_20 #27:intersection n53_2->n27_20 n27_18 #27:contract n53_2->n27_18 n53_3 #53:undo_rmm n53_3->n37_14 n27_3 #27:union n53_3->n27_3 n27_17 #27:expand n53_3->n27_17 n53_4 #53:expunge_rmm n53_4->n37_14 n53_5 #53:set_current_news n53_5->n37_14 n27_11 #27:last n53_5->n27_11 n37_15 #37:parse_message_seq n53_5->n37_15 n53_11 #53:touch n53_5->n53_11 n53_11->n37_14 n6_9 #6:notify n53_11->n6_9 n48_8 #48:suspend_if_needed n53_11->n48_8 n53_6 #53:add_current_news n53_6->n37_14 n53_6->n27_3 n53_6->n53_5 n53_7 #53:rm_current_news n53_7->n37_14 n53_7->n27_20 n53_7->n53_5 n27_2 #27:complement n53_7->n27_2 n53_8 #53:news_display_seq_full n53_8->n37_15 n53_0 #53:description n53_8->n53_0 n53_8->n6_9 n47_11 #47:reverse n53_8->n47_11 n6_10 #6:notify_lines n53_8->n6_10 n53_9 #53:to_text n53_8->n53_9 n53_8->n48_8 n20_14 #20:uppercase n53_9->n20_14 n35_11 #35:time_sub n53_9->n35_11 n53_10 #53:check n107_43 #107:tell n53_10->n107_43 n53_12 #53:@addnews n53_12->n53_1 n53_12->n37_15 n53_12->n6_9 n53_17 #53:add_news n53_12->n53_17 n53_17->n37_14 n53_17->n27_3 n53_17->n53_5 n53_15 #53:_parse n53_17->n53_15 n63_0 #63:raise n53_17->n63_0 n53_13 #53:@rmnews n53_13->n53_1 n53_13->n37_15 n53_13->n6_9 n53_18 #53:rm_news n53_13->n53_18 n53_18->n37_14 n53_18->n27_20 n53_18->n53_5 n53_18->n27_2 n53_18->n53_15 n53_14 #53:@setnews n53_14->n53_1 n53_14->n53_5 n53_14->n37_15 n53_14->n6_9 n53_14->n53_15 n53_15->n37_15 n20_5 #20:from_list n53_15->n20_5 n53_16 #53:init_for_core n53_16->n53_2 n53_16->n53_4 n53_16->n37_15 n53_16->n53_17 n37_27 #37:init_for_core n53_16->n37_27 n27_16 #27:range n53_16->n27_16 n38_2 #38:send_message n53_16->n38_2 n53_19 #53:@listnews n53_19->n37_15 n53_19->n6_9 n53_20 #53:@clearnews n53_20->n53_1 n53_20->n53_5 n53_20->n6_9

Source

description

Spec this none thisFlags rxdOwner #29Definer #53

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #53

Referenced by

Source

1return pass(@args) || (args[1] in $list_utils:map_prop($object_utils:descendants($wiz), "mail_identity"));

rm_message_seq

Spec this none thisFlags rxdOwner #29Definer #53

Referenced by

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

Spec this none thisFlags rxdOwner #29Definer #53

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

Spec this none thisFlags rxdOwner #29Definer #53

Referenced by

Source

1if (!this:ok_write(caller, caller_perms()))
2return E_PERM;
3endif
4this.current_news_going = {};
5return $mail_agent:(verb)(@args);

set_current_news

Spec this none thisFlags rxdOwner #29Definer #53

Referenced by

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

Spec this none thisFlags rxdOwner #29Definer #53

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

Spec this none thisFlags rxdOwner #29Definer #53

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

Spec this none thisFlags rxdOwner #361Definer #53

Referenced by

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

Spec this none thisFlags rxdOwner #29Definer #53

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #53

Referenced by

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

Spec this none noneFlags rxdOwner #361Definer #53

Referenced by

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

Spec any at/to thisFlags rxdOwner #361Definer #53

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

Spec any out of/from inside/from thisFlags rxdOwner #361Definer #53

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

Spec this at/to anyFlags rxdOwner #361Definer #53

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

Spec this none thisFlags rxdOwner #29Definer #53

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #53

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

Spec this none thisFlags rxdOwner #361Definer #53

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #53

Referenced by

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

Spec none on top of/on/onto/upon thisFlags rxdOwner #361Definer #53

Referenced by

none

Source

1player:notify("The following articles are currently in the newspaper:");
2this:display_seq_headers(this.current_news);

@clearnews

Spec this none noneFlags rxdOwner #29Definer #53

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