Check-in [13d5969c77]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bump version number
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 13d5969c7723dca3cf031f6eb8f8ed3a97e49f0d
User & Date: bernd 2020-05-21 14:34:13.669
Context
2020-05-21
17:29
Bump version number check-in: 6df24aed32 user: bernd tags: trunk, 0.9.7-20200521
14:34
Bump version number check-in: 13d5969c77 user: bernd tags: trunk
11:58
Add /want and /fetch for manually fetching check-in: f5ce3e9e3a user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to configure.ac.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

AC_INIT([net2o], [0.9.7-20200514], [bernd@net2o.de], [net2o], [https://fossil.net2o.de/net2o/reportlist])
AC_PREREQ([2.59])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
LT_INIT

AC_MSG_CHECKING([for gforth])








|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

AC_INIT([net2o], [0.9.7-20200521], [bernd@net2o.de], [net2o], [https://fossil.net2o.de/net2o/reportlist])
AC_PREREQ([2.59])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
LT_INIT

AC_MSG_CHECKING([for gforth])

Changes to gui.fs.
1294
1295
1296
1297
1298
1299
1300
1301
1302

1303
1304
1305
1306
1307
1308
1309
    [:  current-player @ ?dup-IF
	    caller-w <> IF
		play$ $@ current-player @ >o to text$ o> +sync
	    THEN
	THEN
	caller-w .text$ play$ $@ str=
	IF
	    addr data $@ >msg-audio-player
	    pause$ $@ caller-w >o to text$ o> +sync

	ELSE
	    pause-play
	    play$ $@ caller-w >o to text$ o> +sync
	THEN  ;]
    2swap $make 64#1 +to msg:timestamp click[] ;

:noname ( addr u type -- )







|
|
>







1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
    [:  current-player @ ?dup-IF
	    caller-w <> IF
		play$ $@ current-player @ >o to text$ o> +sync
	    THEN
	THEN
	caller-w .text$ play$ $@ str=
	IF
	    addr data $@ ['] >msg-audio-player catch 0= IF
		pause$ $@ caller-w >o to text$ o> +sync
	    ELSE  2drop  THEN
	ELSE
	    pause-play
	    play$ $@ caller-w >o to text$ o> +sync
	THEN  ;]
    2swap $make 64#1 +to msg:timestamp click[] ;

:noname ( addr u type -- )
Changes to msg.fs.
350
351
352
353
354
355
356
357

358
359
360
361
362
363
364
365
366
367
368
369
	    bounds ?DO
		I @ to msg-group-o 0 .(avalanche-msg)
	    cell +LOOP
	ELSE  2drop  THEN  cleanup-msg ;] catch
    r> to msg-group-o throw ;

: msg:ihave ( id u1 hash u2 -- )
\    ." ihave:" 2over dump 2dup dump

    2dup ihave$ $+!  2over mehave$ $!
    bounds U+DO  2dup I keysize have# #!ins[]  keysize +LOOP  2drop ;
: pk.host ( -- addr u ) [: pk@ type host$ $. ;] $tmp ;
: >ihave ( hash u -- )
    0 .pk.host 2over  msg:ihave  >send-have ;

: push-msg ( o:parent -- )
    up@ receiver-task <> IF
	avalanche-msg
    ELSE wait-task @ ?dup-IF
	    <event >r o elit, msg-group-o elit,
	    :>avalanche r> event>







|
>




|







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
	    bounds ?DO
		I @ to msg-group-o 0 .(avalanche-msg)
	    cell +LOOP
	ELSE  2drop  THEN  cleanup-msg ;] catch
    r> to msg-group-o throw ;

: msg:ihave ( id u1 hash u2 -- )
    fetch( ." ihave:" 2over .@host.id 2dup bounds U+DO
    forth:cr I keysize 85type keysize +LOOP forth:cr )
    2dup ihave$ $+!  2over mehave$ $!
    bounds U+DO  2dup I keysize have# #!ins[]  keysize +LOOP  2drop ;
: pk.host ( -- addr u ) [: pk@ type host$ $. ;] $tmp ;
: >ihave ( hash u -- )
    0 .pk.host 2over  msg:ihave  2drop ( >send-have ) ;

: push-msg ( o:parent -- )
    up@ receiver-task <> IF
	avalanche-msg
    ELSE wait-task @ ?dup-IF
	    <event >r o elit, msg-group-o elit,
	    :>avalanche r> event>
695
696
697
698
699
700
701

702
703
704
705
706
707
708
709
710
711
712
713
714
event: :>queued ( queue -- )
    0 fetch-queue[] !@ queue? off transmit-queue ;
: enqueue ( -- )
    -1 queue? !@ 0= IF  <event :>queued up@ event>  THEN ;

forward need-hashed?
: >have-group ( addr u -- )

    msg-group-o { w^ grp }
    2dup have-group# #@ nip IF
	grp last# cell+ +unique$
    ELSE
	grp cell 2swap have-group# #!
    THEN ;

: >fetch-queue ( addr u -- )
    2dup need-hashed? IF
	fetch-queue[] $ins[] drop
    ELSE  >ihave  THEN ;
: ?fetch ( addr u -- )
    key| 2dup >have-group >fetch-queue ;







>


|


|







696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
event: :>queued ( queue -- )
    0 fetch-queue[] !@ queue? off transmit-queue ;
: enqueue ( -- )
    -1 queue? !@ 0= IF  <event :>queued up@ event>  THEN ;

forward need-hashed?
: >have-group ( addr u -- )
    last# >r
    msg-group-o { w^ grp }
    2dup have-group# #@ nip IF
	grp last# cell+ +unique$  2drop
    ELSE
	grp cell 2swap have-group# #!
    THEN  r> to last# ;

: >fetch-queue ( addr u -- )
    2dup need-hashed? IF
	fetch-queue[] $ins[] drop
    ELSE  >ihave  THEN ;
: ?fetch ( addr u -- )
    key| 2dup >have-group >fetch-queue ;
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
also net2o-base
\ chain messages to one previous message
: chain, ( msgaddr u -- )
    [: 2dup startdate@ 64#0 { 64^ sd } sd le-64!  sd 1 64s forth:type
	c:0key sigonly@ >hash hashtmp hash#128 forth:type ;] $tmp $, msg-chain ;
: ihave, ( -- )
    ihave$ $@ dup IF
	maxstring over 4 + - mehave$ $@len - dup 0< IF  2drop  EXIT  THEN
	drop keysize negate and dup >r
	$, mehave$ $@ $, msg-ihave
	ihave$ 0 r> $del
    ELSE  2drop  THEN ;
: push, ( -- )
    push$ $@ dup IF  $, nestsig  ELSE  2drop  THEN ;

: (send-avalanche) ( xt -- addr u flag )
    [: 0 >o [: <msg msg-start execute msg> ihave, ;] gen-cmd$ o>
      +last-signed msg-log, ;] [group] ;
previous

: send-avalanche ( xt -- )
    msg-group-o .msg:?otr IF  now>otr  ELSE  now>never  THEN
    (send-avalanche)
    >r .chat r> 0= IF  msg-group-o .msg:.nobody  THEN ;








<
<

<





|
|







1535
1536
1537
1538
1539
1540
1541


1542

1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
also net2o-base
\ chain messages to one previous message
: chain, ( msgaddr u -- )
    [: 2dup startdate@ 64#0 { 64^ sd } sd le-64!  sd 1 64s forth:type
	c:0key sigonly@ >hash hashtmp hash#128 forth:type ;] $tmp $, msg-chain ;
: ihave, ( -- )
    ihave$ $@ dup IF


	$, mehave$ $@ $, msg-ihave

    ELSE  2drop  THEN ;
: push, ( -- )
    push$ $@ dup IF  $, nestsig  ELSE  2drop  THEN ;

: (send-avalanche) ( xt -- addr u flag )
    [:  0 >o [: <msg msg-start execute msg> ;] gen-cmd$ o>
	+last-signed msg-log, ;] [group] ;
previous

: send-avalanche ( xt -- )
    msg-group-o .msg:?otr IF  now>otr  ELSE  now>never  THEN
    (send-avalanche)
    >r .chat r> 0= IF  msg-group-o .msg:.nobody  THEN ;

1947
1948
1949
1950
1951
1952
1953
1954
1955

1956








1957
1958
1959
1960
1961
1962
1963
1964
1965
      remote-host$ $. ." @" pubkey $@ .simple-id ." :" forth:cr
	true ;] search-context ; is /connections

:noname ( addr u -- )  2drop enqueue ; is /fetch

:noname ( addr u -- )  2drop
    ." Want:" forth:cr
    fetch>want { w^ want# }
    want# [: { item }

	." from " item $@ .@host.id ."  want " item cell+ $@ 85type forth:cr








    ;] #map
    want# #frees ; is /want
}scope

: ?slash ( addr u -- addr u flag )
    over c@ dup '/' = swap '\' = or ;

Defer chat-cmd-file-execute
' execute is chat-cmd-file-execute







<
|
>
|
>
>
>
>
>
>
>
>
|
<







1946
1947
1948
1949
1950
1951
1952

1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964

1965
1966
1967
1968
1969
1970
1971
      remote-host$ $. ." @" pubkey $@ .simple-id ." :" forth:cr
	true ;] search-context ; is /connections

:noname ( addr u -- )  2drop enqueue ; is /fetch

:noname ( addr u -- )  2drop
    ." Want:" forth:cr

    fetch# [: { item }
	." hash: " item $@ 85type space
	case item cell+ $@ drop cell+ .fetcher:state
	    0 of  ." want from"
		item $@ have# #@ bounds U+DO
		    forth:cr I @ .@host.id
		cell +LOOP
	    endof
	    1 of  ." fetching..."  endof
	    2 of  ." got it"  endof
	endcase forth:cr
    ;] #map ; is /want

}scope

: ?slash ( addr u -- addr u flag )
    over c@ dup '/' = swap '\' = or ;

Defer chat-cmd-file-execute
' execute is chat-cmd-file-execute
2027
2028
2029
2030
2031
2032
2033



2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
    ELSE  2drop rectype-null  THEN ;

forward hash-in

: jpeg? ( addr u -- flag )
    dup 4 - 0 max safe/string ".jpg" str= ;




: file-in ( addr u -- hash u )
    slurp-file over >r hash-in r> free throw 2dup key| >ihave ;

: img-rec ( addr u -- .. token )
    2dup "img:" string-prefix? IF
	over ?flush-text
	[:  2dup + >r
	    4 /string save-mem over >r 2dup jpeg? IF
		2dup >thumbnail
		dup IF  over >r hash-in
		    [: forth:type img-orient @ 1- 0 max forth:emit ;] $tmp
		    r> free throw  THEN
	    ELSE  #0.  THEN
	    2swap file-in
	    2swap dup IF   2dup key| >ihave  THEN
	    [:  dup IF  $, msg:thumbnail# ulit, msg-object  ELSE  2drop  THEN
		$, msg:image# ulit, msg-object ;]
	    r> free throw  r> to last->in ;]
	catch 0= IF  rectype-name  EXIT  THEN  THEN
    2drop rectype-null ;
: audio-rec ( addr u -- .. token )
    2dup "audio:" string-prefix? IF







>
>
>

|












|







2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
    ELSE  2drop rectype-null  THEN ;

forward hash-in

: jpeg? ( addr u -- flag )
    dup 4 - 0 max safe/string ".jpg" str= ;

: >have+group ( addr u -- addr u )
    2dup key|  2dup >have-group  >ihave ;

: file-in ( addr u -- hash u )
    slurp-file over >r hash-in r> free throw >have+group ;

: img-rec ( addr u -- .. token )
    2dup "img:" string-prefix? IF
	over ?flush-text
	[:  2dup + >r
	    4 /string save-mem over >r 2dup jpeg? IF
		2dup >thumbnail
		dup IF  over >r hash-in
		    [: forth:type img-orient @ 1- 0 max forth:emit ;] $tmp
		    r> free throw  THEN
	    ELSE  #0.  THEN
	    2swap file-in
	    2swap dup IF   >have+group  THEN
	    [:  dup IF  $, msg:thumbnail# ulit, msg-object  ELSE  2drop  THEN
		$, msg:image# ulit, msg-object ;]
	    r> free throw  r> to last->in ;]
	catch 0= IF  rectype-name  EXIT  THEN  THEN
    2drop rectype-null ;
: audio-rec ( addr u -- .. token )
    2dup "audio:" string-prefix? IF
Changes to wiki/commands.md.
1
2
3
4
5
6
7
8
9
10
# Commands #

Version 0.9.7-20200514.

net2o separates data and commands.  Data is passed through to higher
layers, commands are interpreted when they arrive.  For connection
requests, a special bit is set, and the address then isn't used as
address, but as IV for the opportunistic encoding.

The command interpreter is a stack machine with two data types: 64


|







1
2
3
4
5
6
7
8
9
10
# Commands #

Version 0.9.7-20200521.

net2o separates data and commands.  Data is passed through to higher
layers, commands are interpreted when they arrive.  For connection
requests, a special bit is set, and the address then isn't used as
address, but as IV for the opportunistic encoding.

The command interpreter is a stack machine with two data types: 64