2013-05-28 19:34:26 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2024-02-23 22:15:46 +01:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
|
2013-05-28 19:34:26 +02:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
2013-11-01 15:02:08 +01:00
|
|
|
;; Written by hidnplayr@kolibrios.org ;;
|
2013-05-28 19:34:26 +02:00
|
|
|
;; ;;
|
|
|
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
|
|
|
;; Version 2, June 1991 ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
server_parser:
|
|
|
|
|
|
|
|
mov esi, servercommand
|
2024-02-23 22:15:46 +01:00
|
|
|
mov ebx, ecx
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
cmp byte [esi], ':'
|
|
|
|
jne .parse
|
|
|
|
|
|
|
|
.spaceloop:
|
|
|
|
lodsb
|
|
|
|
test al, al
|
|
|
|
jz .fail
|
|
|
|
cmp al, ' '
|
|
|
|
jne .spaceloop
|
|
|
|
|
|
|
|
.parse:
|
|
|
|
mov eax, [esi]
|
2024-02-23 22:15:46 +01:00
|
|
|
or eax, 0x20202020 ; convert to lowercase
|
2013-05-28 19:34:26 +02:00
|
|
|
mov edi, server_commands
|
|
|
|
mov ecx, server_commands.number
|
|
|
|
|
|
|
|
.loop:
|
|
|
|
scasd
|
|
|
|
je .got_cmd
|
|
|
|
add edi, 4
|
|
|
|
dec ecx
|
|
|
|
jnz .loop
|
|
|
|
|
|
|
|
.fail:
|
|
|
|
ret
|
|
|
|
|
|
|
|
.got_cmd:
|
2024-02-23 22:15:46 +01:00
|
|
|
mov ecx, ebx
|
2013-05-28 19:34:26 +02:00
|
|
|
jmp dword[edi]
|
|
|
|
|
|
|
|
|
|
|
|
server_commands:
|
|
|
|
|
2016-01-03 15:50:44 +01:00
|
|
|
dd '001 ', cmd_welcome
|
2014-03-09 17:07:08 +01:00
|
|
|
dd '002 ', cmd_justprint
|
|
|
|
dd '003 ', cmd_justprint
|
|
|
|
dd '004 ', cmd_justprint
|
|
|
|
dd '005 ', cmd_justprint
|
|
|
|
|
|
|
|
dd '250 ', cmd_justprint
|
|
|
|
dd '251 ', cmd_justprint
|
|
|
|
dd '252 ', cmd_justprint
|
|
|
|
dd '253 ', cmd_justprint
|
|
|
|
dd '254 ', cmd_justprint
|
|
|
|
dd '255 ', cmd_justprint
|
|
|
|
|
|
|
|
dd '265 ', cmd_justprint
|
|
|
|
dd '266 ', cmd_justprint
|
|
|
|
|
2015-02-16 18:22:03 +01:00
|
|
|
dd '311 ', cmd_justprint ; RPL_WHOISUSER
|
|
|
|
dd '312 ', cmd_justprint ; RPL_WHOISSERVER
|
2021-07-26 18:18:14 +02:00
|
|
|
dd '317 ', cmd_justprint ; RPL_WHOISIDLE
|
2015-02-16 18:22:03 +01:00
|
|
|
dd '318 ', cmd_justprint ; RPL_ENDOFWHOIS
|
2021-07-26 18:18:14 +02:00
|
|
|
dd '319 ', cmd_justprint ; RPL_WHOISCHANNELS
|
2013-05-28 19:34:26 +02:00
|
|
|
dd '322 ', cmd_322 ; RPL_LIST
|
|
|
|
dd '323 ', cmd_323 ; RPL_LISTEND
|
2015-02-16 18:22:03 +01:00
|
|
|
dd '324 ', cmd_justprint ; RPL_CHANNELMODEIS
|
2014-03-09 17:07:08 +01:00
|
|
|
dd '328 ', cmd_justprint ; RPL_CHANNEL_URL
|
2015-02-16 18:22:03 +01:00
|
|
|
dd '329 ', cmd_justprint ; RPL_CREATIONTIME
|
|
|
|
dd '330 ', cmd_justprint
|
|
|
|
dd '332 ', cmd_topic ; topic
|
2013-05-28 19:34:26 +02:00
|
|
|
dd '333 ', cmd_333 ; nickname and time of topic
|
2021-07-26 18:18:14 +02:00
|
|
|
dd '338 ', cmd_justprint ; RPL_CHANPASSOK
|
2013-05-28 19:34:26 +02:00
|
|
|
dd '353 ', cmd_353 ; name reply
|
|
|
|
dd '366 ', cmd_366 ; end of names list
|
2014-03-09 17:07:08 +01:00
|
|
|
dd '372 ', cmd_justprint ; motd
|
|
|
|
dd '375 ', cmd_justprint ; start of motd
|
|
|
|
dd '376 ', cmd_justprint ; end of motd
|
|
|
|
dd '421 ', cmd_justprint ; unknown command
|
2016-01-03 15:50:44 +01:00
|
|
|
dd '432 ', cmd_justprint ; erroneous nickname
|
2014-03-09 17:07:08 +01:00
|
|
|
dd '433 ', cmd_justprint ; nickname already in use
|
2016-01-03 15:50:44 +01:00
|
|
|
dd '436 ', cmd_justprint ; nickname collision
|
2021-07-26 18:18:14 +02:00
|
|
|
dd '671 ', cmd_justprint ; RPL_WHOISSECURE
|
2014-03-09 17:07:08 +01:00
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
dd 'join', cmd_join
|
|
|
|
dd 'kick', cmd_kick
|
|
|
|
dd 'mode', cmd_mode
|
|
|
|
dd 'nick', cmd_nick
|
|
|
|
dd 'part', cmd_part
|
|
|
|
dd 'ping', cmd_ping
|
|
|
|
dd 'priv', cmd_privmsg
|
|
|
|
dd 'quit', cmd_quit
|
|
|
|
dd 'noti', cmd_notice
|
|
|
|
|
|
|
|
.number = ($ - server_commands) / 8
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
compare_to_nick:
|
|
|
|
|
|
|
|
push esi
|
|
|
|
mov ecx, MAX_NICK_LEN
|
|
|
|
mov esi, user_nick
|
|
|
|
.loop:
|
|
|
|
lodsb
|
|
|
|
cmp al, ' '
|
|
|
|
jbe .done
|
2014-01-18 16:51:43 +01:00
|
|
|
test al, al
|
|
|
|
jz .done
|
2013-05-28 19:34:26 +02:00
|
|
|
cmp al, 'a'
|
|
|
|
jb .ok
|
|
|
|
cmp al, 'z'
|
|
|
|
ja .ok
|
|
|
|
sub al, 0x20
|
|
|
|
.ok:
|
|
|
|
|
|
|
|
mov bl, byte[edi]
|
|
|
|
cmp bl, 'a'
|
|
|
|
jb .ok2
|
|
|
|
cmp bl, 'z'
|
|
|
|
ja .ok2
|
|
|
|
sub bl, 0x20
|
|
|
|
.ok2:
|
|
|
|
cmp bl, al
|
|
|
|
jne .not_equal
|
|
|
|
inc edi
|
|
|
|
dec ecx
|
|
|
|
jnz .loop
|
|
|
|
|
|
|
|
.done:
|
|
|
|
xor eax, eax
|
|
|
|
pop esi
|
|
|
|
ret
|
|
|
|
|
|
|
|
.not_equal:
|
|
|
|
or eax, -1
|
|
|
|
pop esi
|
|
|
|
ret
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
align 4
|
2014-01-18 16:51:43 +01:00
|
|
|
skip_parameter:
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-02-25 23:18:36 +01:00
|
|
|
; First: skip the parameter (scan untill space or colon)
|
2014-01-18 16:51:43 +01:00
|
|
|
.part1:
|
2013-05-28 19:34:26 +02:00
|
|
|
lodsb
|
|
|
|
cmp al, ' '
|
2014-01-18 16:51:43 +01:00
|
|
|
je .part2
|
2013-05-28 19:34:26 +02:00
|
|
|
cmp al, ':'
|
2014-01-18 16:51:43 +01:00
|
|
|
jne .part1
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-02-25 23:18:36 +01:00
|
|
|
; Skip all trailing spaces
|
|
|
|
.part3:
|
|
|
|
lodsb
|
|
|
|
cmp al, ' '
|
|
|
|
je .part3
|
|
|
|
dec esi
|
|
|
|
ret
|
|
|
|
|
|
|
|
; Now, skip all trailing spaces and first semicolon
|
2014-01-18 16:51:43 +01:00
|
|
|
.part2:
|
2013-05-28 19:34:26 +02:00
|
|
|
lodsb
|
|
|
|
cmp al, ' '
|
2014-01-18 16:51:43 +01:00
|
|
|
je .part2
|
2013-05-28 19:34:26 +02:00
|
|
|
cmp al, ':'
|
2014-02-25 23:18:36 +01:00
|
|
|
je .part3
|
2013-05-28 19:34:26 +02:00
|
|
|
dec esi
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-03 15:50:44 +01:00
|
|
|
cmd_welcome:
|
2014-02-25 23:18:36 +01:00
|
|
|
|
2016-01-03 15:50:44 +01:00
|
|
|
mov [status], STATUS_LOGGED_IN
|
2014-02-25 23:18:36 +01:00
|
|
|
|
2014-03-09 17:07:08 +01:00
|
|
|
cmd_justprint:
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
add esi, 4
|
2014-03-09 22:57:21 +01:00
|
|
|
call skip_parameter ; our nickname
|
|
|
|
|
|
|
|
call print_asciiz
|
|
|
|
|
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 17:07:08 +01:00
|
|
|
ret
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
|
2016-01-03 15:50:44 +01:00
|
|
|
|
2014-03-09 17:07:08 +01:00
|
|
|
cmd_notice:
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
2014-03-09 17:07:08 +01:00
|
|
|
cmp byte[servercommand], ':'
|
|
|
|
jne .gogogo
|
|
|
|
|
|
|
|
mov byte [esi-1], 0
|
2013-05-28 19:34:26 +02:00
|
|
|
push esi
|
|
|
|
mov esi, str_1
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
mov esi, str_2
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
pop esi
|
|
|
|
|
|
|
|
.gogogo:
|
|
|
|
add esi, 6
|
2014-03-09 17:07:08 +01:00
|
|
|
call skip_parameter
|
|
|
|
call skip_parameter
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2014-03-09 17:07:08 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_ping:
|
|
|
|
|
|
|
|
; Just change PING to PONG
|
|
|
|
mov dword[esi], 'PONG'
|
|
|
|
|
2024-02-23 22:15:46 +01:00
|
|
|
; Append \r\n
|
|
|
|
mov word[esi+ecx], 0x0a0d
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2024-02-23 22:15:46 +01:00
|
|
|
; And send the response to the server
|
2013-05-28 19:34:26 +02:00
|
|
|
mov edx, esi
|
2024-02-23 22:15:46 +01:00
|
|
|
lea esi, [ecx+2]
|
2013-05-28 19:34:26 +02:00
|
|
|
mcall send, [socketnum], , , 0
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_privmsg:
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
mov eax, dword[esi+4]
|
|
|
|
or eax, 0x20202020
|
|
|
|
cmp eax, 'msg '
|
|
|
|
jne .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
add esi, 8 ; skip 'PRIVMSG '
|
2014-01-18 16:51:43 +01:00
|
|
|
|
|
|
|
mov edi, esi
|
|
|
|
call compare_to_nick
|
|
|
|
jne .channel
|
|
|
|
|
|
|
|
; private chat message
|
|
|
|
push esi
|
|
|
|
mov esi, servercommand+1
|
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail2
|
2014-01-18 16:51:43 +01:00
|
|
|
pop esi
|
|
|
|
call skip_parameter ; our own nickname
|
|
|
|
jmp .print
|
|
|
|
|
|
|
|
.channel:
|
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2014-01-18 16:51:43 +01:00
|
|
|
|
|
|
|
.print:
|
2014-03-16 12:50:59 +01:00
|
|
|
cmp byte[esi], 1 ; Client to Client protocol?
|
|
|
|
je cmd_ctcp
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
if TIMESTAMP
|
2013-05-28 19:34:26 +02:00
|
|
|
call print_timestamp
|
2013-11-01 15:02:08 +01:00
|
|
|
end if
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
push esi
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, '<'
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, '>'
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, ' '
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
pop esi
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
|
|
|
|
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
ret
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
.fail2:
|
|
|
|
pop esi
|
2013-05-28 19:34:26 +02:00
|
|
|
.fail:
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2013-10-07 16:02:05 +02:00
|
|
|
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
cmd_ctcp:
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
inc esi
|
2013-11-01 15:02:08 +01:00
|
|
|
mov eax, dword[esi]
|
|
|
|
or eax, 0x20202020
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
cmp eax, 'vers'
|
2013-05-28 19:34:26 +02:00
|
|
|
je .version
|
2013-11-01 15:02:08 +01:00
|
|
|
cmp eax, 'time'
|
2013-05-28 19:34:26 +02:00
|
|
|
je .time
|
2013-11-01 15:02:08 +01:00
|
|
|
cmp eax, 'ping'
|
2013-05-28 19:34:26 +02:00
|
|
|
je .ping
|
2013-11-01 15:02:08 +01:00
|
|
|
cmp eax, 'acti'
|
|
|
|
je .action
|
2014-01-18 16:51:43 +01:00
|
|
|
cmp eax, 'dcc ' ; TODO
|
|
|
|
je cmd_dcc
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2018-07-01 16:29:23 +02:00
|
|
|
; Unknown CTCP command - just print to window
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2018-07-01 16:29:23 +02:00
|
|
|
.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
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.time:
|
2013-11-01 15:02:08 +01:00
|
|
|
mov byte[esi+4], ' '
|
2013-05-28 19:34:26 +02:00
|
|
|
lea edi, [esi+5]
|
|
|
|
|
|
|
|
; TODO: add system date (fn 29) in human readable format
|
|
|
|
|
|
|
|
mcall 3 ; get system time
|
|
|
|
|
|
|
|
mov ecx, 3
|
|
|
|
.timeloop:
|
|
|
|
mov bl, al
|
|
|
|
shr al, 4
|
|
|
|
add al, '0'
|
|
|
|
stosb
|
|
|
|
|
|
|
|
mov al, bl
|
|
|
|
and al, 0x0f
|
|
|
|
add al, '0'
|
|
|
|
stosb
|
|
|
|
|
|
|
|
dec ecx
|
|
|
|
jz .timedone
|
|
|
|
|
|
|
|
mov al, ':'
|
|
|
|
stosb
|
|
|
|
shr eax, 8
|
|
|
|
jmp .timeloop
|
|
|
|
|
|
|
|
.timedone:
|
|
|
|
xor al, al
|
|
|
|
stosb
|
|
|
|
call ctcp_reply
|
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, ctcp_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, servercommand+1
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, ctcp_time
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.version:
|
|
|
|
mov esi, str_version
|
|
|
|
call ctcp_reply
|
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, ctcp_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, servercommand+1
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, ctcp_version
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.ping:
|
|
|
|
call ctcp_reply
|
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, ctcp_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, servercommand+1
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, ctcp_ping
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
.action:
|
|
|
|
add esi, 7
|
|
|
|
push esi
|
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, action_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1 ; print nickname
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, ' '
|
|
|
|
call print_char
|
2013-11-01 15:02:08 +01:00
|
|
|
|
|
|
|
pop esi
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-11-01 15:02:08 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
cmd_dcc:
|
|
|
|
add esi, 4
|
|
|
|
mov eax, dword[esi]
|
|
|
|
or eax, 0x202020
|
|
|
|
|
|
|
|
cmp eax, 'send'
|
|
|
|
je .send
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.send:
|
2014-01-18 16:51:43 +01:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2014-01-18 16:51:43 +01:00
|
|
|
mov [ebx + window.type], WINDOWTYPE_DCC
|
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
.fail:
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
ret
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
ctcp_reply:
|
|
|
|
|
|
|
|
push esi
|
2016-01-03 15:50:44 +01:00
|
|
|
mov dword[user_command], 'NOTI'
|
|
|
|
mov dword[user_command+4], 'CE '
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, servercommand+1
|
2016-01-03 15:50:44 +01:00
|
|
|
mov edi, user_command+7
|
2013-05-28 19:34:26 +02:00
|
|
|
.nickloop:
|
|
|
|
lodsb
|
|
|
|
cmp al, '!'
|
|
|
|
je .done
|
|
|
|
cmp al, ' '
|
|
|
|
je .done
|
|
|
|
test al, al
|
|
|
|
je .fail
|
|
|
|
stosb
|
|
|
|
jmp .nickloop
|
|
|
|
.done:
|
|
|
|
mov byte [esi-1], 0
|
|
|
|
mov ax, ' :'
|
|
|
|
stosw
|
|
|
|
mov al, 1
|
|
|
|
stosb
|
|
|
|
|
|
|
|
pop esi
|
|
|
|
.replyloop:
|
|
|
|
lodsb
|
|
|
|
cmp al, 1
|
|
|
|
jbe .done2
|
|
|
|
stosb
|
|
|
|
jmp .replyloop
|
|
|
|
.done2:
|
|
|
|
|
|
|
|
mov al, 1
|
|
|
|
stosb
|
|
|
|
mov ax, 0x0a0d
|
|
|
|
stosw
|
|
|
|
|
2016-01-03 15:50:44 +01:00
|
|
|
lea esi, [edi - user_command]
|
|
|
|
mcall send, [socketnum], user_command, , 0
|
2013-05-28 19:34:26 +02:00
|
|
|
.fail:
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_part:
|
2013-11-01 15:02:08 +01:00
|
|
|
|
|
|
|
cmp byte [esi+4], ' '
|
|
|
|
jne .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
add esi, 5 ; skip 'PART '
|
2024-03-05 10:49:00 +01:00
|
|
|
cmp byte[esi], ':'
|
|
|
|
jne @f
|
|
|
|
inc esi
|
|
|
|
@@:
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
; Is it me who parted?
|
|
|
|
mov edi, servercommand+1
|
|
|
|
call compare_to_nick
|
2014-01-18 16:51:43 +01:00
|
|
|
jne .not_me
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
; yes, close the window (if its open)
|
|
|
|
call window_find
|
|
|
|
test ebx, ebx
|
|
|
|
jz @f
|
|
|
|
call window_close
|
|
|
|
@@:
|
|
|
|
.fail:
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
; somebody else parted, just print message
|
2014-01-18 16:51:43 +01:00
|
|
|
.not_me:
|
2013-05-28 19:34:26 +02:00
|
|
|
push esi
|
2013-11-01 15:02:08 +01:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail2
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2014-01-18 16:51:43 +01:00
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
mov esi, part_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, has_left_channel
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
pop esi
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov ebx, [window_print]
|
|
|
|
mov esi, servercommand+1
|
|
|
|
call user_remove
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
.fail2:
|
|
|
|
pop esi
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
cmd_join:
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2014-01-18 16:51:43 +01:00
|
|
|
cmp byte[esi+4], ' '
|
2013-11-01 15:02:08 +01:00
|
|
|
jne .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
add esi, 5 ; skip 'JOIN '
|
2024-03-05 10:49:00 +01:00
|
|
|
cmp byte[esi], ':'
|
|
|
|
jne @f
|
|
|
|
inc esi
|
|
|
|
@@:
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
; did we join a channel?
|
2013-05-28 19:34:26 +02:00
|
|
|
mov edi, servercommand+1
|
|
|
|
call compare_to_nick
|
2014-01-18 16:51:43 +01:00
|
|
|
jne .not_me
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-01-18 16:51:43 +01:00
|
|
|
push esi
|
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
2013-05-28 19:34:26 +02:00
|
|
|
jz .fail
|
|
|
|
mov [ebx + window.type], WINDOWTYPE_CHANNEL
|
2013-10-07 16:02:05 +02:00
|
|
|
mov [window_active], ebx
|
2013-11-01 15:02:08 +01:00
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
mov esi, join_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, str_talking
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
pop esi
|
|
|
|
mov bl, ' '
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2014-01-18 16:51:43 +01:00
|
|
|
.not_me:
|
2013-05-28 19:34:26 +02:00
|
|
|
push esi
|
2013-10-07 16:02:05 +02:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, join_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, joins_channel
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
pop esi
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov ebx, [window_print]
|
|
|
|
mov esi, servercommand+1
|
|
|
|
call user_add
|
|
|
|
|
2014-01-18 16:51:43 +01:00
|
|
|
ret
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2014-01-18 16:51:43 +01:00
|
|
|
.fail:
|
2014-03-09 22:57:21 +01:00
|
|
|
pop esi
|
2013-05-28 19:34:26 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_nick:
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
cmp byte[esi+4], ' '
|
|
|
|
jne .fail
|
|
|
|
add esi, 5 ; skip 'NICK '
|
|
|
|
cmp byte[esi], ':'
|
2013-05-28 19:34:26 +02:00
|
|
|
jne @f
|
|
|
|
inc esi
|
2013-11-01 15:02:08 +01:00
|
|
|
@@:
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
; Is it me who changed nick?
|
2013-11-01 15:02:08 +01:00
|
|
|
push esi
|
2013-05-28 19:34:26 +02:00
|
|
|
mov edi, servercommand+1
|
|
|
|
call compare_to_nick
|
|
|
|
jne .not_me
|
|
|
|
|
2014-03-07 06:04:10 +01:00
|
|
|
; Yup, update user_nick
|
2013-05-28 19:34:26 +02:00
|
|
|
mov ecx, MAX_NICK_LEN-1
|
2013-11-01 15:02:08 +01:00
|
|
|
mov esi, [esp]
|
2014-03-07 06:04:10 +01:00
|
|
|
mov edi, user_nick
|
2013-11-01 15:02:08 +01:00
|
|
|
@@:
|
2013-05-28 19:34:26 +02:00
|
|
|
lodsb
|
|
|
|
test al, al
|
2013-11-01 15:02:08 +01:00
|
|
|
jz @f
|
2013-05-28 19:34:26 +02:00
|
|
|
cmp al, ' '
|
2013-11-01 15:02:08 +01:00
|
|
|
je @f
|
|
|
|
cmp al, 10
|
|
|
|
je @f
|
|
|
|
cmp al, 13
|
|
|
|
je @f
|
2014-03-07 06:04:10 +01:00
|
|
|
cmp al, ':'
|
|
|
|
je @r
|
2013-05-28 19:34:26 +02:00
|
|
|
stosb
|
|
|
|
dec ecx
|
2013-11-01 15:02:08 +01:00
|
|
|
jnz @r
|
|
|
|
@@:
|
2013-05-28 19:34:26 +02:00
|
|
|
xor al, al
|
|
|
|
stosb
|
2014-06-17 23:53:44 +02:00
|
|
|
|
|
|
|
; Print a message on the server window
|
|
|
|
mov [window_print], windows
|
|
|
|
|
|
|
|
mov esi, str_nickchange
|
|
|
|
call print_asciiz
|
|
|
|
|
|
|
|
mov esi, user_nick
|
|
|
|
call print_asciiz
|
|
|
|
|
|
|
|
mov al, 10
|
|
|
|
call print_char
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
.not_me:
|
|
|
|
|
2014-03-07 06:04:10 +01:00
|
|
|
; Update in userlist
|
2013-11-01 15:02:08 +01:00
|
|
|
mov ebx, windows
|
|
|
|
mov ecx, MAX_WINDOWS
|
|
|
|
.window_loop:
|
|
|
|
push ecx ebx
|
|
|
|
cmp [ebx + window.type], WINDOWTYPE_CHANNEL
|
|
|
|
jne .next_window
|
|
|
|
|
|
|
|
mov esi, servercommand+1
|
|
|
|
call user_remove
|
|
|
|
test edi, edi
|
|
|
|
jz .next_window
|
|
|
|
|
|
|
|
mov esi, [esp + 8]
|
|
|
|
call user_add
|
|
|
|
|
2014-03-07 06:04:10 +01:00
|
|
|
; And print a notification in the channel
|
2013-11-01 15:02:08 +01:00
|
|
|
mov [window_print], ebx
|
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, nick_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, is_now_known_as
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, [esp + 8]
|
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-07 06:04:10 +01:00
|
|
|
; Now do this for all open windows
|
2013-11-01 15:02:08 +01:00
|
|
|
.next_window:
|
|
|
|
pop ebx ecx
|
|
|
|
add ebx, sizeof.window
|
|
|
|
dec ecx
|
|
|
|
jnz .window_loop
|
|
|
|
|
|
|
|
pop esi
|
|
|
|
|
|
|
|
.fail:
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_kick:
|
2013-11-01 15:02:08 +01:00
|
|
|
|
|
|
|
cmp byte [esi+4], ' '
|
|
|
|
jne .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
add esi, 5 ; skip 'KICK '
|
|
|
|
|
2014-02-25 23:18:36 +01:00
|
|
|
; TODO: Is it me who got kicked?
|
|
|
|
; if so, mark channel as disconnected
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
.not_me:
|
|
|
|
; find the channel user has been kicked from
|
|
|
|
push esi
|
2013-10-07 16:02:05 +02:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2014-02-25 23:18:36 +01:00
|
|
|
push esi
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, kick_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
pop esi
|
|
|
|
mov bl, ' '
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-02-25 23:18:36 +01:00
|
|
|
mov esi, str_kicked
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
pop esi
|
|
|
|
mov bl, ' '
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-02-25 23:18:36 +01:00
|
|
|
mov esi, str_by
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2014-02-25 23:18:36 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2014-02-25 23:18:36 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov ebx, [window_print]
|
|
|
|
mov esi, servercommand+1
|
|
|
|
call user_remove
|
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
ret
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
.fail:
|
2014-03-09 22:57:21 +01:00
|
|
|
pop esi
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_quit:
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
cmp byte [esi+4], ' '
|
|
|
|
jne .fail
|
|
|
|
|
|
|
|
mov ebx, windows
|
|
|
|
mov ecx, MAX_WINDOWS
|
|
|
|
|
|
|
|
.window_loop:
|
|
|
|
push ecx
|
|
|
|
cmp [ebx + window.type], WINDOWTYPE_CHANNEL
|
|
|
|
jne .next_window
|
|
|
|
|
|
|
|
mov esi, servercommand+1
|
|
|
|
call user_remove
|
|
|
|
test edi, edi
|
|
|
|
jz .next_window
|
|
|
|
|
|
|
|
push ebx
|
|
|
|
mov [window_print], ebx
|
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, quit_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, has_quit_irc
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
; TODO: check if quit message was given, and print it to the window
|
|
|
|
pop ebx
|
|
|
|
.next_window:
|
|
|
|
pop ecx
|
|
|
|
add ebx, sizeof.window
|
|
|
|
dec ecx
|
|
|
|
jnz .window_loop
|
|
|
|
|
|
|
|
.fail:
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_mode:
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
cmp byte [esi+4], ' '
|
|
|
|
jne .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
add esi, 5 ; skip 'MODE '
|
2014-03-09 17:07:08 +01:00
|
|
|
push esi
|
2013-11-01 15:02:08 +01:00
|
|
|
call window_find
|
|
|
|
test ebx, ebx
|
2014-03-09 17:07:08 +01:00
|
|
|
jz .user
|
|
|
|
mov [esp], esi
|
2014-01-18 16:51:43 +01:00
|
|
|
mov [window_print], ebx
|
2013-11-01 15:02:08 +01:00
|
|
|
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, mode_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, servercommand+1
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, sets_mode
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
pop esi
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 17:07:08 +01:00
|
|
|
; TODO: keep track of user modes in username list
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
.fail:
|
2014-03-09 17:07:08 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.user:
|
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
|
|
|
mov esi, mode_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2014-03-09 17:07:08 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov esi, [esp]
|
|
|
|
mov bl, ' '
|
|
|
|
call print_string
|
2014-03-09 17:07:08 +01:00
|
|
|
|
|
|
|
mov esi, sets_mode
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2014-03-09 17:07:08 +01:00
|
|
|
|
|
|
|
pop esi
|
|
|
|
call skip_parameter
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2014-03-09 17:07:08 +01:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-11-01 15:02:08 +01:00
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
cmd_353: ; channel usernames reply
|
|
|
|
|
|
|
|
add esi, 4 ; skip '353 '
|
2014-01-18 16:51:43 +01:00
|
|
|
call skip_parameter
|
2013-05-28 19:34:26 +02:00
|
|
|
inc esi ; channel type '*', '=' or '@'
|
|
|
|
inc esi ; ' '
|
2013-10-07 16:02:05 +02:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
; now find window ptr and check if this is the first 353 message
|
|
|
|
mov ebx, [window_print]
|
|
|
|
test [ebx + window.flags], FLAG_RECEIVING_NAMES
|
|
|
|
jnz .add
|
|
|
|
|
|
|
|
or [ebx + window.flags], FLAG_RECEIVING_NAMES
|
|
|
|
; mov [ebx + window.users], 0
|
|
|
|
; TODO: remove all users?
|
|
|
|
|
|
|
|
.add:
|
|
|
|
lodsb
|
|
|
|
test al, al
|
|
|
|
jz .done
|
2024-03-05 10:49:00 +01:00
|
|
|
cmp al, ' '
|
|
|
|
je .add
|
|
|
|
dec esi
|
|
|
|
call user_add
|
2013-05-28 19:34:26 +02:00
|
|
|
jmp .add
|
|
|
|
|
|
|
|
.done:
|
2016-01-02 22:03:09 +01:00
|
|
|
call draw_user_list
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2024-03-05 10:49:00 +01:00
|
|
|
.fail:
|
2013-05-28 19:34:26 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_366: ; channel usernames end
|
|
|
|
|
|
|
|
add esi, 4 ; skip '366 '
|
2014-01-18 16:51:43 +01:00
|
|
|
call skip_parameter
|
2013-10-07 16:02:05 +02:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
and [ebx + window.flags], not FLAG_RECEIVING_NAMES
|
2014-03-09 22:57:21 +01:00
|
|
|
.fail:
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_topic:
|
|
|
|
|
|
|
|
add esi, 4 ; skip '332 '
|
2014-01-18 16:51:43 +01:00
|
|
|
call skip_parameter
|
2013-10-07 16:02:05 +02:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
push esi
|
2013-11-01 15:02:08 +01:00
|
|
|
mov esi, topic_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, str_topic
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
pop esi
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-01-18 16:51:43 +01:00
|
|
|
mov esi, str_topic_end
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
|
|
|
|
|
|
|
.fail:
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
cmd_333:
|
|
|
|
|
|
|
|
add esi, 4 ; skip '333 '
|
2014-03-09 17:07:08 +01:00
|
|
|
call skip_parameter
|
2013-10-07 16:02:05 +02:00
|
|
|
call window_open
|
2014-03-09 22:57:21 +01:00
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
if TIMESTAMP
|
|
|
|
call print_timestamp
|
|
|
|
end if
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
push esi
|
2013-11-01 15:02:08 +01:00
|
|
|
mov esi, topic_header
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
mov esi, str_setby
|
2014-03-09 22:57:21 +01:00
|
|
|
call print_asciiz
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
pop esi
|
|
|
|
mov bl, '!'
|
|
|
|
call print_string
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
mov al, 10
|
|
|
|
call print_char
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
.fail:
|
2014-03-09 22:57:21 +01:00
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
ret
|
|
|
|
|
2014-03-09 22:57:21 +01:00
|
|
|
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
cmd_322: ; LIST
|
|
|
|
|
2013-05-28 19:34:26 +02:00
|
|
|
add esi, 4
|
2014-01-18 16:51:43 +01:00
|
|
|
call skip_parameter
|
2014-03-09 22:57:21 +01:00
|
|
|
|
|
|
|
push esi
|
|
|
|
mov esi, str_list
|
|
|
|
call window_open
|
|
|
|
test ebx, ebx
|
|
|
|
jz .fail
|
|
|
|
|
|
|
|
mov [window_active], ebx
|
2016-01-02 22:03:09 +01:00
|
|
|
call draw_window_tabs
|
2014-03-09 22:57:21 +01:00
|
|
|
pop esi
|
|
|
|
call print_asciiz
|
|
|
|
mov al, 10
|
|
|
|
call print_char
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.fail:
|
|
|
|
pop esi
|
2013-05-28 19:34:26 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-01 15:02:08 +01:00
|
|
|
cmd_323: ; LIST END
|
2013-05-28 19:34:26 +02:00
|
|
|
|
2024-03-05 10:49:00 +01:00
|
|
|
ret
|