Check-in [721303536c]
Not logged in

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

Overview
Comment:Auto-load avatar
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 721303536cdc793aa07813974033d387e602cdf7
User & Date: bernd 2019-11-26 22:05:13
Context
2019-11-27
21:26
Chat images started, delivery of dht with obsolete date prevented check-in: aa10c71e44 user: bernd tags: trunk
2019-11-26
22:05
Auto-load avatar check-in: 721303536c user: bernd tags: trunk
20:35
Background-load avatar image if not available check-in: e426aee2a6 user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.in.

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	  cmd.fs connected.fs connect.fs crypt.fs dht.fs err.fs file.fs	      \
	  gui.fs gui-night.fs net2o.fs ip.fs helper.fs keys.fs log.fs msg.fs  \
	  notify.fs qr.fs socks.fs squid.fs tools.fs vault.fs rng.fs xtype.fs \
	  $(TESTS) $(FORTHLIB) ed25519-donnalib.fs keccaklib.fs		      \
	  threefishlib.fs startn2o.fs doc/net2o-logo.png version.fs.in	      \
	  android/net.fs android/notify.fs linux/net.fs linux/notify.fs	      \
	  dhtroot.fs dvcs.fs qrscan.fs android/qrscan-android.fs	      \
	  linux/qrscan-linux.fs doc/net2o-200.png doc/net2o.png		      \
	  json/parser.fs json/g+-schema.fs json/g+-import.fs		      \
	  json/fb-schema.fs json/twitter-schema.fs json/test.fs		      \
	  json/test.json json/diaspora-schema.fs html/parser.fs xml/parser.fs \
	  xml/blogger-atom.fs

ICONS = icons/hicolor/128x128/apps/net2o.png				      \
	icons/hicolor/16x16/apps/net2o.png				      \







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	  cmd.fs connected.fs connect.fs crypt.fs dht.fs err.fs file.fs	      \
	  gui.fs gui-night.fs net2o.fs ip.fs helper.fs keys.fs log.fs msg.fs  \
	  notify.fs qr.fs socks.fs squid.fs tools.fs vault.fs rng.fs xtype.fs \
	  $(TESTS) $(FORTHLIB) ed25519-donnalib.fs keccaklib.fs		      \
	  threefishlib.fs startn2o.fs doc/net2o-logo.png version.fs.in	      \
	  android/net.fs android/notify.fs linux/net.fs linux/notify.fs	      \
	  dhtroot.fs dvcs.fs qrscan.fs android/qrscan-android.fs	      \
	  linux/qrscan-linux.fs doc/net2o-200.png doc/net2o.png	doc/user.png  \
	  json/parser.fs json/g+-schema.fs json/g+-import.fs		      \
	  json/fb-schema.fs json/twitter-schema.fs json/test.fs		      \
	  json/test.json json/diaspora-schema.fs html/parser.fs xml/parser.fs \
	  xml/blogger-atom.fs

ICONS = icons/hicolor/128x128/apps/net2o.png				      \
	icons/hicolor/16x16/apps/net2o.png				      \

Added doc/user.png.

cannot compute difference between binary files

Changes to gui.fs.

355
356
357
358
359
360
361

362
363
364
365
366
367
368
...
428
429
430
431
432
433
434
435












436
437
438
439

440
441
442
443
444
445
446
447



448
449
450
451

452
453
454
455


456
457
458
459
460
461
462
463
...
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
...
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
' dark-blue >body f!

\ id frame

0 Value mykey-box
0 Value groups-box
0 Value nicks-box

0 Value msgs-box
0 Value msg-box
0 Value msg-par
0 Value msg-vbox

0 Value group-name
0 Value group-members
................................................................................
Hash: avatar#

glue new Constant glue*avatar
glue*avatar >o pixelsize# 64 fm* 0e 0g glue-dup hglue-c glue! vglue-c glue! 0glue dglue-c glue! o>

: read-avatar ( addr u -- addr' u' )
    ?read-enc-hashed mem>thumb atlas-region ;
: show-avatar ( addr u -- o / 0 )












    [: 2dup avatar# #@ nip 0= IF
	    2dup read-avatar 2swap avatar# #!
	ELSE  2drop  THEN
	glue*avatar last# cell+ $@ drop }}thumb

	>r {{ r> }}v 40%b ;] catch IF  2drop 0  THEN ;

: re-avatar ( last# -- )
    >r r@ $@ read-avatar r> cell+ $@ smove ;

:noname defers free-thumbs
    avatar# ['] re-avatar #map ; is free-thumbs




event: :>fetch-avatar ( hash u1 pk u2 -- )
    $8 $A pk-connect? IF  +resend +flow-control
	net2o-code expect+slurp $10 blocksize! $A blockalign!
	net2o:copy# end-code| net2o:close-all disconnect-me

    ELSE  2drop  THEN ;

: ?+avatars ( o:key o/0 -- o / )
    ?dup-0=-IF


	<event ke-avatar $@ e$, ke-pk $@ e$, :>fetch-avatar
	?query-task event>
    THEN ;

: ?avatar ( addr u -- o / )
    key# #@ IF
	cell+ .ke-avatar $@ dup IF
	    show-avatar ?dup-0=-IF  THEN
................................................................................
: show-nick ( o:key -- )
    ke-imports @ [ 1 import#provisional lshift ]L and ?EXIT
    ke-imports @ >im-color# sfloats { ki }
    {{ glue*l imports#rgb-bg ki + sf@ slide-frame dup .button1
	{{
	    {{ \large imports#rgb-fg ki + sf@ to x-color
		ke-avatar $@ dup IF  show-avatar ?+avatars
		ELSE  2drop  THEN
		ke-sk sec@ nip IF  \bold  ELSE  \regular  THEN  \sans
		['] .nick-base $tmp }}text 25%b
		ke-pets[] $[]# IF
		    {{
			x-color glue*l pet-color x-color slide-frame dup .button3 to x-color
			['] .pet-base $tmp }}text 25%b
		    }}z
................................................................................
		{{ glue*l $300030FF new-color, bar-frame
		{{ \script l" My groups" }}i18n-text 25%b glue*l }}glue }}h }}z
		{{ }}v box[] dup to groups-box /vflip
		{{ glue*l $003030FF new-color, bar-frame
		{{ \script l" My peers" }}i18n-text 25%b glue*l }}glue }}h }}z
		{{ }}v box[] dup to nicks-box /vflip
		glue*lll }}glue
	    tex: vp-nicks vp-nicks glue*lll ' vp-nicks }}vp vp[] dup value peers-box
	    $444444FF new-color, to slider-color
	    $CCCCCCFF new-color, to slider-fgcolor
	    font-size# 33% f* to slider-border
	dup font-size# 66% f* fdup vslider }}h box[]
    }}v box[]
}}z box[] to id-frame








>







 







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







>
>
>
|
|

|
>


|

>
>
|







 







|







 







|







355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
...
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451

452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
...
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
...
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
' dark-blue >body f!

\ id frame

0 Value mykey-box
0 Value groups-box
0 Value nicks-box
0 value peers-box
0 Value msgs-box
0 Value msg-box
0 Value msg-par
0 Value msg-vbox

0 Value group-name
0 Value group-members
................................................................................
Hash: avatar#

glue new Constant glue*avatar
glue*avatar >o pixelsize# 64 fm* 0e 0g glue-dup hglue-c glue! vglue-c glue! 0glue dglue-c glue! o>

: read-avatar ( addr u -- addr' u' )
    ?read-enc-hashed mem>thumb atlas-region ;
Variable user-avatar#
Variable user.png$
: read-user.png ( -- )
    "doc/user.png" open-fpath-file throw 2drop
    dup >r user.png$ $slurp r> close-file throw ;
: user-avatar ( -- addr u )
    user-avatar# @ 0= IF
	read-user.png user.png$ $@ mem>thumb atlas-region
	user-avatar# $!
    THEN   user-avatar# $@ ;
: avatar-thumb ( avatar -- )
    glue*avatar swap }}thumb >r {{ r> }}v 40%b ;
: avatar-frame ( addr u -- frame# )
    2dup avatar# #@ nip 0= IF
	2dup read-avatar 2swap avatar# #!
    ELSE  2drop  THEN  last# cell+ $@ drop ;

: show-avatar ( addr u -- o / 0 )
    [: avatar-frame avatar-thumb ;] catch IF  2drop 0  THEN ;

: re-avatar ( last# -- )
    >r r@ $@ read-avatar r> cell+ $@ smove ;

:noname defers free-thumbs
    avatar# ['] re-avatar #map ; is free-thumbs

event: :>update-avatar ( thumb hash u1 -- )
    avatar-frame swap .childs[] $@ drop @ >o to frame# o>
    ['] +sync peers-box .vp-needed +sync ;
event: :>fetch-avatar { thumb up hash u1 pk u2 -- }
    pk u2 $8 $A pk-connect? IF  +resend +flow-control
	net2o-code expect+slurp $10 blocksize! $A blockalign!
	hash u1 net2o:copy# end-code| net2o:close-all disconnect-me
	<event thumb elit, hash u1 e$, :>update-avatar up event>
    ELSE  2drop  THEN ;

: ?+avatars ( o:key o/0 -- o )
    ?dup-0=-IF
	user-avatar drop avatar-thumb
	<event dup elit, up@ elit,
	ke-avatar $@ e$, ke-pk $@ e$, :>fetch-avatar
	?query-task event>
    THEN ;

: ?avatar ( addr u -- o / )
    key# #@ IF
	cell+ .ke-avatar $@ dup IF
	    show-avatar ?dup-0=-IF  THEN
................................................................................
: show-nick ( o:key -- )
    ke-imports @ [ 1 import#provisional lshift ]L and ?EXIT
    ke-imports @ >im-color# sfloats { ki }
    {{ glue*l imports#rgb-bg ki + sf@ slide-frame dup .button1
	{{
	    {{ \large imports#rgb-fg ki + sf@ to x-color
		ke-avatar $@ dup IF  show-avatar ?+avatars
		ELSE  2drop user-avatar drop avatar-thumb   THEN
		ke-sk sec@ nip IF  \bold  ELSE  \regular  THEN  \sans
		['] .nick-base $tmp }}text 25%b
		ke-pets[] $[]# IF
		    {{
			x-color glue*l pet-color x-color slide-frame dup .button3 to x-color
			['] .pet-base $tmp }}text 25%b
		    }}z
................................................................................
		{{ glue*l $300030FF new-color, bar-frame
		{{ \script l" My groups" }}i18n-text 25%b glue*l }}glue }}h }}z
		{{ }}v box[] dup to groups-box /vflip
		{{ glue*l $003030FF new-color, bar-frame
		{{ \script l" My peers" }}i18n-text 25%b glue*l }}glue }}h }}z
		{{ }}v box[] dup to nicks-box /vflip
		glue*lll }}glue
	    tex: vp-nicks vp-nicks glue*lll ' vp-nicks }}vp vp[] dup to peers-box
	    $444444FF new-color, to slider-color
	    $CCCCCCFF new-color, to slider-fgcolor
	    font-size# 33% f* to slider-border
	dup font-size# 66% f* fdup vslider }}h box[]
    }}v box[]
}}z box[] to id-frame