MCP package registry #312
Aliases: MCP package registry, registry
8 verbs · 13 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
add_package | this none this | rxd | #312 | 11 |
remove_package | this none this | rxd | #312 | 9 |
match_package | this none this | rxd | #312 | 6 |
package_name | this none this | rxd | #312 | 6 |
packages | this none this | rxd | #312 | 1 |
init_for_module init_for_core | this none this | rxd | #312 | 9 |
nominate_for_core | this none this | rxd | #312 | 6 |
@add-package @remove-package | any at/to this | rd | #312 | 23 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
package_names | #312 | r | #29 | {"mcp-negotiate", "mcp-cord", "dns-com-awns-status", "dns-com-vmoo-client", "dns-org-hellmoo-status", "dns-nl-icecrew-serverinfo"} |
packages | #312 | r | #29 | {#451510, #214869, #18678, #522013, #394474, #176127} |
core_package_names | #312 | r | #29 | {"mcp-negotiate", "mcp-cord"} |
aliases | #1 | rc | #29 | {"MCP package registry", "registry"} |
description | #1 | rc | #29 | <clear> |
object_size | #1 | r | #29 | {5092, 1298434676} |
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): #1 root
Children: none
Call graph
Source
add_package
Referenced by
- #312:@add-package line 13:
this:add_package
Source
1{name, package} = args; 2if ((caller == this) || $perm_utils:controls(caller_perms(), this)) 3if (name in this.package_names) 4raise(E_INVARG, "Another package with that name already exists"); 5elseif (package in this.packages) 6raise(E_INVARG, "That package already is registered under a different name."); 7else 8this.package_names = {@this.package_names, name}; 9this.packages = {@this.packages, package}; 10endif 11endif
remove_package
Referenced by
- #312:init_for_module line 7:
this:remove_package - #312:@add-package line 16:
this:remove_package
Source
1{name} = args; 2if ((caller == this) || $perm_utils:controls(caller_perms(), this)) 3if (idx = name in this.package_names) 4this.package_names = listdelete(this.package_names, idx); 5this.packages = listdelete(this.packages, idx); 6else 7raise(E_INVARG, "Not a defined package"); 8endif 9endif
match_package
Referenced by
- #312:nominate_for_core line 4:
this:match_package
Source
1{name} = args; 2if (idx = name in this.package_names) 3return this.packages[idx]; 4else 5return $failed_match; 6endif
package_name
Referenced by
none
Source
1{package} = args; 2if (idx = package in this.packages) 3return this.package_names[idx]; 4else 5return ""; 6endif
packages
Referenced by
none
Source
1return $list_utils:make_alist({this.package_names, this.packages});
init_for_module init_for_core
Referenced by
none
Source
1"Usage: :init_for_module()"; 2if (((!$__core_init_phase) && (caller != this)) && (!$perm_utils:controls(caller_perms(), this))) 3raise(E_PERM); 4endif 5for name in (this.package_names) 6if (!(name in this.core_package_names)) 7this:remove_package(name); 8endif 9endfor
nominate_for_core
Referenced by
none
Source
1corenames = this.core_package_names; 2corepackages = {}; 3for name in (corenames) 4corepackages = {@corepackages, this:match_package(name)}; 5endfor 6return {@pass(@args), @corepackages};
@add-package @remove-package
Referenced by
none
Source
1if (!$perm_utils:controls(player, this)) 2player:tell("You don't have permission to add or remove MCP 2.1 packages."); 3elseif ($command_utils:object_match_failed(dobj, dobjstr)) 4elseif (!$object_utils:isa(dobj, $mcp.package)) 5player:tell(dobj.name, " is not a valid MCP 2.1 package (descendant of ", $mcp.package, ")."); 6elseif (!$perm_utils:controls(player, dobj)) 7player:tell("You don't control ", dobj.name, " in order to add or remove it."); 8else 9name = dobj.name; 10package = dobj; 11try 12if (verb == "@add-package") 13this:add_package(name, package); 14player:tell("Added ", package.name, "."); 15else 16this:remove_package(name); 17player:tell("Removed ", package.name, "."); 18endif 19except v (ANY) 20{code, message, value, tb} = v; 21player:tell(code, ": ", message); 22endtry 23endif