chat-cli: revive chat creation and add group association
+$ glyph char
++ glyphs "!@#$%^&()-=_+[]\{}'\\:\",.<>?"
::
-+$ nu-security ?(%channel %village %village-with-group)
++$ nu-security ?(%channel %village)
::
+$ command
$% [%target (set target)] :: set messaging target
::
::
:: create chat
- [%create nu-security path (unit glyph) (unit ?)]
+ [%create nu-security path (unit resource) (unit glyph) (unit ?)]
[%delete path] :: delete chat
[%invite [? path] (set ship)] :: allow
[%banish [? path] (set ship)] :: disallow
::
++ target-to-path
|= target
- %+ weld
- ?:(in-group ~ /~)
[(scot %p ship) path]
:: +path-to-target: deduces a target from a mailbox path
::
security
;~ plug
path
+ (punt ;~(pfix ace resource))
(punt ;~(pfix ace glyph))
(punt ;~(pfix ace (fuss 'y' 'n')))
==
:: ;~(pfix ace ;~(plug i.opt $(opt t.opt)))
:: --
::
+ ++ resource ;~((glue net) ship sym)
++ tag |*(a=@tas (cold a (jest a))) ::TODO into stdlib
++ ship ;~(pfix sig fed:ag)
++ path ;~(pfix net ;~(plug urs:ab (easy ~))) ::NOTE short only, tmp
:: +security: security mode
::
++ security
- (perk %channel %village-with-group %village ~)
+ (perk %channel %village ~)
::
:: +glyph: shorthand character
::
:: +create: new local mailbox
::
++ create
- |= [security=nu-security =path gyf=(unit char) allow-history=(unit ?)]
+ |= $: security=nu-security
+ =path
+ ugroup=(unit resource)
+ gyf=(unit char)
+ allow-history=(unit ?)
+ ==
^- (quip card _state)
- =/ with-group=? ?=(%village-with-group security)
+ =/ with-group=? ?=(^ ugroup)
=/ =target [with-group our-self path]
=/ real-path=^path (target-to-path target)
+ =/ group-path=^path ?~(ugroup ship+real-path (en-path:resource u.ugroup))
+ ?< &(?=(%channel security) with-group)
=/ =policy
?- security
%channel *open:policy
- ?(%village %village-with-group) *invite:policy
+ %village *invite:policy
==
?^ (scry-for (unit mailbox:store) %chat-store [%mailbox real-path])
=- [[- ~] state]
(rsh 3 1 (spat path))
''
real-path :: chat
- real-path :: group
+ group-path :: group
policy
~
(fall allow-history %.y)
