private chat support for IRCC

git-svn-id: svn://kolibrios.org@3337 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-03-05 20:42:09 +00:00
parent 8db8d59a28
commit 487976c4f2
4 changed files with 106 additions and 34 deletions

View File

@ -140,8 +140,7 @@ print_channel_list:
pusha
; Now, draw the usernames themselves
mov eax, 13 ; draw rectangle (clear list)
; first, draw an invisible button
mov ebx, [xsize]
sub ebx, USERLIST_X + SCROLLBAR_WIDTH
shl ebx, 16
@ -149,18 +148,24 @@ print_channel_list:
mov bx, USERLIST_X
mov ecx, [ysize]
add ecx, TEXT_Y shl 16 - (TEXT_Y + 15) ;;;;; + 10???
mov edx, [colors.work]
mcall
push ecx ebx
mov edx, 50 + 1 shl 29 + 1 shl 30
mcall 8
; now draw rectangle to clear the names
pop ebx ecx
mov edx, [colors.work]
mcall 13
; now draw the names according with scrollbar position and window size
mov eax, [scroll1.position]
xor edx, edx
mov ecx, MAX_NICK_LEN
mul ecx
mov edx, eax
mov eax, [window_open]
mov eax, [eax + window.data_ptr]
add edx, eax
mov ebp, [eax + window_data.selected]
mov ebp, [eax + window.selected]
add edx, [eax + window.data_ptr]
sub ebp, [scroll1.position]
add edx, window_data.names
@ -173,8 +178,11 @@ print_channel_list:
mov edi, [ysize] ; Calculate how many names will fit on screen
sub edi, TEXT_Y + 15 ;+ 10 ;;;;;
.loop:
cmp byte[edx], 0 ; end of list?
je .done
dec ebp ; is this name selected?
jnz @f
jnz .nothighlight
; yes, highlight it
pusha
mov cx, bx
@ -184,17 +192,24 @@ print_channel_list:
mov edx, 0x00000055 ; blue!
mcall 13
popa
@@:
cmp byte[edx], 0 ; end of list?
je .done
mov ecx, 0x8000ffff ; cyan!
mcall
mov ecx, [colors.work_text]
or ecx, 0x80000000 ; ASCIIZ string
jmp .next
.nothighlight:
mcall
.next:
add edx, MAX_NICK_LEN ; next name
add ebx, 10 ; height distance between lines
sub edi, 10
ja .loop
.done:
.done:
popa
ret

View File

@ -101,13 +101,13 @@ struct window
name rb MAX_WINDOWNAME_LEN
users dd ?
users_scroll dd ?
selected dd ? ; selected user, 0 if none selected
ends
struct window_data
text rb 120*60
title rb 256
names rb MAX_NICK_LEN * MAX_USERS
selected dd ? ; selected user, 0 if none selected
usertext rb 256
usertextlen dd ?
ends
@ -231,6 +231,24 @@ button:
cmp ax, 1 ; close program
je exit
cmp ax, 50
jne @f
mcall 37, 1 ; Get mouse position
sub ax, TEXT_Y
mov bl, 10
div bl
and eax, 0x000000ff
inc eax
add eax, [scroll1.position]
mov ebx, [window_open]
mov [ebx + window.selected], eax
call print_channel_list
jmp still
@@:
sub ax, WINDOW_BTN_START
jb exit

View File

@ -137,59 +137,98 @@ skip_nick:
align 4
find_window: ; esi is ptr to windowname
; TODO: if the window in question does not exist, create it ???
push esi
mov edi, esi
call compare_to_nick
jne .nochat
mov esi, servercommand+1
.nochat:
; now search for window in list
mov ebx, windows
mov [window_print], ebx ; set first window (server window) as default output window
.scanloop:
cmp [ebx + window.data_ptr], 0
je .just_skip
je .create_it
push esi
lea edi, [ebx + window.name]
mov ecx, MAX_WINDOWNAME_LEN
repe cmpsb
pop esi
cmp byte[edi-1], 0
je .got_it
pop esi
add ebx, sizeof.window
; TODO: check buffer limits ?
jmp .scanloop
; window not found, just skip this name
.just_skip:
lodsb
test al, al
jz .quit
cmp al, ' '
jne .just_skip
dec esi
jmp .done
; create channel window - search for empty slot
.create_it:
mov ebx, windows
mov ecx, MAX_WINDOWS
.scanloop2:
cmp [ebx + window.data_ptr], 0
je .free_found
add ebx, sizeof.window
dec ecx
jnz .scanloop2
; Error: no more available windows!
jmp .just_skip
.free_found:
push ebx
call window_create
pop ebx
test eax, eax
jz .just_skip
mov [ebx + window.data_ptr], eax
mov [ebx + window.type], WINDOWTYPE_CHAT
mov [ebx + window.flags], 0
call window_set_name
mov [window_open], ebx
mov [window_print], ebx
call window_refresh
call draw_windownames
jmp .just_skip
; found it!
.got_it:
add esp, 4
mov [window_print], ebx
dec esi
call window_refresh
; now skip trailing spaces and semicolons
.done:
.just_skip:
pop esi
.skip1:
; skip text
lodsb
test al, al
jz .quit
cmp al, ' '
je .done
jne .skip1
dec esi
; now skip trailing spaces and semicolons
.skip2:
lodsb
test al, al
jz .quit
cmp al, ' '
je .skip2
cmp al, ':'
je .done
je .skip2
dec esi
.quit:
call window_refresh
ret
cmd_328:
cmd_421:
cmd_372:

View File

@ -46,7 +46,7 @@ window_set_name: ; esi = ptr to name, ebx = window ptr
mov ecx, MAX_WINDOWNAME_LEN
.loop:
lodsb
cmp al, 0x20
cmp al, 0x21
jbe .addzero
stosb
dec ecx