View/Edit #1:_kick

Switch to edit mode.

Name(s): _kick
1:  "Begin generic security check (_kick)"
2:  if (verb == "_kick" && !args[1]:isa(this))
3:    raise(E_INVARG, "Illegal object", args[1])
4:    return E_INVARG
5:  endif
6:  "End generic security check (_kick)"
7:  "This verb is executed roughly once a week on every object.  Does basic cleaning."
8:  {object} = args
9:  "Reevaluate the disk size."
10: suspend(0)
11: q = 0
12: for x in (object:filelist())
13:   q = q + `object:filesize(x) ! E_INVARG => 0'
14:   $command_utils:suspend_if_needed()
15: endfor
16: object.obj_disk_size = q
17: "Make sure your owner knows s/he owns you."
18: if (valid(object.owner))
19:   `object.owner.owned_objects = setadd(object.owner.owned_objects, object) ! E_PROPNF'
20: endif
21: if (valid(parent(object)) && parent(object) != $garbage)
22:   "Run through all properties, find inherited +c ones, and make sure the prop is owned by the object's owner."
23:   for x in ($set_utils:difference_suspended(object:all_properties_suspended(), $code_utils.builtin_props))
24:     try
25:       i = property_info(object, x)
26:     except e (ANY)
27:       "This seems to happen on $database objects, since when they are kicked, they delete all their properties and regenerate"
28:       "all while this verb is running. No simple fix, but it's not like databases care much about +c props anyway."
29:     endtry
30:     $command_utils:suspend_if_needed()
31:     if (!(x in properties(object)))
32:       if (index(i[2], "c") && i[1] != object.owner)
33:         set_property_info(object, x, {object.owner, i[2]})
34:       endif
35:       $command_utils:suspend_if_needed()
36:     else
37:       "We want to be able to have properties on objects owned by other people if +-c doesn't matter."
38:     endif
39:   endfor
40: endif
41: "Non-physical non-garbage objects belong nowhere."
42: if (object.location != $nothing && !object:isa($garbage) && !object:isa($physical))
43:   move(object, $nothing)
44: endif
45: "Scan all verbs for invalid $references and mail owner if any are found."
46: rightnow = time()
47: verbnames = verbs(object)
48: for x in [1..length(verbnames)]
49:   owner = verb_info(object, x)[1]
50:   if ($recycler:valid(owner) && `owner.last_login_time ! ANY => 0' + 86400 > rightnow)
51:     bad = $code_utils:bad_ref(object, x)
52:     if (bad)
53:       msg = {tostr("During an automated sweep of the Moo's verbs, I discovered a bug in one of yours.  ", object:nn(), ":\"", verbnames[x], "\" contains the following invalid reference(s):"), "--> " + $su:english_list(bad), "", "You may wish to fix this bug.", "Your faithful servant, The Housekeeper."}
54:       $mail_agent:send_message($housekeeper, {owner}, "Invalid $reference", msg)
55:     endif
56:     bad = $code_utils:bad_obj(object, x)
57:     if (bad)
58:       msg = {tostr("During an automated sweep of the Moo's verbs, I discovered a bug in one of yours.  ", object:nn(), ":\"", verbnames[x], "\" contains the following invalid object number(s):"), "--> " + $su:english_list(bad), "", "You may wish to fix this bug.", "Your faithful servant, The Housekeeper."}
59:       $mail_agent:send_message($housekeeper, {owner}, "Invalid object number", msg)
60:     endif
61:   else
62:     "Got something more useful than wiz-alert?  Feel free to add it.  -- Dax."
63:     "    $wiz_utils:wiz_alert(object:nn(), \" has a verb owned by an invalid object.\")"
64:   endif
65: endfor
66: "Last modified by Dax (#789) on Fri May  5 10:49:13 2017 UTC."

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]