mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-24 23:56:49 +03:00
Fixed some more servercommands, made scrollbar for userlist functional.
git-svn-id: svn://kolibrios.org@3215 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1632f80d55
commit
31434d0fa5
@ -51,7 +51,7 @@ draw_window:
|
||||
jne .not_channel
|
||||
|
||||
mov ebx, [xsize]
|
||||
sub ebx, 100
|
||||
sub ebx, USERLIST_X + SCROLLBAR_WIDTH + 3
|
||||
push bx
|
||||
shl ebx, 16
|
||||
pop bx
|
||||
@ -74,7 +74,6 @@ draw_window:
|
||||
mov [edit1.top], eax
|
||||
|
||||
mov eax, [xsize]
|
||||
sub eax, 10 ;;;;;;
|
||||
mov [edit1.width], eax
|
||||
|
||||
push dword edit1
|
||||
@ -107,33 +106,46 @@ print_channel_list:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax, 13 ; draw rectangle (clear list)
|
||||
mov eax, 13 ; draw rectangle (clear list)
|
||||
|
||||
mov ebx, [xsize]
|
||||
sub ebx, 95
|
||||
sub ebx, USERLIST_X + SCROLLBAR_WIDTH
|
||||
shl ebx, 16
|
||||
push ebx
|
||||
mov bx, 90 ; x size ;;; FIXME
|
||||
mov ecx, TEXT_Y shl 16 + 12*10 ; y size ;;; FIXME
|
||||
mov bx, USERLIST_X
|
||||
mov ecx, [ysize]
|
||||
add ecx, TEXT_Y shl 16 - (TEXT_Y + 35 + 10 ) ;;;;;
|
||||
mov edx, [colors.work]
|
||||
mcall
|
||||
|
||||
mov eax, 4 ; draw text
|
||||
mov eax, [scroll1.position]
|
||||
xor edx, edx
|
||||
mov ecx, MAX_NICK_LEN
|
||||
mul ecx
|
||||
mov edx, eax
|
||||
mov eax, [window_open]
|
||||
add edx, [eax + window.data_ptr]
|
||||
add edx, window_data.names
|
||||
|
||||
pop ebx
|
||||
mov bx, TEXT_Y
|
||||
mov ecx, [colors.work_text]
|
||||
or ecx, 0x80000000 ; ASCIIZ string
|
||||
mov edx, [window_open]
|
||||
mov edx, [edx + window.data_ptr]
|
||||
add edx, window_data.names
|
||||
mov edi, MAX_CHANNELS
|
||||
or ecx, 0x80000000 ; ASCIIZ string
|
||||
mov eax, 4 ; draw text
|
||||
|
||||
mov edi, [ysize] ; Calculate how many names will fit on screen
|
||||
sub edi, TEXT_Y + 35 + 10 ;;;;;
|
||||
.loop:
|
||||
; TODO: check if name is selected and highlight background color if so
|
||||
cmp byte[edx], ' ' ; end of list?
|
||||
je .done
|
||||
mcall
|
||||
|
||||
add edx, MAX_NICK_LEN ; next name
|
||||
add ebx, 10 ; height distance between lines
|
||||
dec edi
|
||||
jnz .loop
|
||||
add edx, MAX_NICK_LEN ; next name
|
||||
add ebx, 10 ; height distance between lines
|
||||
sub edi, 10
|
||||
ja .loop
|
||||
.done:
|
||||
|
||||
popa
|
||||
|
||||
|
@ -67,6 +67,8 @@ WINDOW_BTN_START = 100
|
||||
|
||||
SCROLLBAR_WIDTH = 12
|
||||
|
||||
USERLIST_X = 98
|
||||
|
||||
|
||||
format binary as ""
|
||||
|
||||
@ -95,13 +97,14 @@ struct window
|
||||
flags db ?
|
||||
type db ?
|
||||
name rb MAX_WINDOWNAME_LEN
|
||||
users dd ?
|
||||
users_scroll dd ?
|
||||
ends
|
||||
|
||||
struct window_data
|
||||
text rb 120*60
|
||||
title rb 256
|
||||
names rb 1200
|
||||
namespos dd ?
|
||||
usertext rb 256
|
||||
usertextlen dd ?
|
||||
ends
|
||||
@ -284,6 +287,9 @@ mouse:
|
||||
push dword scroll1
|
||||
call [scrollbar_v_mouse]
|
||||
|
||||
; TODO: check if scrollbar moved
|
||||
call print_channel_list ;;;
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
@ -407,7 +413,7 @@ usercommand db '/server chat.freenode.net', 0
|
||||
I_END:
|
||||
|
||||
; width, left, top
|
||||
edit1 edit_box 0, 5, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_focus, 25, 25
|
||||
edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_focus, 25, 25
|
||||
; xsize, xpos, ysize, ypos, max, cur, pos, bgcol, frcol, linecol
|
||||
scroll1 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 5
|
||||
|
||||
|
@ -41,7 +41,7 @@ server_parser:
|
||||
ret
|
||||
|
||||
.got_cmd:
|
||||
jmp dword[edi]
|
||||
jmp dword[edi]
|
||||
|
||||
|
||||
server_commands:
|
||||
@ -431,6 +431,7 @@ ctcp_reply:
|
||||
|
||||
|
||||
cmd_part:
|
||||
add esi, 5 ; skip 'PART '
|
||||
|
||||
; Is it me who parted?
|
||||
mov edi, servercommand+1
|
||||
@ -460,11 +461,19 @@ cmd_part:
|
||||
pop esi
|
||||
call print_text2
|
||||
|
||||
mov esi, str_newline
|
||||
call print_text2
|
||||
|
||||
;;; TODO: dec [window.users], remove username from the userlist
|
||||
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
cmd_join:
|
||||
add esi, 5 ; skip 'JOIN '
|
||||
|
||||
; compare nick: did we join a channel?
|
||||
mov edi, servercommand+1
|
||||
call compare_to_nick
|
||||
@ -493,7 +502,6 @@ cmd_join:
|
||||
mov [ebx + window.type], WINDOWTYPE_CHANNEL
|
||||
mov [ebx + window.flags], 0
|
||||
|
||||
add esi, 5 ; skip 'JOIN ' ; FIXME: perhaps scan for spaces instead?
|
||||
call window_set_name
|
||||
|
||||
mov [window_open], ebx
|
||||
@ -538,6 +546,8 @@ cmd_join:
|
||||
mov esi, str_newline
|
||||
call print_text2
|
||||
|
||||
;;; TODO: inc [window.users], add username to the userlist
|
||||
|
||||
ret
|
||||
|
||||
|
||||
@ -545,6 +555,8 @@ cmd_join:
|
||||
|
||||
cmd_nick: ; FIXME
|
||||
|
||||
add esi, 5 ; skip 'NICK '
|
||||
|
||||
push esi
|
||||
; test for change of my nick
|
||||
mov esi, servercommand+1
|
||||
@ -699,6 +711,7 @@ cmd_nick: ; FIXME
|
||||
|
||||
|
||||
cmd_kick:
|
||||
add esi, 5 ; skip 'KICK '
|
||||
; Is it me who got kicked?
|
||||
mov edi, servercommand+1
|
||||
call compare_to_nick
|
||||
@ -722,6 +735,8 @@ cmd_kick:
|
||||
pop esi
|
||||
call print_text2
|
||||
|
||||
;;; TODO: dec [window.users], remove username from the userlist
|
||||
|
||||
ret
|
||||
|
||||
|
||||
@ -738,12 +753,16 @@ cmd_quit:
|
||||
mov esi, has_quit_irc
|
||||
call print_text2
|
||||
|
||||
;;; TODO: dec [window.users], remove username from the userlist
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
cmd_mode:
|
||||
|
||||
add esi, 5 ; skip 'MODE '
|
||||
|
||||
push esi
|
||||
mov esi, action_header_short
|
||||
call print_text2
|
||||
@ -761,11 +780,15 @@ cmd_mode:
|
||||
mov esi, str_newline
|
||||
call print_text2
|
||||
|
||||
;;; TODO: change username if needed
|
||||
|
||||
ret
|
||||
|
||||
|
||||
cmd_353: ; channel usernames reply
|
||||
|
||||
add esi, 4 ; skip '353 '
|
||||
|
||||
; TODO: mark a bit that we are receiving names
|
||||
|
||||
; first, find the channel name
|
||||
@ -781,8 +804,9 @@ cmd_353: ; channel usernames reply
|
||||
.got_channel:
|
||||
; call find_channel ;;;; ASSUME current channel for now
|
||||
mov ebx, [window_print]
|
||||
mov ebx, [ebx + window.data_ptr]
|
||||
lea edi, [ebx + window_data.names]
|
||||
mov [ebx + window.users], 0 ;;; FIXME: Only if we have just set the receiving names bit
|
||||
mov eax, [ebx + window.data_ptr]
|
||||
lea edi, [eax + window_data.names]
|
||||
lea edx, [edi + MAX_NICK_LEN]
|
||||
|
||||
; now find the semicolon separating channelname and usernames
|
||||
@ -806,18 +830,37 @@ cmd_353: ; channel usernames reply
|
||||
jmp .namesloop
|
||||
|
||||
.next:
|
||||
inc [ebx + window.users]
|
||||
mov edi, edx
|
||||
add edx, MAX_NICK_LEN
|
||||
|
||||
;;; cmp edi, .. ; Check for buffer overflow
|
||||
;;; cmp edi, .. ; TODO: Check for buffer overflow
|
||||
jmp .namesloop
|
||||
|
||||
.done:
|
||||
call users_calculate
|
||||
call print_channel_list
|
||||
|
||||
ret
|
||||
|
||||
|
||||
users_calculate:
|
||||
|
||||
mov eax, [ysize]
|
||||
sub eax, TEXT_Y + 35 + 10 ;;;;
|
||||
xor edx, edx
|
||||
mov ecx, 10
|
||||
div ecx
|
||||
mov [scroll1.max_area], eax
|
||||
|
||||
mov ebx, [window_print]
|
||||
mov eax, [ebx + window.users]
|
||||
mov [scroll1.max_area], eax
|
||||
; TODO: check if cur pos isnt greater then max
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cmd_366: ; channel usernames end
|
||||
@ -830,6 +873,8 @@ cmd_366: ; channel usernames end
|
||||
|
||||
cmd_topic:
|
||||
|
||||
add esi, 4 ; skip '332 '
|
||||
|
||||
.loop:
|
||||
lodsb
|
||||
test al, al
|
||||
@ -856,6 +901,8 @@ cmd_topic:
|
||||
|
||||
cmd_333:
|
||||
|
||||
add esi, 4 ; skip '333 '
|
||||
|
||||
; TODO: check channelname and change pointer accordingly
|
||||
|
||||
mov ecx, 3 ; number of spaces to find
|
||||
|
Loading…
Reference in New Issue
Block a user