Verified Commit 509a1bf4 authored by Bernd Paysan's avatar Bernd Paysan
Browse files

Fix chat groups problem in GUI

parent f2d52304
Loading
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -311,7 +311,7 @@ $00FFFFFF ,

: gui-chat-connects ( -- )
    [: up@ wait-task ! ;] IS do-connect
    [: chat-keys [: key>group
    [: chat-keys [: key| \ key>group
	    2dup search-connect ?dup-IF  >o +group greet o> 2drop  EXIT  THEN
	    2dup pk-peek? IF  chat-connect true !!connected!!
	    ELSE  2drop  THEN ;] $[]map ;] catch
@@ -552,7 +552,7 @@ wmsg-o >o msg-table @ token-table ! o>
#128 Value gui-msgs# \ display last 128 messages
0 Value chat-edit    \ chat edit field

: gui-msgs ( gaddr u -- )
: (gui-msgs) ( gaddr u -- )
    reset-time
    msgs-box .dispose-childs
    glue*lll }}glue msgs-box .child+
@@ -566,9 +566,12 @@ wmsg-o >o msg-table @ token-table ! o>
    log free throw  msgs-box >o resized vp-bottom o>
    chat-edit engage ;

: gui-msgs ( gaddr u -- )
    2dup msg-group$ $! (gui-msgs) ;

: msg-wredisplay ( n -- )
    drop 0 otr-mode
    [: last# $@ gui-msgs ;] !wrapper
    [: msg-group$ $@ (gui-msgs) ;] !wrapper
    msgs-box >o [: +sync +config +resize ;] vp-needed vp-bottom
    +sync +config o>  ;
' msg-wredisplay wmsg-class is msg:redisplay
+9 −7
Original line number Diff line number Diff line
@@ -179,8 +179,8 @@ Variable sim-nick!
: #split ( addr u -- addr u n )
    [: 2dup '#' -scan nip >r
      r@ 0= IF  rdrop 0  EXIT  THEN
      #0. 2over r@ /string >number
      0= IF  nip drop nip r> 1- swap  ELSE
      #0. 2over r@ 1+ /string >number
      0= IF  nip drop nip r> swap  ELSE
	  rdrop drop 2drop 0   THEN ;] #10 base-execute ;

: nick-key ( addr u -- o / 0 ) \ search for key nickname
@@ -436,14 +436,14 @@ Variable secret-nicks#
: .keys ( -- ) key# [: ." index: " dup $@ 85type cr cell+ $@ .key ;] #map ;
: dumpkeys ( -- ) key# [: cell+ $@ dumpkey ;] #map ;

: key>o ( addrkey u1 -- o / 0 )
    key| key# #@ 0= IF  drop 0  EXIT  THEN  cell+ ;
: key>nick ( addrkey u1 -- nick u2 )
    \G convert key to nick
    key| key# #@ 0= IF  drop #0.  EXIT  THEN
    cell+ .ke-nick $@ ;
    key>o dup IF  .ke-nick $@  ELSE  0  THEN ;
: key>key ( addrkey u1 -- key u2 )
    \G expand key to full size and check if we know it
    key| key# #@ 0= IF  drop #0.  EXIT  THEN
    cell+ .ke-pk $@ ;
    key>o dup IF  .ke-pk $@  ELSE  0  THEN ;

: .key# ( addr u -- ) key|
    ." Key '" key# #@ 0= IF drop EXIT THEN
@@ -468,7 +468,9 @@ event: :>search-key ( $addr -- )

: .con-id ( o:connection -- ) pubkey $@ .key-id ;

: .simple-id ( addr u -- ) last# >r  key>nick type  r> to last# ;
: .simple-id ( addr u -- ) last# >r
    key>o dup IF  ..nick-base  ELSE  drop ." unknown"  THEN
    r> to last# ;

: check-key ( addr u -- )
    o IF  pubkey @ IF
+1 −1
Original line number Diff line number Diff line
@@ -515,7 +515,7 @@ warnings !
    over c@ '+' = IF  2drop ?nextarg drop
	s>unumber? drop d>64 to groups:perms#
    THEN
    save-chatgroups ;
    save-chatgroups .chatgroups ;

: chatgroups ( -- )
    \U chatgroups