Commit 6aa0d206 authored by Bernd Paysan's avatar Bernd Paysan

Chat images started, delivery of dht with obsolete date prevented

parent 272cd7e3
......@@ -578,6 +578,10 @@ drop
: early/late? ( n64 min64 max64 -- sig-error )
64>r 64over 64r> 64u>= sig-late and >r 64u< sig-early and r> min ;
: check-exact-date ( addr u -- addr u flag )
2dup + 1- c@ keysize <> sig-keysize and ?dup-IF EXIT THEN
2dup enddate@ 64>r 2dup startdate@ 64>r
ticks 64r> 64r> early/late? ;
: check-date ( addr u -- addr u flag )
2dup + 1- c@ keysize <> sig-keysize and ?dup-IF EXIT THEN
2dup enddate@ 64>r 2dup startdate@ 64>r
......
......@@ -288,8 +288,10 @@ end-class dht-file-class
: d#values, ( addr u mask -- addr' u' ) { mask }
k#size cell/ 1 DO
mask 1 and IF
I dup cells dht-hash dht( ." access dht: " dup hex. over . forth:cr ) +
[: { k# a# u# } k# d#c, a# u# d#$, k# ;] $[]map drop
dht-hash I cells + I
dht( ." access dht: " over hex. dup . forth:cr )
[{: k# :}l check-exact-date
0= IF k# d#c, d#$, ELSE 2drop THEN ;] $[]map
THEN mask 2/ to mask
LOOP ;
......
......@@ -1609,8 +1609,27 @@ msg:troll# 't' permchar>bits + c!
[: $, msg-url ;] rectype-name
ELSE 2drop rectype-null THEN ;
forward hash-in
: jpeg? ( addr u -- flag )
dup 4 - 0 max safe/string ".jpg" str= ;
: img-rec ( addr u -- )
2dup "img:" string-prefix? IF
over ?flush-text 2dup + to last->in
2dup jpeg? IF
2dup >thumbnail
?dup-IF over >r hash-in r> free throw THEN
ELSE #0. THEN
2swap slurp-file over >r hash-in r> free throw
[: type dup IF type img-orient 1- 0 max emit ELSE 2drop THEN ;] $tmp
[: tuck $, >r msg:thumbnail# msg:image# r> $20 u> select ulit,
msg-object ;] rectype-name
ELSE 2drop rectype-null THEN ;
$Variable msg-recognizer
' text-rec ' http-rec ' chain-rec ' tag-rec ' pk-rec 5 msg-recognizer set-stack
depth >r
' text-rec ' img-rec ' http-rec ' chain-rec ' tag-rec ' pk-rec
depth r> - msg-recognizer set-stack
: parse-text ( addr u -- ) last# >r forth-recognizer >r
0 to last->in
......
......@@ -42,6 +42,7 @@ require rng.fs
require ed25519-donna.fs
require hash-table.fs
require bdelta.fs
require minos2/jpeg-exif.fs
\ random initializer for hash
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment