forked from KolibriOS/kolibrios
IRCc 0.31: Clear data on exit, print unknown CTCP commands to window, replace some magic numbers with constants (thanks floppy121).
git-svn-id: svn://kolibrios.org@7300 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
82e469a233
commit
321ff86117
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Written by hidnplayr@kolibrios.org ;;
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
@ -56,6 +56,9 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
|
|||||||
test [thread_info.wnd_state], 100b ; skip if window is rolled up
|
test [thread_info.wnd_state], 100b ; skip if window is rolled up
|
||||||
jne .exit
|
jne .exit
|
||||||
|
|
||||||
|
cmp [window_active], 0
|
||||||
|
je .no_window
|
||||||
|
|
||||||
; calculate available space for textbox and coordinates for scrollbars
|
; calculate available space for textbox and coordinates for scrollbars
|
||||||
mov eax, [ysize]
|
mov eax, [ysize]
|
||||||
sub eax, TOP_Y + INPUTBOX_HEIGHT - 1
|
sub eax, TOP_Y + INPUTBOX_HEIGHT - 1
|
||||||
@ -128,6 +131,7 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
|
|||||||
mov edx, [colors.work_graph]
|
mov edx, [colors.work_graph]
|
||||||
mcall 38
|
mcall 38
|
||||||
.not_channel:
|
.not_channel:
|
||||||
|
.no_window:
|
||||||
|
|
||||||
; draw editbox
|
; draw editbox
|
||||||
mov eax, [ysize]
|
mov eax, [ysize]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; IRC client for KolibriOS ;;
|
;; IRC client for KolibriOS ;;
|
||||||
@ -13,7 +13,7 @@
|
|||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
version equ '0.30'
|
version equ '0.31'
|
||||||
|
|
||||||
; connection status
|
; connection status
|
||||||
STATUS_DISCONNECTED = 0
|
STATUS_DISCONNECTED = 0
|
||||||
@ -62,6 +62,7 @@ TEXT_BUFFERSIZE = 1024*1024
|
|||||||
|
|
||||||
MAX_NICK_LEN = 32
|
MAX_NICK_LEN = 32
|
||||||
MAX_REAL_LEN = 32 ; realname
|
MAX_REAL_LEN = 32 ; realname
|
||||||
|
QUIT_MSG_LEN = 250
|
||||||
MAX_SERVER_NAME = 256
|
MAX_SERVER_NAME = 256
|
||||||
|
|
||||||
MAX_CHANNEL_LEN = 40
|
MAX_CHANNEL_LEN = 40
|
||||||
@ -69,6 +70,11 @@ MAX_CHANNELS = 37
|
|||||||
|
|
||||||
MAX_COMMAND_LEN = 512
|
MAX_COMMAND_LEN = 512
|
||||||
|
|
||||||
|
PACKETBUF_SIZE = 1024
|
||||||
|
PATH_SIZE = 1024
|
||||||
|
PARAM_SIZE = 1024
|
||||||
|
SERVERCOMMAND_SIZE = 600
|
||||||
|
|
||||||
TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp
|
TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp
|
||||||
|
|
||||||
MAX_WINDOWNAME_LEN = 256
|
MAX_WINDOWNAME_LEN = 256
|
||||||
@ -154,7 +160,7 @@ START:
|
|||||||
; find path to main settings file (ircc.ini)
|
; find path to main settings file (ircc.ini)
|
||||||
mov edi, path ; Calculate the length of zero-terminated string
|
mov edi, path ; Calculate the length of zero-terminated string
|
||||||
xor al, al
|
xor al, al
|
||||||
mov ecx, 1024
|
mov ecx, PATH_SIZE
|
||||||
repne scasb
|
repne scasb
|
||||||
dec edi
|
dec edi
|
||||||
mov eax, '.ini'
|
mov eax, '.ini'
|
||||||
@ -170,14 +176,14 @@ START:
|
|||||||
|
|
||||||
; clear command area too
|
; clear command area too
|
||||||
mov edi, servercommand
|
mov edi, servercommand
|
||||||
mov ecx, 600/4
|
mov ecx, SERVERCOMMAND_SIZE/4
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
; allocate window data block
|
; allocate window data block
|
||||||
mov ebx, windows
|
mov ebx, windows
|
||||||
call window_create_textbox
|
call window_create_textbox
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz error
|
jz exit
|
||||||
mov [ebx + window.type], WINDOWTYPE_SERVER
|
mov [ebx + window.type], WINDOWTYPE_SERVER
|
||||||
|
|
||||||
; get system colors
|
; get system colors
|
||||||
@ -212,7 +218,7 @@ START:
|
|||||||
cmp byte[param], 0
|
cmp byte[param], 0
|
||||||
je @f
|
je @f
|
||||||
mov esi, param
|
mov esi, param
|
||||||
mov ecx, 1024
|
mov ecx, PARAM_SIZE
|
||||||
call cmd_usr_server.now
|
call cmd_usr_server.now
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
@ -255,7 +261,7 @@ button:
|
|||||||
ror eax, 8
|
ror eax, 8
|
||||||
|
|
||||||
cmp ax, 1 ; close program
|
cmp ax, 1 ; close program
|
||||||
je exit
|
je quit
|
||||||
|
|
||||||
cmp ax, WINDOW_BTN_CLOSE
|
cmp ax, WINDOW_BTN_CLOSE
|
||||||
jne @f
|
jne @f
|
||||||
@ -318,10 +324,10 @@ button:
|
|||||||
|
|
||||||
@@:
|
@@:
|
||||||
sub ax, WINDOW_BTN_START
|
sub ax, WINDOW_BTN_START
|
||||||
jb exit
|
jb quit
|
||||||
|
|
||||||
cmp ax, MAX_WINDOWS
|
cmp ax, MAX_WINDOWS
|
||||||
ja exit
|
ja quit
|
||||||
|
|
||||||
; Save users scrollbar position
|
; Save users scrollbar position
|
||||||
push [scroll1.position]
|
push [scroll1.position]
|
||||||
@ -335,7 +341,7 @@ button:
|
|||||||
mov dx, ax
|
mov dx, ax
|
||||||
add edx, windows
|
add edx, windows
|
||||||
cmp [edx + window.type], WINDOWTYPE_NONE
|
cmp [edx + window.type], WINDOWTYPE_NONE
|
||||||
je exit
|
je quit
|
||||||
mov [window_active], edx
|
mov [window_active], edx
|
||||||
|
|
||||||
push [edx + window.text_line_print]
|
push [edx + window.text_line_print]
|
||||||
@ -347,15 +353,35 @@ button:
|
|||||||
call draw_window
|
call draw_window
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
exit:
|
quit:
|
||||||
|
|
||||||
cmp [socketnum], 0
|
cmp [socketnum], 0
|
||||||
je @f
|
je @f
|
||||||
mov esi, quit_msg
|
mov esi, quit_msg
|
||||||
call quit_server
|
call quit_server
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
error:
|
exit:
|
||||||
|
|
||||||
|
; Close all open windows
|
||||||
|
call window_close_all
|
||||||
|
|
||||||
|
; Erase RAM areas which could contain the connection details
|
||||||
|
xor eax, eax
|
||||||
|
mov edi, irc_server_name
|
||||||
|
mov ecx, MAX_SERVER_NAME
|
||||||
|
rep stosb
|
||||||
|
|
||||||
|
mov edi, user_nick
|
||||||
|
mov ecx, MAX_NICK_LEN
|
||||||
|
rep stosb
|
||||||
|
|
||||||
|
mov edi, user_real_name
|
||||||
|
mov ecx, MAX_REAL_LEN
|
||||||
|
rep stosb
|
||||||
|
|
||||||
|
mov edi, sockaddr1
|
||||||
|
mov ecx, SOCKADDR1_SIZE
|
||||||
|
rep stosb
|
||||||
|
|
||||||
mcall -1
|
mcall -1
|
||||||
|
|
||||||
@ -459,6 +485,7 @@ part_header db 3, '5* ', 0
|
|||||||
topic_header db 3, '3* ', 0
|
topic_header db 3, '3* ', 0
|
||||||
action_header db 3, '6* ', 0
|
action_header db 3, '6* ', 0
|
||||||
ctcp_header db 3, '13-> [', 0
|
ctcp_header db 3, '13-> [', 0
|
||||||
|
ctcp_header_recv db 3, '13', 0
|
||||||
msg_header db 3, '7-> *', 0
|
msg_header db 3, '7-> *', 0
|
||||||
ctcp_version db '] VERSION', 10, 0
|
ctcp_version db '] VERSION', 10, 0
|
||||||
ctcp_ping db '] PING', 10, 0
|
ctcp_ping db '] PING', 10, 0
|
||||||
@ -497,17 +524,17 @@ str_list db 'list', 0
|
|||||||
|
|
||||||
str_help db 'The following commands are available:', 10
|
str_help db 'The following commands are available:', 10
|
||||||
db 10
|
db 10
|
||||||
db '/nick <nick> : change nickname', 10
|
db '/nick <nick> : change nickname', 10
|
||||||
db '/real <real name> : change real name', 10
|
db '/real <real name> : change real name', 10
|
||||||
db '/server <address> : connect to server', 10
|
db '/server <address> : connect to server', 10
|
||||||
db '/code <code> : change codepage (cp866, cp1251, or utf8)', 10
|
db '/code <code> : change codepage (cp866, cp1251, or utf8)', 10
|
||||||
db '/join <channel> : join a channel', 10
|
db '/join <channel> : join a channel', 10
|
||||||
db '/part <channel> : part from a channel', 10
|
db '/part <channel> : part from a channel', 10
|
||||||
db '/quit : quit server', 10
|
db '/quit : quit server', 10
|
||||||
db '/msg <user> : send a private message', 10
|
db '/msg <user> : send a private message', 10
|
||||||
db '/ctcp <user> : send a message using client to client protocol', 10
|
db '/ctcp <user> : send a message using client-to-client protocol', 10
|
||||||
db 10
|
db 10
|
||||||
db 'Other commands are send straight to server.', 10
|
db 'Other commands are sent straight to a server', 10
|
||||||
db 10, 0
|
db 10, 0
|
||||||
|
|
||||||
str_welcome db 3, '3 ___', 3, '7__________', 3, '6_________ ', 3, '4 __ __ __', 10
|
str_welcome db 3, '3 ___', 3, '7__________', 3, '6_________ ', 3, '4 __ __ __', 10
|
||||||
@ -555,6 +582,7 @@ sockaddr1:
|
|||||||
.ip dd 0
|
.ip dd 0
|
||||||
rb 10
|
rb 10
|
||||||
|
|
||||||
|
SOCKADDR1_SIZE = 18
|
||||||
|
|
||||||
status dd STATUS_DISCONNECTED
|
status dd STATUS_DISCONNECTED
|
||||||
|
|
||||||
@ -601,11 +629,11 @@ user_command rb MAX_COMMAND_LEN*4
|
|||||||
utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence
|
utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence
|
||||||
utf8_char dd ? ; first bits of current UTF8 character
|
utf8_char dd ? ; first bits of current UTF8 character
|
||||||
|
|
||||||
packetbuf rb 1024 ; buffer for packets to server
|
packetbuf rb PACKETBUF_SIZE ; buffer for packets to server
|
||||||
path rb 1024
|
path rb PATH_SIZE
|
||||||
param rb 1024
|
param rb PARAM_SIZE
|
||||||
|
|
||||||
servercommand rb 600
|
servercommand rb SERVERCOMMAND_SIZE
|
||||||
|
|
||||||
thread_info process_information
|
thread_info process_information
|
||||||
xsize dd ?
|
xsize dd ?
|
||||||
@ -622,7 +650,7 @@ socketnum dd ? ; TODO: same for socket
|
|||||||
|
|
||||||
user_nick rb MAX_NICK_LEN
|
user_nick rb MAX_NICK_LEN
|
||||||
user_real_name rb MAX_REAL_LEN
|
user_real_name rb MAX_REAL_LEN
|
||||||
quit_msg rb 250
|
quit_msg rb QUIT_MSG_LEN
|
||||||
|
|
||||||
windows rb MAX_WINDOWS*sizeof.window
|
windows rb MAX_WINDOWS*sizeof.window
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Written by hidnplayr@kolibrios.org ;;
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
@ -328,9 +328,38 @@ cmd_ctcp:
|
|||||||
cmp eax, 'dcc ' ; TODO
|
cmp eax, 'dcc ' ; TODO
|
||||||
je cmd_dcc
|
je cmd_dcc
|
||||||
|
|
||||||
; Unknown CTCP command: TODO: just print to window??
|
; Unknown CTCP command - just print to window
|
||||||
|
|
||||||
.fail:
|
.just_print:
|
||||||
|
|
||||||
|
push esi
|
||||||
|
|
||||||
|
if TIMESTAMP
|
||||||
|
call print_timestamp
|
||||||
|
end if
|
||||||
|
|
||||||
|
mov esi, ctcp_header_recv
|
||||||
|
call print_asciiz
|
||||||
|
|
||||||
|
mov al, '<'
|
||||||
|
call print_char
|
||||||
|
|
||||||
|
mov esi, servercommand+1 ; print nickname
|
||||||
|
mov bl, '!'
|
||||||
|
call print_string
|
||||||
|
|
||||||
|
mov al, '>'
|
||||||
|
call print_char
|
||||||
|
|
||||||
|
mov al, ' '
|
||||||
|
call print_char
|
||||||
|
|
||||||
|
pop esi
|
||||||
|
mov bl, 1
|
||||||
|
call print_string
|
||||||
|
|
||||||
|
mov al, 10
|
||||||
|
call print_char
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Written by hidnplayr@kolibrios.org ;;
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
@ -213,9 +213,9 @@ socket_receive:
|
|||||||
; FIXME: make this a proper stream!
|
; FIXME: make this a proper stream!
|
||||||
|
|
||||||
.nextpacket:
|
.nextpacket:
|
||||||
mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet
|
mcall recv, [socketnum], packetbuf, PACKETBUF_SIZE, MSG_DONTWAIT ; read a packet
|
||||||
inc eax ; check if we got any data
|
inc eax ; check if we got any data
|
||||||
jz .done ; TODO: handle errors!
|
jz .done ; TODO: handle errors!
|
||||||
dec eax
|
dec eax
|
||||||
jz .disconnected
|
jz .disconnected
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Written by hidnplayr@kolibrios.org ;;
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
@ -204,9 +204,6 @@ cmd_usr_msg:
|
|||||||
stosw
|
stosw
|
||||||
mov byte[edi], 0
|
mov byte[edi], 0
|
||||||
|
|
||||||
lea esi, [edi - packetbuf]
|
|
||||||
mcall send, [socketnum], packetbuf, , 0
|
|
||||||
|
|
||||||
; now print to the window
|
; now print to the window
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
call print_timestamp
|
call print_timestamp
|
||||||
@ -226,7 +223,13 @@ cmd_usr_msg:
|
|||||||
call print_char
|
call print_char
|
||||||
|
|
||||||
pop esi
|
pop esi
|
||||||
|
push esi
|
||||||
call print_asciiz
|
call print_asciiz
|
||||||
|
pop esi
|
||||||
|
|
||||||
|
|
||||||
|
lea esi, [edi - packetbuf]
|
||||||
|
mcall send, [socketnum], packetbuf, , 0
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
ret
|
ret
|
||||||
@ -527,6 +530,8 @@ cmd_usr_ctcp:
|
|||||||
mov al, 0x01
|
mov al, 0x01
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
|
push edi esi
|
||||||
|
|
||||||
; copy the message itself
|
; copy the message itself
|
||||||
@@:
|
@@:
|
||||||
lodsb
|
lodsb
|
||||||
@ -545,13 +550,35 @@ cmd_usr_ctcp:
|
|||||||
stosb
|
stosb
|
||||||
mov ax, 0x0a0d
|
mov ax, 0x0a0d
|
||||||
stosw
|
stosw
|
||||||
|
mov byte[edi], 0
|
||||||
|
|
||||||
|
; now print to the window
|
||||||
|
if TIMESTAMP
|
||||||
|
call print_timestamp
|
||||||
|
end if
|
||||||
|
|
||||||
|
mov esi, ctcp_header
|
||||||
|
call print_asciiz
|
||||||
|
|
||||||
|
mov esi, packetbuf+8
|
||||||
|
mov bl, ' '
|
||||||
|
call print_string
|
||||||
|
|
||||||
|
mov al, ']'
|
||||||
|
call print_char
|
||||||
|
|
||||||
|
mov al, ' '
|
||||||
|
call print_char
|
||||||
|
|
||||||
|
pop esi
|
||||||
|
call print_asciiz
|
||||||
|
pop esi
|
||||||
|
|
||||||
|
|
||||||
; now send it away
|
; now send it away
|
||||||
lea esi, [edi - packetbuf] ; calculate length
|
lea esi, [edi - packetbuf] ; calculate length
|
||||||
mcall send, [socketnum], packetbuf, , 0 ; and finally send to server
|
mcall send, [socketnum], packetbuf, , 0 ; and finally send to server
|
||||||
|
|
||||||
;; TODO: print to window
|
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Written by hidnplayr@kolibrios.org ;;
|
;; Written by hidnplayr@kolibrios.org ;;
|
||||||
@ -31,7 +31,7 @@ window_create_textbox:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov ecx, (sizeof.window_data+3)/4
|
mov ecx, (sizeof.window_data+3)/4
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
mov [ebx + window.data_ptr], eax
|
mov [ebx + window.data_ptr], eax
|
||||||
@ -81,6 +81,16 @@ window_set_name:
|
|||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
window_close_all:
|
||||||
|
|
||||||
|
.loop:
|
||||||
|
call window_close
|
||||||
|
|
||||||
|
cmp [window_print], 0
|
||||||
|
jne .loop
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
window_close: ; closes the 'print' window
|
window_close: ; closes the 'print' window
|
||||||
|
|
||||||
@ -90,27 +100,43 @@ window_close: ; closes the 'print' window
|
|||||||
lea esi, [edi + sizeof.window]
|
lea esi, [edi + sizeof.window]
|
||||||
mov ecx, windows + MAX_WINDOWS*sizeof.window
|
mov ecx, windows + MAX_WINDOWS*sizeof.window
|
||||||
sub ecx, esi
|
sub ecx, esi
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
; Completely zero the trailing window block (there will always be one!)
|
; Completely zero the trailing window block (there will always be one!)
|
||||||
mov ecx, sizeof.window
|
mov ecx, sizeof.window
|
||||||
xor al, al
|
xor al, al
|
||||||
rep stosb
|
rep stosb
|
||||||
|
|
||||||
; free the window data block
|
; Clear the window data block to erase the chat history and nicknames
|
||||||
|
mov edi, [esp]
|
||||||
|
mov ecx, sizeof.window_data ; TEXT_BUFFERSIZE + MAX_NICK_LEN * MAX_USERS
|
||||||
|
rep stosb
|
||||||
|
|
||||||
|
; And now free the window data block
|
||||||
pop ecx
|
pop ecx
|
||||||
mcall 68, 13
|
mcall 68, 13
|
||||||
|
|
||||||
; We closed this window so we need to show another
|
; We closed this window so we need to show another
|
||||||
|
; Is there still a window in the active position?
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
cmp [edi + window.data_ptr], 0
|
cmp [edi + window.data_ptr], 0
|
||||||
jne @f
|
jne .redraw
|
||||||
|
; Did we just close the last window?
|
||||||
|
cmp edi, windows
|
||||||
|
je .closed_last
|
||||||
|
; Nope, move one window to the left
|
||||||
sub edi, sizeof.window
|
sub edi, sizeof.window
|
||||||
mov [window_active], edi
|
mov [window_active], edi
|
||||||
mov [window_print], edi
|
mov [window_print], edi
|
||||||
@@:
|
jmp .redraw
|
||||||
|
|
||||||
|
.closed_last:
|
||||||
|
xor edi, edi
|
||||||
|
mov [window_active], edi
|
||||||
|
mov [window_print], edi
|
||||||
|
|
||||||
; At last, redraw everything
|
; At last, redraw everything
|
||||||
|
.redraw:
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user