forked from KolibriOS/kolibrios
Now IRCc will print messages to the correct window instead of just using the one that is opened.
git-svn-id: svn://kolibrios.org@3226 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
41fcb88df4
commit
b7a4b76a9e
@ -84,7 +84,7 @@ use32
|
|||||||
dd I_END ; program image size
|
dd I_END ; program image size
|
||||||
dd IM_END+2048 ; required amount of memory
|
dd IM_END+2048 ; required amount of memory
|
||||||
dd IM_END+2048
|
dd IM_END+2048
|
||||||
dd 0
|
dd param
|
||||||
dd path
|
dd path
|
||||||
|
|
||||||
include "../macros.inc"
|
include "../macros.inc"
|
||||||
@ -332,7 +332,7 @@ default_nick db 'kolibri_user', 0
|
|||||||
default_real db 'Kolibri User', 0
|
default_real db 'Kolibri User', 0
|
||||||
|
|
||||||
str_welcome db 10
|
str_welcome db 10
|
||||||
db '.______________________ .__ .__ __',10
|
db ' ______________________ __ __ __',10
|
||||||
db '| \______ \_ ___ \ ____ | | |__| ____ _____/ |_',10
|
db '| \______ \_ ___ \ ____ | | |__| ____ _____/ |_',10
|
||||||
db '| || _/ \ \/ _/ ___\| | | |/ __ \ / \ __\',10
|
db '| || _/ \ \/ _/ ___\| | | |/ __ \ / \ __\',10
|
||||||
db '| || | \ \____ \ \___| |_| \ ___/| | \ |',10
|
db '| || | \ \____ \ \___| |_| \ ___/| | \ |',10
|
||||||
@ -428,6 +428,7 @@ gai_reqdata rb 32 ; buffer for getaddrinfo_start/process
|
|||||||
ip_list dd ? ; will be filled as pointer to addrinfo list
|
ip_list dd ? ; will be filled as pointer to addrinfo list
|
||||||
packetbuf rb 1024 ; buffer for packets to server
|
packetbuf rb 1024 ; buffer for packets to server
|
||||||
path rb 1024
|
path rb 1024
|
||||||
|
param rb 1024
|
||||||
|
|
||||||
socketnum dd ?
|
socketnum dd ?
|
||||||
|
|
||||||
|
@ -67,6 +67,8 @@ server_commands:
|
|||||||
|
|
||||||
.number = ($ - server_commands) / 8
|
.number = ($ - server_commands) / 8
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
compare_to_nick:
|
compare_to_nick:
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
@ -106,11 +108,81 @@ compare_to_nick:
|
|||||||
pop esi
|
pop esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
skip_nick:
|
||||||
|
|
||||||
|
; First: skip the NICK (maybe we should verify it?)
|
||||||
|
.nick:
|
||||||
|
lodsb
|
||||||
|
cmp al, ' '
|
||||||
|
je .skip
|
||||||
|
cmp al, ':'
|
||||||
|
je .skip
|
||||||
|
jmp .nick
|
||||||
|
|
||||||
|
; skip all leading spaces and semicolons
|
||||||
|
.skip:
|
||||||
|
lodsb
|
||||||
|
cmp al, ' '
|
||||||
|
je .skip
|
||||||
|
cmp al, ':'
|
||||||
|
je .skip
|
||||||
|
dec esi
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
find_window:
|
align 4
|
||||||
|
find_window: ; esi is ptr to windowname
|
||||||
|
|
||||||
; mov [window_print],
|
; TODO: if the window in question does not exist, create it ???
|
||||||
|
|
||||||
|
; 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
|
||||||
|
push esi
|
||||||
|
lea edi, [ebx + window.name]
|
||||||
|
mov ecx, MAX_WINDOWNAME_LEN
|
||||||
|
repe cmpsb
|
||||||
|
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
|
||||||
|
|
||||||
|
; found it!
|
||||||
|
.got_it:
|
||||||
|
add esp, 4
|
||||||
|
mov [window_print], ebx
|
||||||
|
dec esi
|
||||||
|
|
||||||
|
; now skip trailing spaces and semicolons
|
||||||
|
.done:
|
||||||
|
lodsb
|
||||||
|
test al, al
|
||||||
|
jz .quit
|
||||||
|
cmp al, ' '
|
||||||
|
je .done
|
||||||
|
cmp al, ':'
|
||||||
|
je .done
|
||||||
|
dec esi
|
||||||
|
|
||||||
|
.quit:
|
||||||
|
call window_refresh
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -146,8 +218,6 @@ cmd_notice:
|
|||||||
inc esi
|
inc esi
|
||||||
cmp byte [esi], 0
|
cmp byte [esi], 0
|
||||||
je .fail
|
je .fail
|
||||||
; cmp byte [esi], 10 ; newline
|
|
||||||
; je server_parser.parse
|
|
||||||
cmp byte [esi], ' '
|
cmp byte [esi], ' '
|
||||||
jne .loop
|
jne .loop
|
||||||
|
|
||||||
@ -196,36 +266,12 @@ cmd_ping:
|
|||||||
cmd_privmsg:
|
cmd_privmsg:
|
||||||
|
|
||||||
add esi, 8 ; skip 'PRIVMSG '
|
add esi, 8 ; skip 'PRIVMSG '
|
||||||
|
call find_window ; esi now points to end of destination name
|
||||||
|
|
||||||
; Check if it was destined for me privately
|
cmp byte[esi], 1
|
||||||
mov edi, servercommand+1
|
|
||||||
call compare_to_nick
|
|
||||||
;;; je .private
|
|
||||||
|
|
||||||
; If not, find the correct window ???
|
|
||||||
|
|
||||||
; now find the end of nick
|
|
||||||
mov edi, esi
|
|
||||||
.loop:
|
|
||||||
inc edi
|
|
||||||
cmp byte [edi], 0
|
|
||||||
je .fail
|
|
||||||
cmp byte [edi], ' '
|
|
||||||
jne .loop
|
|
||||||
|
|
||||||
.loop2:
|
|
||||||
inc edi
|
|
||||||
cmp byte [edi], 0
|
|
||||||
je .fail
|
|
||||||
cmp byte [edi], ' '
|
|
||||||
je .loop2
|
|
||||||
cmp byte [edi], ':'
|
|
||||||
je .loop2
|
|
||||||
cmp byte [edi], 1
|
|
||||||
je cmd_ctcp
|
je cmd_ctcp
|
||||||
|
|
||||||
; Action?
|
cmp dword[esi], 'ACTI' ; Action?
|
||||||
cmp dword[edi+1], 'ACTI'
|
|
||||||
je .action
|
je .action
|
||||||
|
|
||||||
; nope, just plain old privmsg
|
; nope, just plain old privmsg
|
||||||
@ -233,7 +279,7 @@ if TIMESTAMP
|
|||||||
call print_timestamp
|
call print_timestamp
|
||||||
end if
|
end if
|
||||||
|
|
||||||
push edi
|
push esi
|
||||||
mov bl, '<'
|
mov bl, '<'
|
||||||
call print_character
|
call print_character
|
||||||
|
|
||||||
@ -257,7 +303,7 @@ end if
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.action:
|
.action:
|
||||||
push edi
|
push esi
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
call print_timestamp
|
call print_timestamp
|
||||||
end if
|
end if
|
||||||
@ -282,22 +328,22 @@ end if
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
cmd_ctcp:
|
cmd_ctcp:
|
||||||
|
inc esi
|
||||||
|
|
||||||
cmp dword[edi+1], 'VERS'
|
cmp dword[esi], 'VERS'
|
||||||
je .version
|
je .version
|
||||||
|
|
||||||
cmp dword[edi+1], 'TIME'
|
cmp dword[esi], 'TIME'
|
||||||
je .time
|
je .time
|
||||||
|
|
||||||
cmp dword[edi+1], 'PING'
|
cmp dword[esi], 'PING'
|
||||||
je .ping
|
je .ping
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.time:
|
.time:
|
||||||
lea esi, [edi+1]
|
mov byte [esi+4], ' '
|
||||||
mov byte [edi+5], ' '
|
lea edi, [esi+5]
|
||||||
add edi, 6
|
|
||||||
|
|
||||||
; TODO: add system date (fn 29) in human readable format
|
; TODO: add system date (fn 29) in human readable format
|
||||||
|
|
||||||
@ -363,7 +409,6 @@ cmd_ctcp:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.ping:
|
.ping:
|
||||||
lea esi, [edi+1]
|
|
||||||
call ctcp_reply
|
call ctcp_reply
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
@ -432,6 +477,10 @@ ctcp_reply:
|
|||||||
|
|
||||||
cmd_part:
|
cmd_part:
|
||||||
add esi, 5 ; skip 'PART '
|
add esi, 5 ; skip 'PART '
|
||||||
|
push esi
|
||||||
|
call skip_nick
|
||||||
|
call find_window
|
||||||
|
pop esi
|
||||||
|
|
||||||
; Is it me who parted?
|
; Is it me who parted?
|
||||||
mov edi, servercommand+1
|
mov edi, servercommand+1
|
||||||
@ -528,7 +577,7 @@ cmd_join:
|
|||||||
|
|
||||||
.no_new_window:
|
.no_new_window:
|
||||||
push esi
|
push esi
|
||||||
call window_set_name
|
call find_window
|
||||||
|
|
||||||
mov esi, action_header
|
mov esi, action_header
|
||||||
call print_text2
|
call print_text2
|
||||||
@ -554,7 +603,7 @@ cmd_join:
|
|||||||
|
|
||||||
|
|
||||||
cmd_nick:
|
cmd_nick:
|
||||||
|
; NOTE: This command applies to a user, and thus has no specific channel
|
||||||
add esi, 5 ; skip 'NICK '
|
add esi, 5 ; skip 'NICK '
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
@ -617,6 +666,9 @@ cmd_kick:
|
|||||||
.not_me:
|
.not_me:
|
||||||
; find the channel user has been kicked from
|
; find the channel user has been kicked from
|
||||||
push esi
|
push esi
|
||||||
|
call skip_nick
|
||||||
|
call find_window
|
||||||
|
|
||||||
mov esi, action_header_short
|
mov esi, action_header_short
|
||||||
call print_text2
|
call print_text2
|
||||||
|
|
||||||
@ -640,6 +692,7 @@ cmd_kick:
|
|||||||
|
|
||||||
|
|
||||||
cmd_quit:
|
cmd_quit:
|
||||||
|
; NOTE: This command applies to a user, and thus has no specific channel
|
||||||
|
|
||||||
mov esi, action_header
|
mov esi, action_header
|
||||||
call print_text2
|
call print_text2
|
||||||
@ -686,28 +739,10 @@ cmd_mode:
|
|||||||
cmd_353: ; channel usernames reply
|
cmd_353: ; channel usernames reply
|
||||||
|
|
||||||
add esi, 4 ; skip '353 '
|
add esi, 4 ; skip '353 '
|
||||||
|
call skip_nick
|
||||||
; first, find the channel name
|
inc esi ; channel type '*', '=' or '@'
|
||||||
.loop1:
|
inc esi ; ' '
|
||||||
lodsb
|
call find_window
|
||||||
cmp al, '#'
|
|
||||||
je .got_channel
|
|
||||||
test al, al
|
|
||||||
jnz .loop1
|
|
||||||
ret
|
|
||||||
|
|
||||||
.got_channel:
|
|
||||||
|
|
||||||
; now find the semicolon separating channelname and usernames
|
|
||||||
.loop2:
|
|
||||||
lodsb
|
|
||||||
cmp al, ':'
|
|
||||||
je .got_list
|
|
||||||
test al, al
|
|
||||||
jnz .loop2
|
|
||||||
ret
|
|
||||||
|
|
||||||
.got_list:
|
|
||||||
|
|
||||||
; now find window ptr and check if this is the first 353 message
|
; now find window ptr and check if this is the first 353 message
|
||||||
mov ebx, [window_print]
|
mov ebx, [window_print]
|
||||||
@ -765,6 +800,10 @@ cmd_353: ; channel usernames reply
|
|||||||
|
|
||||||
cmd_366: ; channel usernames end
|
cmd_366: ; channel usernames end
|
||||||
|
|
||||||
|
add esi, 4 ; skip '366 '
|
||||||
|
call skip_nick
|
||||||
|
call find_window
|
||||||
|
|
||||||
mov ebx, [window_print]
|
mov ebx, [window_print]
|
||||||
and [ebx + window.flags], not FLAG_RECEIVING_NAMES
|
and [ebx + window.flags], not FLAG_RECEIVING_NAMES
|
||||||
|
|
||||||
@ -775,13 +814,8 @@ cmd_366: ; channel usernames end
|
|||||||
cmd_topic:
|
cmd_topic:
|
||||||
|
|
||||||
add esi, 4 ; skip '332 '
|
add esi, 4 ; skip '332 '
|
||||||
|
call skip_nick
|
||||||
.loop:
|
call find_window
|
||||||
lodsb
|
|
||||||
test al, al
|
|
||||||
je .fail
|
|
||||||
cmp al, ':'
|
|
||||||
jne .loop
|
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
mov esi, action_header
|
mov esi, action_header
|
||||||
@ -803,18 +837,18 @@ cmd_topic:
|
|||||||
cmd_333:
|
cmd_333:
|
||||||
|
|
||||||
add esi, 4 ; skip '333 '
|
add esi, 4 ; skip '333 '
|
||||||
|
call skip_nick ;;;;
|
||||||
|
call find_window
|
||||||
|
|
||||||
; TODO: check channelname and change pointer accordingly
|
; mov ecx, 2 ; number of spaces to find ;;; CHECKME
|
||||||
|
; .loop:
|
||||||
mov ecx, 3 ; number of spaces to find
|
; lodsb
|
||||||
.loop:
|
; test al, al
|
||||||
lodsb
|
; je .fail
|
||||||
test al, al
|
; cmp al, ' '
|
||||||
je .fail
|
; jne .loop
|
||||||
cmp al, ' '
|
; dec ecx
|
||||||
jne .loop
|
; jnz .loop ; find some more spaces
|
||||||
dec ecx
|
|
||||||
jnz .loop ; find some more spaces
|
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
mov esi, action_header
|
mov esi, action_header
|
||||||
|
@ -24,6 +24,12 @@ user_parser:
|
|||||||
|
|
||||||
; Ok, we said something, print it to our textbox
|
; Ok, we said something, print it to our textbox
|
||||||
|
|
||||||
|
; TODO: dont send if it's a server window?
|
||||||
|
|
||||||
|
push [window_open] ; print to the current window
|
||||||
|
pop [window_print]
|
||||||
|
call window_refresh
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
call print_timestamp
|
call print_timestamp
|
||||||
end if
|
end if
|
||||||
@ -53,7 +59,7 @@ user_parser:
|
|||||||
mov dword[packetbuf], 'priv'
|
mov dword[packetbuf], 'priv'
|
||||||
mov dword[packetbuf+4], 'msg '
|
mov dword[packetbuf+4], 'msg '
|
||||||
|
|
||||||
mov esi, [window_print]
|
mov esi, [window_open]
|
||||||
add esi, window.name
|
add esi, window.name
|
||||||
mov edi, packetbuf+8
|
mov edi, packetbuf+8
|
||||||
mov ecx, MAX_WINDOWNAME_LEN
|
mov ecx, MAX_WINDOWNAME_LEN
|
||||||
|
@ -46,7 +46,7 @@ window_set_name: ; esi = ptr to name, ebx = window ptr
|
|||||||
mov ecx, MAX_WINDOWNAME_LEN
|
mov ecx, MAX_WINDOWNAME_LEN
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 10
|
cmp al, 0x20
|
||||||
jbe .addzero
|
jbe .addzero
|
||||||
stosb
|
stosb
|
||||||
dec ecx
|
dec ecx
|
||||||
@ -63,17 +63,6 @@ window_set_name: ; esi = ptr to name, ebx = window ptr
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
window_find: ; esi is ptr to windowname
|
|
||||||
|
|
||||||
; mov [current_window],
|
|
||||||
; call reset_gui
|
|
||||||
|
|
||||||
.fail:
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window_refresh:
|
window_refresh:
|
||||||
|
|
||||||
; set the correct buffer pointers ; FIXME: what is it good for?
|
; set the correct buffer pointers ; FIXME: what is it good for?
|
||||||
@ -81,7 +70,7 @@ window_refresh:
|
|||||||
imul eax, 11 ;
|
imul eax, 11 ;
|
||||||
mov [pos], eax ;
|
mov [pos], eax ;
|
||||||
|
|
||||||
mov eax, [window_open]
|
mov eax, [window_print]
|
||||||
mov eax, [eax + window.data_ptr]
|
mov eax, [eax + window.data_ptr]
|
||||||
add eax, window_data.text
|
add eax, window_data.text
|
||||||
mov [text_start], eax
|
mov [text_start], eax
|
||||||
|
Loading…
Reference in New Issue
Block a user