forked from KolibriOS/kolibrios
IRCc 0.16: bugfixes, client accepts server URL as parameter now, window related code refactored.
git-svn-id: svn://kolibrios.org@4477 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1408a74c1d
commit
b2e030871f
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2014. 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.15'
|
version equ '0.16'
|
||||||
|
|
||||||
; connection status
|
; connection status
|
||||||
STATUS_DISCONNECTED = 0
|
STATUS_DISCONNECTED = 0
|
||||||
@ -52,7 +52,7 @@ BOTTOM_Y = 15
|
|||||||
|
|
||||||
MAX_WINDOWS = 20
|
MAX_WINDOWS = 20
|
||||||
MAX_USERS = 4096
|
MAX_USERS = 4096
|
||||||
TEXT_BUFFERSIZE = 4096;*1024
|
TEXT_BUFFERSIZE = 1024*1024
|
||||||
|
|
||||||
MAX_NICK_LEN = 32
|
MAX_NICK_LEN = 32
|
||||||
MAX_REAL_LEN = 32 ; realname
|
MAX_REAL_LEN = 32 ; realname
|
||||||
@ -97,7 +97,7 @@ include "../../proc32.inc"
|
|||||||
include "../../dll.inc"
|
include "../../dll.inc"
|
||||||
include "../../network.inc"
|
include "../../network.inc"
|
||||||
include "../../struct.inc"
|
include "../../struct.inc"
|
||||||
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
include "../../develop/libraries/box_lib/trunk/box_lib.mac"
|
||||||
|
|
||||||
struct window
|
struct window
|
||||||
data_ptr dd ?
|
data_ptr dd ?
|
||||||
@ -169,7 +169,7 @@ START:
|
|||||||
|
|
||||||
; allocate window data block
|
; allocate window data block
|
||||||
mov ebx, windows
|
mov ebx, windows
|
||||||
call window_create
|
call window_create_textbox
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz error
|
jz error
|
||||||
mov [ebx + window.type], WINDOWTYPE_SERVER
|
mov [ebx + window.type], WINDOWTYPE_SERVER
|
||||||
@ -202,14 +202,22 @@ START:
|
|||||||
mov esi, str_welcome
|
mov esi, str_welcome
|
||||||
call print_text2
|
call print_text2
|
||||||
|
|
||||||
call draw_window ; Draw window a first time, so we can figure out skin size
|
; Check if parameter contains an URL
|
||||||
|
cmp byte[param], 0
|
||||||
|
je @f
|
||||||
|
mov esi, param
|
||||||
|
mov ecx, 1024
|
||||||
|
call cmd_usr_server.now
|
||||||
|
@@:
|
||||||
|
|
||||||
|
; Draw window a first time, so we can figure out skin size
|
||||||
|
call draw_window
|
||||||
|
|
||||||
redraw:
|
redraw:
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
still:
|
mainloop:
|
||||||
; wait here for event
|
mcall 10 ; wait for event
|
||||||
mcall 10
|
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz redraw
|
jz redraw
|
||||||
@ -235,7 +243,7 @@ still:
|
|||||||
call draw_channel_list
|
call draw_channel_list
|
||||||
.no_update:
|
.no_update:
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
button:
|
button:
|
||||||
|
|
||||||
@ -248,7 +256,7 @@ button:
|
|||||||
cmp ax, WINDOW_BTN_CLOSE
|
cmp ax, WINDOW_BTN_CLOSE
|
||||||
jne @f
|
jne @f
|
||||||
call cmd_usr_close_window
|
call cmd_usr_close_window
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
cmp ax, WINDOW_BTN_LIST
|
cmp ax, WINDOW_BTN_LIST
|
||||||
@ -270,7 +278,9 @@ button:
|
|||||||
|
|
||||||
pop eax
|
pop eax
|
||||||
test eax, 1 shl 25 ; Right mouse button pressed?
|
test eax, 1 shl 25 ; Right mouse button pressed?
|
||||||
jz still
|
jz mainloop
|
||||||
|
|
||||||
|
; TODO: check if selected nick is my nick!
|
||||||
|
|
||||||
; Right mouse BTN was pressed, open chat window
|
; Right mouse BTN was pressed, open chat window
|
||||||
mov ebx, [window_active]
|
mov ebx, [window_active]
|
||||||
@ -284,7 +294,7 @@ button:
|
|||||||
pop [window_active]
|
pop [window_active]
|
||||||
call redraw
|
call redraw
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
sub ax, WINDOW_BTN_START
|
sub ax, WINDOW_BTN_START
|
||||||
@ -306,7 +316,7 @@ button:
|
|||||||
mov [scroll2.position], 1 ;;; FIXME
|
mov [scroll2.position], 1 ;;; FIXME
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
@ -332,14 +342,14 @@ main_window_key:
|
|||||||
; cmp ah, 178
|
; cmp ah, 178
|
||||||
; jne .no_up
|
; jne .no_up
|
||||||
;
|
;
|
||||||
; jmp still
|
; jmp mainloop
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
; .no_up:
|
; .no_up:
|
||||||
; cmp ah, 177
|
; cmp ah, 177
|
||||||
; jne .no_down
|
; jne .no_down
|
||||||
;
|
;
|
||||||
; jmp still
|
; jmp mainloop
|
||||||
;
|
;
|
||||||
; .no_down:
|
; .no_down:
|
||||||
cmp ah, 13 ; enter
|
cmp ah, 13 ; enter
|
||||||
@ -357,15 +367,19 @@ main_window_key:
|
|||||||
|
|
||||||
call draw_channel_text
|
call draw_channel_text
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
no_send2:
|
no_send2:
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
mouse:
|
mouse:
|
||||||
push dword edit1
|
push dword edit1
|
||||||
call [edit_box_mouse]
|
call [edit_box_mouse]
|
||||||
|
|
||||||
|
; mcall 37, 7
|
||||||
|
; movsx eax, ax
|
||||||
|
; add [scroll2.position], eax
|
||||||
|
|
||||||
; TODO: check if scrollbar is active?
|
; TODO: check if scrollbar is active?
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
cmp [edi + window.type], WINDOWTYPE_CHANNEL
|
cmp [edi + window.type], WINDOWTYPE_CHANNEL
|
||||||
@ -386,14 +400,14 @@ mouse:
|
|||||||
jbe @f
|
jbe @f
|
||||||
push dword scroll2
|
push dword scroll2
|
||||||
call [scrollbar_mouse]
|
call [scrollbar_mouse]
|
||||||
; mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
mov edx, [scroll2.position]
|
mov edx, [scroll2.position]
|
||||||
sub edx, [edi + window.text_line_print]
|
sub edx, [edi + window.text_line_print]
|
||||||
je @f
|
je @f
|
||||||
call draw_channel_text.scroll_to_pos
|
call draw_channel_text.scroll_to_pos
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
|
|
||||||
; DATA AREA
|
; DATA AREA
|
||||||
@ -404,32 +418,67 @@ db 'CP1251'
|
|||||||
db 'UTF-8 '
|
db 'UTF-8 '
|
||||||
encoding_text_len = 6
|
encoding_text_len = 6
|
||||||
|
|
||||||
join_header db 3,'3* ', 0
|
join_header db 3, '3* ', 0
|
||||||
quit_header db 3,'5* ', 0
|
quit_header db 3, '5* ', 0
|
||||||
nick_header db 3,'2* ', 0
|
nick_header db 3, '2* ', 0
|
||||||
kick_header db 3,'5* ', 0
|
kick_header db 3, '5* ', 0
|
||||||
mode_header db 3,'2* ', 0
|
mode_header db 3, '2* ', 0
|
||||||
part_header db 3,'5* ', 0
|
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
|
||||||
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
|
||||||
ctcp_time db '] TIME',10,0
|
ctcp_time db '] TIME', 10, 0
|
||||||
|
|
||||||
has_left_channel db ' has left ', 0
|
has_left_channel db ' has left ', 0
|
||||||
joins_channel db ' has joined ', 0
|
joins_channel db ' has joined ', 0
|
||||||
is_now_known_as db ' is now known as ', 0
|
is_now_known_as db ' is now known as ', 0
|
||||||
has_quit_irc db ' has quit IRC', 10, 0
|
has_quit_irc db ' has quit IRC', 10, 0
|
||||||
|
|
||||||
sets_mode db ' sets mode ', 0
|
sets_mode db ' sets mode ', 0
|
||||||
kicked db ' is kicked from ', 0
|
kicked db ' is kicked from ', 0
|
||||||
str_talking db 'Now talking in ',0
|
str_nickchange db 'Nickname is now ', 0
|
||||||
str_topic db 'Topic is ',0
|
str_realchange db 'Real name is now ', 0
|
||||||
str_setby db 'Set by ',0
|
str_talking db 'Now talking in ', 0
|
||||||
str_reconnect db 'Connection reset by user.',10,0
|
str_topic db 'Topic is "', 0
|
||||||
|
str_topic_end db '".', 10, 0
|
||||||
|
str_setby db 'Set by ', 0
|
||||||
|
|
||||||
|
str_connecting db 3, '3* Connecting to ', 0
|
||||||
|
str_sockerr db 3, '5* Socket error', 10, 0
|
||||||
|
str_dnserr db 3, '5* Unable to resolve hostname', 10, 0
|
||||||
|
str_refused db 3, '5* Connection refused', 10, 0
|
||||||
|
str_disconnected db 3, '5* Server disconnected', 10, 0
|
||||||
|
str_reconnect db 3, '5* Connection reset by user', 10, 0
|
||||||
|
str_notconnected db 3, '5* Not connected to server', 10, 0
|
||||||
|
|
||||||
|
str_dotnewline db '.',10, 0
|
||||||
|
str_newline db 10, 0
|
||||||
|
str_1 db 3, '13 -', 0
|
||||||
|
str_2 db '- ', 0
|
||||||
|
|
||||||
|
str_help db 10, 'following commands are available:', 10
|
||||||
|
db 10
|
||||||
|
db '/nick <nick> : change nickname to <nick>', 10
|
||||||
|
db '/real <real name> : change real name to <real name>', 10
|
||||||
|
db '/server <address> : connect to server <address>', 10
|
||||||
|
db '/code <code> : change codepage to cp866, cp1251, or utf8', 10, 0
|
||||||
|
|
||||||
|
str_welcome db 3, '3 ___', 3, '7__________', 3, '6_________ ', 3, '4 __ __ __', 10
|
||||||
|
db 3, '3| \', 3, '7______ \', 3, '6_ ___ \ ', 3, '4 ____ | | |__| ____ _____/ |_', 10
|
||||||
|
db 3, '3| |', 3, '7| _/', 3, '6 \ \/ ', 3, '4 _/ ___\| | | |/ __ \ / \ __\', 10
|
||||||
|
db 3, '3| |', 3, '7| | \', 3, '6 \____', 3, '4 \ \___| |_| \ ___/| | \ |', 10
|
||||||
|
db 3, '3|___|', 3, '7|____|_ /', 3, '6\______ /', 3, '4 \___ >____/__|\___ >___| /__|', 10
|
||||||
|
db 3, '3 ', 3, '7 \/ ', 3, '6 \/ ', 3, '4 \/ \/ \/', 10
|
||||||
|
db 10
|
||||||
|
db 'Welcome to the KolibriOS IRC client v', version, 10
|
||||||
|
db 10
|
||||||
|
db 'Type /help for help', 10, 10, 0
|
||||||
|
|
||||||
str_version db 'VERSION '
|
str_version db 'VERSION '
|
||||||
str_programname db 'KolibriOS IRC client ', version, 0
|
str_programname db 'KolibriOS IRC client v', version, 0
|
||||||
|
|
||||||
str_user db 'user', 0
|
str_user db 'user', 0
|
||||||
str_nick db 'nick', 0
|
str_nick db 'nick', 0
|
||||||
@ -441,36 +490,6 @@ default_nick db 'kolibri_user', 0
|
|||||||
default_real db 'Kolibri User', 0
|
default_real db 'Kolibri User', 0
|
||||||
default_quit db 'KolibriOS forever', 0
|
default_quit db 'KolibriOS forever', 0
|
||||||
|
|
||||||
str_welcome db 3,'3 ___',3,'7__________',3,'6_________ ',3,'4 __ __ __',10
|
|
||||||
db 3,'3| \',3,'7______ \',3,'6_ ___ \ ',3,'4 ____ | | |__| ____ _____/ |_',10
|
|
||||||
db 3,'3| |',3,'7| _/',3,'6 \ \/ ',3,'4 _/ ___\| | | |/ __ \ / \ __\',10
|
|
||||||
db 3,'3| |',3,'7| | \',3,'6 \____',3,'4 \ \___| |_| \ ___/| | \ |',10
|
|
||||||
db 3,'3|___|',3,'7|____|_ /\',3,'6______ /',3,'4 \___ >____/__|\___ >___| /__|',10
|
|
||||||
db 3,'3 ',3,'7 \/ ',3,'6 \/ ',3,'4 \/ \/ \/',10
|
|
||||||
db 10
|
|
||||||
db 'Welcome to the KolibriOS IRC client v',version,10
|
|
||||||
db 10
|
|
||||||
db 'Type /help for help',10,10,0
|
|
||||||
|
|
||||||
str_nickchange db 'Nickname is now ',0
|
|
||||||
str_realchange db 'Real name is now ',0
|
|
||||||
str_dotnewline db '.',10, 0
|
|
||||||
str_newline db 10, 0
|
|
||||||
str_connecting db 3,'3* Connecting to ',0
|
|
||||||
str_help db 10,'following commands are available:',10
|
|
||||||
db 10
|
|
||||||
db '/nick <nick> : change nickname to <nick>',10
|
|
||||||
db '/real <real name> : change real name to <real name>',10
|
|
||||||
db '/server <address> : connect to server <address>',10
|
|
||||||
db '/code <code> : change codepage to cp866, cp1251, or utf8',10,0
|
|
||||||
|
|
||||||
str_1 db 3,'13 -',0
|
|
||||||
str_2 db '- ',0
|
|
||||||
|
|
||||||
str_sockerr db 'Socket Error',10,0
|
|
||||||
str_dnserr db 'Unable to resolve hostname.',10,0
|
|
||||||
str_refused db 'Connection refused',10,0
|
|
||||||
|
|
||||||
irc_colors dd 0xffffff ; 0 white
|
irc_colors dd 0xffffff ; 0 white
|
||||||
dd 0x000000 ; 1 black
|
dd 0x000000 ; 1 black
|
||||||
dd 0x00007f ; 2 blue (navy)
|
dd 0x00007f ; 2 blue (navy)
|
||||||
@ -490,7 +509,7 @@ irc_colors dd 0xffffff ; 0 white
|
|||||||
|
|
||||||
sockaddr1:
|
sockaddr1:
|
||||||
dw AF_INET4
|
dw AF_INET4
|
||||||
.port dw 0x0b1a ; 6667
|
.port dw 0x0b1a ; 6667 FIXMEEEEEE
|
||||||
.ip dd 0
|
.ip dd 0
|
||||||
rb 10
|
rb 10
|
||||||
|
|
||||||
@ -527,8 +546,6 @@ import boxlib,\
|
|||||||
scrollbar_draw, 'scrollbar_v_draw',\
|
scrollbar_draw, 'scrollbar_v_draw',\
|
||||||
scrollbar_mouse,'scrollbar_v_mouse'
|
scrollbar_mouse,'scrollbar_v_mouse'
|
||||||
|
|
||||||
I_END:
|
|
||||||
|
|
||||||
; width, left, top
|
; width, left, top
|
||||||
edit1 edit_box 0, 0, 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, btn_height, max, cur, pos, bgcol, frcol, linecol
|
; xsize, xpos, ysize, ypos, btn_height, max, cur, pos, bgcol, frcol, linecol
|
||||||
@ -538,34 +555,34 @@ scroll2 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0,
|
|||||||
usercommand db '/server chat.freenode.net', 0
|
usercommand db '/server chat.freenode.net', 0
|
||||||
rb MAX_COMMAND_LEN
|
rb MAX_COMMAND_LEN
|
||||||
|
|
||||||
|
I_END:
|
||||||
|
|
||||||
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
|
||||||
gai_reqdata rb 32 ; buffer for getaddrinfo_start/process
|
|
||||||
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
|
param rb 1024
|
||||||
|
|
||||||
socketnum dd ?
|
|
||||||
|
|
||||||
servercommand rb 600
|
servercommand rb 600
|
||||||
|
|
||||||
thread_info rb 1024
|
thread_info rb 1024
|
||||||
xsize dd ?
|
xsize dd ?
|
||||||
ysize dd ?
|
ysize dd ?
|
||||||
|
mouse_dd dd ?
|
||||||
|
|
||||||
colors system_colors
|
colors system_colors
|
||||||
|
|
||||||
irc_server_name rb MAX_SERVER_NAME
|
irc_server_name rb MAX_SERVER_NAME ; TODO: move this server URL into window struct
|
||||||
|
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 250
|
||||||
|
|
||||||
|
diff16 "windows", 0, $ + 1*sizeof.window ;+ 6
|
||||||
windows rb MAX_WINDOWS*sizeof.window
|
windows rb MAX_WINDOWS*sizeof.window
|
||||||
|
|
||||||
mouse_dd dd ?
|
|
||||||
|
|
||||||
IM_END:
|
IM_END:
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2014. 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 ;;
|
||||||
@ -60,6 +60,7 @@ server_commands:
|
|||||||
dd '375 ', cmd_375 ; start of motd
|
dd '375 ', cmd_375 ; start of motd
|
||||||
dd '376 ', cmd_376 ; end of motd
|
dd '376 ', cmd_376 ; end of motd
|
||||||
dd '421 ', cmd_421 ; unknown command
|
dd '421 ', cmd_421 ; unknown command
|
||||||
|
dd '433 ', cmd_433 ; nickname already in use
|
||||||
dd 'join', cmd_join
|
dd 'join', cmd_join
|
||||||
dd 'kick', cmd_kick
|
dd 'kick', cmd_kick
|
||||||
dd 'mode', cmd_mode
|
dd 'mode', cmd_mode
|
||||||
@ -83,6 +84,8 @@ compare_to_nick:
|
|||||||
lodsb
|
lodsb
|
||||||
cmp al, ' '
|
cmp al, ' '
|
||||||
jbe .done
|
jbe .done
|
||||||
|
test al, al
|
||||||
|
jz .done
|
||||||
cmp al, 'a'
|
cmp al, 'a'
|
||||||
jb .ok
|
jb .ok
|
||||||
cmp al, 'z'
|
cmp al, 'z'
|
||||||
@ -116,24 +119,23 @@ compare_to_nick:
|
|||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
skip_nick:
|
skip_parameter:
|
||||||
|
|
||||||
; First: skip the NICK (maybe we should verify it?)
|
; First: skip the parameter
|
||||||
.nick:
|
.part1:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, ' '
|
cmp al, ' '
|
||||||
je .skip
|
je .part2
|
||||||
cmp al, ':'
|
cmp al, ':'
|
||||||
je .skip
|
jne .part1
|
||||||
jmp .nick
|
|
||||||
|
|
||||||
; skip all leading spaces and semicolons
|
; Now, skip all trailing spaces and semicolons
|
||||||
.skip:
|
.part2:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, ' '
|
cmp al, ' '
|
||||||
je .skip
|
je .part2
|
||||||
cmp al, ':'
|
cmp al, ':'
|
||||||
je .skip
|
je .part2
|
||||||
dec esi
|
dec esi
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@ -147,6 +149,7 @@ cmd_421:
|
|||||||
cmd_372:
|
cmd_372:
|
||||||
cmd_375:
|
cmd_375:
|
||||||
cmd_376:
|
cmd_376:
|
||||||
|
cmd_433:
|
||||||
add esi, 4
|
add esi, 4
|
||||||
jmp cmd_notice.loop
|
jmp cmd_notice.loop
|
||||||
|
|
||||||
@ -228,11 +231,27 @@ cmd_privmsg:
|
|||||||
cmp eax, 'msg '
|
cmp eax, 'msg '
|
||||||
jne .fail
|
jne .fail
|
||||||
add esi, 8 ; skip 'PRIVMSG '
|
add esi, 8 ; skip 'PRIVMSG '
|
||||||
call window_open ; esi now points to end of destination name
|
|
||||||
|
mov edi, esi
|
||||||
|
call compare_to_nick
|
||||||
|
jne .channel
|
||||||
|
|
||||||
|
; private chat message
|
||||||
|
push esi
|
||||||
|
mov esi, servercommand+1
|
||||||
|
call window_open
|
||||||
|
pop esi
|
||||||
|
call skip_parameter ; our own nickname
|
||||||
|
|
||||||
cmp byte[esi], 1 ; Client to Client protocol?
|
cmp byte[esi], 1 ; Client to Client protocol?
|
||||||
je cmd_ctcp
|
je cmd_ctcp
|
||||||
|
|
||||||
|
jmp .print
|
||||||
|
|
||||||
|
.channel:
|
||||||
|
call window_open
|
||||||
|
|
||||||
|
.print:
|
||||||
; nope, just plain old privmsg, print it using '<nick> message' format
|
; nope, just plain old privmsg, print it using '<nick> message' format
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
call print_timestamp
|
call print_timestamp
|
||||||
@ -266,8 +285,6 @@ cmd_privmsg:
|
|||||||
|
|
||||||
cmd_ctcp:
|
cmd_ctcp:
|
||||||
|
|
||||||
cmp byte [esi+4], ' '
|
|
||||||
jne .fail
|
|
||||||
inc esi
|
inc esi
|
||||||
mov eax, dword[esi]
|
mov eax, dword[esi]
|
||||||
or eax, 0x20202020
|
or eax, 0x20202020
|
||||||
@ -280,8 +297,8 @@ cmd_ctcp:
|
|||||||
je .ping
|
je .ping
|
||||||
cmp eax, 'acti'
|
cmp eax, 'acti'
|
||||||
je .action
|
je .action
|
||||||
; 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: TODO: just print to window??
|
||||||
|
|
||||||
@ -413,6 +430,9 @@ cmd_dcc:
|
|||||||
|
|
||||||
.send:
|
.send:
|
||||||
|
|
||||||
|
call window_open
|
||||||
|
mov [ebx + window.type], WINDOWTYPE_DCC
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@ -472,7 +492,7 @@ cmd_part:
|
|||||||
; Is it me who parted?
|
; Is it me who parted?
|
||||||
mov edi, servercommand+1
|
mov edi, servercommand+1
|
||||||
call compare_to_nick
|
call compare_to_nick
|
||||||
jne .dont_close
|
jne .not_me
|
||||||
|
|
||||||
; yes, close the window (if its open)
|
; yes, close the window (if its open)
|
||||||
call window_find
|
call window_find
|
||||||
@ -486,11 +506,14 @@ cmd_part:
|
|||||||
|
|
||||||
|
|
||||||
; somebody else parted, just print message
|
; somebody else parted, just print message
|
||||||
.dont_close:
|
.not_me:
|
||||||
push esi
|
push esi
|
||||||
call skip_nick
|
|
||||||
call window_open
|
call window_open
|
||||||
|
|
||||||
|
if TIMESTAMP
|
||||||
|
call print_timestamp
|
||||||
|
end if
|
||||||
|
|
||||||
mov esi, part_header
|
mov esi, part_header
|
||||||
call print_text2
|
call print_text2
|
||||||
|
|
||||||
@ -518,44 +541,26 @@ cmd_part:
|
|||||||
|
|
||||||
cmd_join:
|
cmd_join:
|
||||||
|
|
||||||
cmp byte [esi+4], ' '
|
cmp byte[esi+4], ' '
|
||||||
jne .fail
|
jne .fail
|
||||||
add esi, 5 ; skip 'JOIN '
|
add esi, 5 ; skip 'JOIN '
|
||||||
|
|
||||||
; compare nick: did we join a channel?
|
; compare nick: did we join a channel?
|
||||||
mov edi, servercommand+1
|
mov edi, servercommand+1
|
||||||
call compare_to_nick
|
call compare_to_nick
|
||||||
jne .no_new_window
|
jne .not_me
|
||||||
|
|
||||||
; create channel window - search for empty slot
|
push esi
|
||||||
mov ebx, windows
|
call window_open
|
||||||
mov ecx, MAX_WINDOWS
|
|
||||||
.loop:
|
|
||||||
cmp [ebx + window.data_ptr], 0
|
|
||||||
je .free_found
|
|
||||||
add ebx, sizeof.window
|
|
||||||
dec ecx
|
|
||||||
jnz .loop
|
|
||||||
; Error: no more available windows!! ;;;;; TODO
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
.free_found:
|
|
||||||
call window_create
|
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
mov [ebx + window.type], WINDOWTYPE_CHANNEL
|
mov [ebx + window.type], WINDOWTYPE_CHANNEL
|
||||||
|
|
||||||
call window_set_name
|
|
||||||
|
|
||||||
mov [window_active], ebx
|
mov [window_active], ebx
|
||||||
mov [window_print], ebx
|
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
call print_timestamp
|
call print_timestamp
|
||||||
end if
|
end if
|
||||||
|
|
||||||
push esi
|
|
||||||
mov esi, join_header
|
mov esi, join_header
|
||||||
call print_text2
|
call print_text2
|
||||||
|
|
||||||
@ -573,7 +578,7 @@ cmd_join:
|
|||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.no_new_window:
|
.not_me:
|
||||||
push esi
|
push esi
|
||||||
call window_open
|
call window_open
|
||||||
|
|
||||||
@ -601,8 +606,10 @@ cmd_join:
|
|||||||
mov esi, servercommand+1
|
mov esi, servercommand+1
|
||||||
call user_add
|
call user_add
|
||||||
|
|
||||||
.fail:
|
ret
|
||||||
|
|
||||||
|
.fail:
|
||||||
|
add esp, 4
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@ -711,7 +718,7 @@ 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 skip_parameter
|
||||||
call window_open
|
call window_open
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
@ -802,18 +809,7 @@ cmd_mode:
|
|||||||
call window_find
|
call window_find
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz .fail
|
jz .fail
|
||||||
|
mov [window_print], ebx
|
||||||
; skip channel name
|
|
||||||
@@:
|
|
||||||
lodsb
|
|
||||||
test al, al
|
|
||||||
jz .fail
|
|
||||||
cmp al, 10
|
|
||||||
je .fail
|
|
||||||
cmp al, 13
|
|
||||||
je .fail
|
|
||||||
cmp al, ' '
|
|
||||||
jne @r
|
|
||||||
push esi
|
push esi
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
@ -846,7 +842,7 @@ 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
|
call skip_parameter
|
||||||
inc esi ; channel type '*', '=' or '@'
|
inc esi ; channel type '*', '=' or '@'
|
||||||
inc esi ; ' '
|
inc esi ; ' '
|
||||||
call window_open
|
call window_open
|
||||||
@ -885,7 +881,7 @@ cmd_353: ; channel usernames reply
|
|||||||
cmd_366: ; channel usernames end
|
cmd_366: ; channel usernames end
|
||||||
|
|
||||||
add esi, 4 ; skip '366 '
|
add esi, 4 ; skip '366 '
|
||||||
call skip_nick
|
call skip_parameter
|
||||||
call window_open
|
call window_open
|
||||||
|
|
||||||
mov ebx, [window_print]
|
mov ebx, [window_print]
|
||||||
@ -899,7 +895,7 @@ cmd_366: ; channel usernames end
|
|||||||
cmd_topic:
|
cmd_topic:
|
||||||
|
|
||||||
add esi, 4 ; skip '332 '
|
add esi, 4 ; skip '332 '
|
||||||
call skip_nick
|
call skip_parameter
|
||||||
call window_open
|
call window_open
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
@ -916,7 +912,7 @@ cmd_topic:
|
|||||||
pop esi
|
pop esi
|
||||||
call print_text2
|
call print_text2
|
||||||
|
|
||||||
mov esi, str_newline
|
mov esi, str_topic_end
|
||||||
call print_text2
|
call print_text2
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@ -925,19 +921,9 @@ cmd_topic:
|
|||||||
cmd_333:
|
cmd_333:
|
||||||
|
|
||||||
add esi, 4 ; skip '333 '
|
add esi, 4 ; skip '333 '
|
||||||
call skip_nick ;;;;
|
call skip_parameter ;;;;
|
||||||
call window_open
|
call window_open
|
||||||
|
|
||||||
; mov ecx, 2 ; number of spaces to find ;;; CHECKME
|
|
||||||
; .loop:
|
|
||||||
; lodsb
|
|
||||||
; test al, al
|
|
||||||
; je .fail
|
|
||||||
; cmp al, ' '
|
|
||||||
; jne .loop
|
|
||||||
; dec ecx
|
|
||||||
; jnz .loop ; find some more spaces
|
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
call print_timestamp
|
call print_timestamp
|
||||||
end if
|
end if
|
||||||
@ -967,7 +953,7 @@ cmd_322: ; LIST
|
|||||||
add esi, 4
|
add esi, 4
|
||||||
|
|
||||||
mov [window_print], windows ; FIXME
|
mov [window_print], windows ; FIXME
|
||||||
call skip_nick
|
call skip_parameter
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
mov dl, 13
|
mov dl, 13
|
||||||
call print_text
|
call print_text
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2014. 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 ;;
|
||||||
@ -100,7 +100,6 @@ socket_connect:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.reconnect:
|
.reconnect:
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
call print_timestamp
|
call print_timestamp
|
||||||
end if
|
end if
|
||||||
@ -213,10 +212,10 @@ socket_receive:
|
|||||||
|
|
||||||
.nextpacket:
|
.nextpacket:
|
||||||
mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet
|
mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet
|
||||||
inc eax ; check if we got one
|
inc eax ; check if we got any data
|
||||||
jz .done
|
jz .done ; TODO: handle errors!
|
||||||
dec eax
|
dec eax
|
||||||
jz .done ; TODO: check for errors!
|
jz .disconnected
|
||||||
|
|
||||||
; ok we have data, now feed it to the recoder
|
; ok we have data, now feed it to the recoder
|
||||||
|
|
||||||
@ -226,7 +225,7 @@ socket_receive:
|
|||||||
mov edi, servercommand
|
mov edi, servercommand
|
||||||
.byteloop:
|
.byteloop:
|
||||||
call get_next_byte ; reads byte from [esi] to al
|
call get_next_byte ; reads byte from [esi] to al
|
||||||
jnc .nextpacket ; if CF is set, we need more data
|
jnc .nextpacket ; if CF is set, we need more data (TODO: dont throw away old data!!!)
|
||||||
cmp al, 10
|
cmp al, 10
|
||||||
je .got_command
|
je .got_command
|
||||||
cmp al, 13
|
cmp al, 13
|
||||||
@ -245,5 +244,15 @@ socket_receive:
|
|||||||
|
|
||||||
.done:
|
.done:
|
||||||
popa
|
popa
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
.disconnected:
|
||||||
|
mov esi, str_disconnected
|
||||||
|
call print_text2
|
||||||
|
|
||||||
|
mov [status], STATUS_DISCONNECTED
|
||||||
|
mcall close, [socketnum]
|
||||||
|
|
||||||
|
popa
|
||||||
ret
|
ret
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2014. 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 ;;
|
||||||
@ -18,7 +18,7 @@ user_parser:
|
|||||||
|
|
||||||
mov eax, [edit1.size]
|
mov eax, [edit1.size]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz sdts_ret ; ignore empty commands
|
jz .ret ; ignore empty commands
|
||||||
mov word [usercommand + eax], 0x0a0d ; terminate the line
|
mov word [usercommand + eax], 0x0a0d ; terminate the line
|
||||||
|
|
||||||
cmp byte[usercommand], '/' ; is it a server command ?
|
cmp byte[usercommand], '/' ; is it a server command ?
|
||||||
@ -26,7 +26,7 @@ user_parser:
|
|||||||
|
|
||||||
; Ignore data commands when not connected.
|
; Ignore data commands when not connected.
|
||||||
cmp [status], STATUS_CONNECTED
|
cmp [status], STATUS_CONNECTED
|
||||||
jne sdts_ret
|
jne .notconnected
|
||||||
|
|
||||||
; 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?
|
; TODO: dont send if it's a server window?
|
||||||
@ -86,8 +86,13 @@ user_parser:
|
|||||||
|
|
||||||
lea esi, [edi - packetbuf]
|
lea esi, [edi - packetbuf]
|
||||||
mcall send, [socketnum], packetbuf, , 0
|
mcall send, [socketnum], packetbuf, , 0
|
||||||
|
.ret:
|
||||||
|
|
||||||
sdts_ret:
|
ret
|
||||||
|
|
||||||
|
.notconnected:
|
||||||
|
mov esi, str_notconnected
|
||||||
|
call print_text2
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -100,7 +105,9 @@ user_commands:
|
|||||||
dd 'help', cmd_usr_help
|
dd 'help', cmd_usr_help
|
||||||
dd 'code', cmd_usr_code
|
dd 'code', cmd_usr_code
|
||||||
|
|
||||||
; All following commands require a connection to the server. TODO: verify connection
|
.number2 = ($ - user_commands) / 8
|
||||||
|
|
||||||
|
; All following commands require a connection to the server.
|
||||||
dd 'quer', cmd_usr_quer
|
dd 'quer', cmd_usr_quer
|
||||||
dd 'quit', cmd_usr_quit
|
dd 'quit', cmd_usr_quit
|
||||||
dd 'part', cmd_usr_part
|
dd 'part', cmd_usr_part
|
||||||
@ -113,23 +120,34 @@ user_commands:
|
|||||||
|
|
||||||
server_command:
|
server_command:
|
||||||
|
|
||||||
mov eax, dword[usercommand+1]
|
mov eax, dword[usercommand+1] ; skip '/'
|
||||||
or eax, 0x20202020
|
or eax, 0x20202020 ; convert to lowercase
|
||||||
|
|
||||||
mov edi, user_commands
|
mov edi, user_commands
|
||||||
mov ecx, user_commands.number
|
mov ecx, user_commands.number
|
||||||
|
cmp [status], STATUS_CONNECTED
|
||||||
|
jne .loop
|
||||||
|
mov ecx, user_commands.number2
|
||||||
.loop:
|
.loop:
|
||||||
scasd
|
scasd
|
||||||
je .got_cmd
|
je .got_cmd
|
||||||
add edi, 4
|
add edi, 4
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .loop
|
jnz .loop
|
||||||
jmp cmd_usr_send ; If none of the previous commands, just send to server
|
|
||||||
|
cmp [status], STATUS_CONNECTED
|
||||||
|
jne .notconnected
|
||||||
|
|
||||||
|
jmp cmd_usr_send ; If none of the previous commands, just send to server
|
||||||
|
|
||||||
.got_cmd:
|
.got_cmd:
|
||||||
jmp dword[edi]
|
jmp dword[edi]
|
||||||
|
|
||||||
|
.notconnected:
|
||||||
|
mov esi, str_notconnected
|
||||||
|
call print_text2
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -341,15 +359,23 @@ cmd_usr_server:
|
|||||||
cmp eax, 'er '
|
cmp eax, 'er '
|
||||||
jne cmd_usr_send
|
jne cmd_usr_send
|
||||||
|
|
||||||
mov ecx, [edit1.size] ; ok now set the address
|
mov ecx, [edit1.size] ; ok now set the address
|
||||||
sub ecx, 8
|
sub ecx, 8
|
||||||
|
|
||||||
mov esi, usercommand+8
|
mov esi, usercommand+8
|
||||||
|
.now:
|
||||||
push esi
|
push esi
|
||||||
mov edi, irc_server_name
|
mov edi, irc_server_name
|
||||||
rep movsb
|
.loop: ; copy until zero byte, or ecx reaches zero.
|
||||||
|
lodsb
|
||||||
|
stosb
|
||||||
|
test al, al
|
||||||
|
jz .done
|
||||||
|
dec ecx
|
||||||
|
jnz .loop
|
||||||
xor al, al
|
xor al, al
|
||||||
stosb
|
stosb
|
||||||
|
.done:
|
||||||
pop esi
|
pop esi
|
||||||
|
|
||||||
; set it also in window name
|
; set it also in window name
|
||||||
@ -364,31 +390,8 @@ cmd_usr_server:
|
|||||||
|
|
||||||
cmd_usr_quer:
|
cmd_usr_quer:
|
||||||
|
|
||||||
mov ecx, MAX_WINDOWS
|
|
||||||
mov ebx, windows
|
|
||||||
.loop:
|
|
||||||
cmp [ebx + window.data_ptr], 0
|
|
||||||
je .found
|
|
||||||
add ebx, sizeof.window
|
|
||||||
dec ecx
|
|
||||||
jnz .loop
|
|
||||||
|
|
||||||
; error: no available channels ! FIXME
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
.found:
|
|
||||||
call window_create
|
|
||||||
test eax, eax
|
|
||||||
jz .error
|
|
||||||
mov [ebx + window.type], WINDOWTYPE_CHAT
|
|
||||||
|
|
||||||
mov esi, usercommand+7
|
mov esi, usercommand+7
|
||||||
call window_set_name
|
call window_open
|
||||||
|
|
||||||
|
|
||||||
.error:
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -470,6 +473,7 @@ cmd_usr_part_channel:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cmd_usr_ctcp:
|
cmd_usr_ctcp:
|
||||||
|
|
||||||
cmp byte[usercommand+5], ' '
|
cmp byte[usercommand+5], ' '
|
||||||
@ -527,6 +531,7 @@ cmd_usr_ctcp:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; The user typed some undefined command, just recode it and send to the server
|
; The user typed some undefined command, just recode it and send to the server
|
||||||
cmd_usr_send:
|
cmd_usr_send:
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2014. 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 ;;
|
||||||
@ -10,10 +10,14 @@
|
|||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
; window_create_textbox
|
||||||
|
; Initialises the data structure for our multiline textbox
|
||||||
|
;
|
||||||
|
; in: window ptr in ebx
|
||||||
|
; out: eax = 0 on error
|
||||||
|
; ecx, edi = destroyed
|
||||||
|
|
||||||
; in: window ptr in ebx
|
window_create_textbox:
|
||||||
; out: eax = 0 on error
|
|
||||||
window_create:
|
|
||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
; allocate the window data block
|
; allocate the window data block
|
||||||
@ -47,24 +51,22 @@ window_create:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
window_set_name: ; esi = ptr to name, ebx = window ptr
|
; window_set_name
|
||||||
|
; Fills in the window name in window structure
|
||||||
|
;
|
||||||
|
; IN: esi = ptr to name
|
||||||
|
; ebx = window ptr
|
||||||
|
; OUT: esi = ptr to next parameter
|
||||||
|
; ebx = window ptr
|
||||||
|
; eax, ecx, edx, edi = destroyed
|
||||||
|
|
||||||
pusha
|
window_set_name:
|
||||||
|
|
||||||
; Skip heading spaces
|
|
||||||
.spaceloop:
|
|
||||||
cmp byte[esi], ' '
|
|
||||||
jne .done
|
|
||||||
inc esi
|
|
||||||
jmp .spaceloop
|
|
||||||
.done:
|
|
||||||
|
|
||||||
; Now copy it
|
|
||||||
lea edi, [ebx + window.name]
|
lea edi, [ebx + window.name]
|
||||||
mov ecx, MAX_WINDOWNAME_LEN
|
mov ecx, MAX_WINDOWNAME_LEN
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 0x21
|
cmp al, 0x21 ; name ends with 0, space or !
|
||||||
jbe .addzero
|
jbe .addzero
|
||||||
stosb
|
stosb
|
||||||
dec ecx
|
dec ecx
|
||||||
@ -73,9 +75,9 @@ window_set_name: ; esi = ptr to name, ebx = window ptr
|
|||||||
xor al, al
|
xor al, al
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
call draw_windowtabs ; redraw it
|
push esi ebx
|
||||||
|
call draw_windowtabs
|
||||||
popa
|
pop ebx esi
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -133,11 +135,16 @@ window_close: ; closes the 'print' window
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
; window_find:
|
||||||
|
; search for a window with given name in the window list
|
||||||
|
;
|
||||||
|
; IN: esi = ptr to start of window name
|
||||||
|
; OUT: ebx = window ptr, or 0 if none found
|
||||||
|
; esi = ptr to end of window name, if window was found
|
||||||
|
|
||||||
|
window_find:
|
||||||
|
|
||||||
window_find: ; esi = window name
|
|
||||||
; search for window in list
|
|
||||||
mov ebx, windows
|
mov ebx, windows
|
||||||
mov [window_print], ebx ; set first window (server window) as default output window
|
|
||||||
mov eax, MAX_WINDOWS
|
mov eax, MAX_WINDOWS
|
||||||
.scanloop:
|
.scanloop:
|
||||||
push esi
|
push esi
|
||||||
@ -146,16 +153,12 @@ window_find: ; esi = window name
|
|||||||
lea edi, [ebx + window.name]
|
lea edi, [ebx + window.name]
|
||||||
mov ecx, MAX_WINDOWNAME_LEN
|
mov ecx, MAX_WINDOWNAME_LEN
|
||||||
repe cmpsb
|
repe cmpsb
|
||||||
cmp byte[edi-1], 0
|
cmp byte[edi-1], 0 ; last equall character was null? yes, the strings match!
|
||||||
|
je .got_it
|
||||||
|
cmp byte[edi], 0 ; we're at the end of string1.. ?
|
||||||
jne .try_next
|
jne .try_next
|
||||||
cmp byte[esi-1], 0
|
cmp byte[esi], 0x21 ; and the end of string2? yes!
|
||||||
je .got_it
|
jbe .got_it
|
||||||
cmp byte[esi-1], 10
|
|
||||||
je .got_it
|
|
||||||
cmp byte[esi-1], 13
|
|
||||||
je .got_it
|
|
||||||
cmp byte[esi-1], ' '
|
|
||||||
je .got_it
|
|
||||||
.try_next:
|
.try_next:
|
||||||
pop esi
|
pop esi
|
||||||
add ebx, sizeof.window
|
add ebx, sizeof.window
|
||||||
@ -166,78 +169,62 @@ window_find: ; esi = window name
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.got_it:
|
.got_it:
|
||||||
pop esi ;;; TODO: dont reset ESI ?
|
add esp, 4
|
||||||
mov [window_print], ebx
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; window_open:
|
||||||
|
|
||||||
|
|
||||||
; open a window with a given name, if it does not exist, create it
|
; open a window with a given name, if it does not exist, create it
|
||||||
; This procedure only affects window_print ptr, not window_active!
|
; This procedure only affects window_print ptr, not window_active!
|
||||||
;
|
;
|
||||||
; esi = ptr to ASCIIZ windowname
|
; IN: esi = ptr to ASCIIZ windowname
|
||||||
|
; OUT: esi = ptr to next parameter
|
||||||
|
|
||||||
window_open:
|
window_open:
|
||||||
|
|
||||||
push esi
|
; Skip heading spaces
|
||||||
|
lodsb
|
||||||
mov edi, esi
|
cmp al, ' '
|
||||||
call compare_to_nick
|
je window_open
|
||||||
jne .nochat
|
cmp al, ':'
|
||||||
|
je window_open
|
||||||
mov esi, servercommand+1
|
dec esi
|
||||||
.nochat:
|
|
||||||
|
|
||||||
call window_find
|
call window_find
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jne .got_it
|
jnz .got_it
|
||||||
|
|
||||||
; create channel window - search for empty slot
|
; create channel window - search for empty slot
|
||||||
.create_it:
|
.create_it:
|
||||||
mov ebx, windows
|
mov ebx, windows
|
||||||
mov ecx, MAX_WINDOWS
|
mov ecx, MAX_WINDOWS
|
||||||
.scanloop2:
|
.scanloop2:
|
||||||
cmp [ebx + window.data_ptr], 0
|
cmp [ebx + window.type], WINDOWTYPE_NONE
|
||||||
je .free_found
|
je .free_found
|
||||||
add ebx, sizeof.window
|
add ebx, sizeof.window
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .scanloop2
|
jnz .scanloop2
|
||||||
; Error: no more available windows!
|
jmp .error
|
||||||
jmp .got_it ; TODO: return error
|
|
||||||
|
|
||||||
.free_found:
|
.free_found:
|
||||||
call window_create
|
call window_create_textbox
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .got_it ; TODO: return error
|
jz .error
|
||||||
mov [ebx + window.type], WINDOWTYPE_CHAT ; FIXME: let caller handle this ?
|
mov [ebx + window.type], WINDOWTYPE_CHAT ; FIXME: let caller handle this ?
|
||||||
|
|
||||||
call window_set_name
|
call window_set_name
|
||||||
mov [window_print], ebx
|
|
||||||
|
|
||||||
call draw_windowtabs
|
|
||||||
|
|
||||||
.got_it:
|
.got_it:
|
||||||
pop esi
|
|
||||||
.skip1:
|
|
||||||
; skip text
|
|
||||||
lodsb
|
lodsb
|
||||||
test al, al
|
|
||||||
jz .quit
|
|
||||||
cmp al, ' '
|
cmp al, ' '
|
||||||
jne .skip1
|
je .got_it
|
||||||
dec esi
|
|
||||||
; now skip trailing spaces and semicolons
|
|
||||||
.skip2:
|
|
||||||
lodsb
|
|
||||||
test al, al
|
|
||||||
jz .quit
|
|
||||||
cmp al, ' '
|
|
||||||
je .skip2
|
|
||||||
cmp al, ':'
|
cmp al, ':'
|
||||||
je .skip2
|
je .got_it
|
||||||
dec esi
|
dec esi
|
||||||
|
|
||||||
.quit:
|
mov [window_print], ebx
|
||||||
|
ret
|
||||||
|
|
||||||
|
.error: ; TODO: return error?
|
||||||
ret
|
ret
|
Loading…
Reference in New Issue
Block a user