Various fixes and improvements.

This commit is contained in:
C. Guy Yarvin 2013-10-30 11:26:51 -07:00
parent 658aacf7df
commit 9fd3e1ce1f
4 changed files with 171 additions and 4 deletions

View File

@ -379,7 +379,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(5 vez)
?> =(6 vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -399,7 +399,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 5]
:~ [3 6]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -965,7 +965,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
?. =(5 (end 0 3 pac)) [~ fox]
?. =(6 (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)

133
main/bin/room.hoon Normal file
View File

@ -0,0 +1,133 @@
!:
:: /=main=/bin/room/hoon
::
=> %= .
+
=> +
=> ^/===/lib/pony
=> ^/===/lib/chat
=> |%
++ fool
$: num=@ud :: number received
nym=@t :: text name
sec=sect :: banner
liv=? :: officially live
elf=@da :: last ping
== ::
++ loft ::
$: num=@ud :: (lent meg)
meg=(list zong) :: messages backward
pod=(map ,@p fool) :: individual status
== ::
-- ::
|%
++ fu
|_ [now=@da lov=loft]
++ of
|_ [her=@p ful=fool]
++ abet ..of(pod.lov (~(put by pod.lov) her ful))
++ push
^+ [(list zong) _.]
?. (lth (add ~m2 elf.ful) now) [~ .]
:- %- flip
%+ skim (scag (sub num.lov num.ful) meg.lov)
|= a=zong
?. ?=(%all -.a) &
&(!=(her p.q.a) |(=(%white p.a) =(sec.ful p.a)))
.(num.ful num.lov)
--
::
++ rolf
^+ [(list ,[p=@p q=(list zong)]) _.]
=^ zal meg.luv
%+ ~(rib by meg.luv) *(list ,[p=@p q=(list zong)])
|= [her=@p ful=fool]
^- ,[[p=@p q=(list zong)] fool]
=+ lol=~(push of her ful)
[[her -.lol] ful.+.lol]
[zal +]
::
++ wake
^+ [(list zong) _.]
=^ zal meg.luv
%+ ~(rib by meg.luv) *(list (unit zong))
|= [her=@p ful=fool]
^ [(unit zong) fool]
?. &(liv.ful (gth now (add ~m2 elf.ful))) [~ ful]
[[~ `zong`[%out [her nym.ful]]] ful(liv |)]
:_ +
|- ^- (list zong)
?~(zal ~ =+(laz=$(zal t.zal) ?~(i.zal laz [u.i.zal laz])))
::
++ yowl
|= her=@p
^+ ..of
=+ nog=(~(get by pod) her)
%~ . ..of
:- her
?^ nog u.
=+ ^= gos
%- (hard (unit gcos))
.^(%a (scot %p him) %gcos (scot %da now) ~)
^- fool
:* 0
(numb him now)
^- sect
?. &(?=(^ gos) ?=(%duke -.u.gos)) %white
?.(?=(?(%lord %lady) -.p.u.gos) %white r.p.u.gos)
&
now
==
::
++ yelp
|= [her=@p zig=zing]
^+ [p=(list ,[p=@p q=zong]) q=loft]
?> ?=(%who -.zig)
:- :~ [her
?- -.zig
%all
%ego
%out
%who
:_ lov
=+ all
==
--
--
==
=> %= .
-
:- lov=loft
[who=`@p`-< how=`path`->]
==
|= [est=time *]
|= ~
^- bowl
:- ~ :- ~
:- ^- (list slip)
:~ [/yo [%lq %yo]]
[/re [%ow ~]]
==
|= [now=@da pax=path nut=note]
=. est now
^- bowl
%- pogo
:_ ^$
^- bowl
?+ pax !!
/re ?>(?=(%ow -.nut) [~ ~])
/yo
:_ ~
?> ?=(%lq -.nut)
=+ zig=((hard zing) r.nut)
=^ vey lov abet:(~(yelp fu lov) p.nut now zig)
|- ^- (list gift)
?~ vey ~
=+ mor=$(vey t.vey)
?~ q.i.vey mor
[
(turn vey |=(a=(list ,[p=who zong) [%sq
[vey ~]
==

View File

@ -3,7 +3,9 @@
::
=> %= .
-
:- bud=(sein `@p`-<)
:- :* bud=(sein `@p`-<)
pig=@da
==
[who=`@p`-< how=`path`->]
::
+
@ -40,12 +42,14 @@
==
|= [est=time *]
|= ~
=. pig est
^- bowl
:- ~ :- ~
:- ^- (list slip)
:~ [/oy [%lq %oy]]
[/re [%ow ~]]
[/up [%up %text ": " ""]]
[/wa [%wa pig]]
[/ya [%lq %ya]]
==
|= [now=@da pax=path nut=note]

30
main/lib/chat.hoon Executable file
View File

@ -0,0 +1,30 @@
!:
:: /=main=/lib/chat/hoon
::
|%
++ chat :: user action
$% [%all p=? q=mess] :: broadcast
[%how ~] :: help
[%out ~] :: log out
[%say p=@p q=mess] :: private
[%who ~] :: query users
== ::
++ mess :: message
$% [%do p=@t] :: action
[%ex p=@t q=tank] :: expression
[%qu p=@t] :: quote
== ::
++ user ,[p=@p q=@t] :: downstream identity
++ zing :: client to server
$% [%all p=? q=mess] :: broadcast
[%ego p=@da] :: ping / last active
[%out ~] :: log out
[%who ~] :: query users
== ::
++ zong :: server to client
$% [%all p=sect q=user r=mess] :: broadcast
[%new p=user] :: user joined
[%out p=user] :: user left
[%who p=(list user) q=(list user)] :: users
== ::
--