Check-in [221f127fec]
Not logged in

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

Overview
Comment:Temporary problem for notify-send, fix sending out ihaves
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 221f127fecc960c9284dc42c82f36ef7b3c4e0dc
User & Date: bernd 2020-01-09 13:46:33.070
Context
2020-01-09
13:57
Bump version number check-in: b2fb724e32 user: bernd tags: trunk, 0.9.6-20200109
13:46
Temporary problem for notify-send, fix sending out ihaves check-in: 221f127fec user: bernd tags: trunk
2020-01-08
23:31
Store ihave informations in chat log check-in: 4afc95c122 user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to linux/notify.fs.
13
14
15
16
17
18
19
20
21
22

















23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
\ 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/>.

: escape-<&> ( addr u -- )
    bounds ?DO  case i c@
	    '<' of  ." &lt;"  endof
	    '>' of  ." &gt;"  endof
	    '&' of  ." &amp;" endof

















	    emit  0 endcase  LOOP ;

: build-notification ( -- ) ;
: notify@ ( -- addr u )
    config:notify-text# @ IF
	notify-otr? @ config:notify-text# @ 0> and IF
	    "<i>[otr] message</i>"
	ELSE  notify$ $@ ['] escape-<&> $tmp  THEN
    ELSE  "<i>encrypted message</i>"  THEN ;

: 0string ( addr u -- cstr )
    over 0= IF  2drop s" "  THEN
    1+ save-mem over + 1- 0 swap c! ;

0 Value content-string
0 Value title-string

10 cells buffer: notify-args

$Variable notify-send







|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|
|
|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
\ 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/>.

: escape-<&> ( addr u -- )
    bounds ?DO  case i c@
	    '<' of  ." &lt;"   endof
	    '>' of  ." &gt;"   endof
	    '&' of  ." &amp;"  endof
	    '"' of  ." &quot;" endof
	    emit  0 endcase  LOOP ;
: escape-<&>-shell ( addr u -- )
    bounds ?DO  case i c@
	    '<' of  ." &lt;"   endof
	    '>' of  ." &gt;"   endof
	    '&' of  ." &amp;"  endof
	    '"' of  ." &quot;" endof
	    '\' of  ." \\"     endof
	    '$' of  ." \$"     endof
	    '!' of  ." \!"     endof
	    emit  0 endcase  LOOP ;
: escape-shell ( addr u -- )
    bounds ?DO  case i c@
	    '\' of  ." \\"     endof
	    '$' of  ." \$"     endof
	    '!' of  ." \!"     endof
	    emit  0 endcase  LOOP ;

: build-notification ( -- ) ;
: notify@ ( -- addr u )
    config:notify-text# @ IF
	notify-otr? @ config:notify-text# @ 0> and IF
	    "<i>[otr] message</i>"
	ELSE  notify$ $@ ['] escape-<&> $tmp  THEN
    ELSE  "<i>encrypted message</i>"  THEN ;

: 0$! ( addr u cstr-addr -- )
    >r 1+ over 0= IF  2drop "\0"  THEN
    save-mem over + 1- 0 swap c! r> ! ;

0 Value content-string
0 Value title-string

10 cells buffer: notify-args

$Variable notify-send
57
58
59
60
61
62
63


64


65
66
67
68
69
70
71
    upath $@ bounds ?DO I c@ ':' = IF 0 I c! THEN LOOP
    "notify-send" upath file>abspath notify-send $!
    upath $free ;

: !net2o-logo ( -- )
    s" ../doc/net2o-logo.png" fpath file>abspath net2o-logo $! ;



: !notify-args ( -- )


    here >r notify-args dp !
    "notify-send\0" drop ,
    "-a\0" drop ,
    "net2o\0" drop ,
    "-c\0" drop ,
    "im.received\0" drop ,
    net2o-logo $@len IF







>
>

>
>







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
    upath $@ bounds ?DO I c@ ':' = IF 0 I c! THEN LOOP
    "notify-send" upath file>abspath notify-send $!
    upath $free ;

: !net2o-logo ( -- )
    s" ../doc/net2o-logo.png" fpath file>abspath net2o-logo $! ;

: ?free0 ( addr -- )
    dup 0= IF  drop  EXIT  THEN  @ free throw ;
: !notify-args ( -- )
    title-string   ?free0
    content-string ?free0
    here >r notify-args dp !
    "notify-send\0" drop ,
    "-a\0" drop ,
    "net2o\0" drop ,
    "-c\0" drop ,
    "im.received\0" drop ,
    net2o-logo $@len IF
79
80
81
82
83
84
85
86
87
88
89
90
91
92










!upath !net2o-logo !notify-args

:noname defers 'cold
    !upath !net2o-logo !notify-args ; is 'cold

: linux-notification ( -- )  notify-send $@len 0= ?EXIT
    title-string   0 ?free
    content-string 0 ?free
    ['] notify-title $tmp dup 0= IF  2drop  EXIT  THEN
    notify@ dup 0= IF  2drop 2drop  EXIT  THEN
    0string content-string !
    0string title-string !
    notify-send $@ notify-args fork+exec ;
















|
|
|
<
<
<
|
>
>
>
>
>
>
>
>
>
100
101
102
103
104
105
106
107
108
109



110
111
112
113
114
115
116
117
118
119

!upath !net2o-logo !notify-args

:noname defers 'cold
    !upath !net2o-logo !notify-args ; is 'cold

: linux-notification ( -- )  notify-send $@len 0= ?EXIT
    [IFDEF] use-execve
	notify@ content-string 0$!
	['] notify-title $tmp dup 0= IF  2drop  EXIT  THEN  title-string 0$!



	notify-send $@ notify-args fork+exec
    [ELSE]
	[: notify-send $. space
	    ." -a net2o -c im.received "
	    net2o-logo $@len IF
		." -i " net2o-logo $. space  THEN
	    ['] notify-title $tmp dup 0= IF  2drop  EXIT  THEN
	    '"' emit escape-<&>-shell '"' emit space
	    '"' emit notify@ escape-shell '"' emit ;] $tmp system
    [THEN] ;
Changes to msg.fs.
1372
1373
1374
1375
1376
1377
1378
1379





1380
1381
1382
1383
1384
1385
1386

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> ihave, ;] gen-cmd$ o>
      +last-signed msg-log, ;] [group] ;
previous







|
>
>
>
>
>







1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391

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 4 - mehave$ $@len - dup 0< IF  2drop  EXIT  THEN
	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