Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7300 → Rev 7299

/programs/network/ircc/ircc.asm
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; IRC client for KolibriOS ;;
13,7 → 13,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
version equ '0.31'
version equ '0.30'
 
; connection status
STATUS_DISCONNECTED = 0
62,7 → 62,6
 
MAX_NICK_LEN = 32
MAX_REAL_LEN = 32 ; realname
QUIT_MSG_LEN = 250
MAX_SERVER_NAME = 256
 
MAX_CHANNEL_LEN = 40
70,11 → 69,6
 
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
 
MAX_WINDOWNAME_LEN = 256
160,7 → 154,7
; find path to main settings file (ircc.ini)
mov edi, path ; Calculate the length of zero-terminated string
xor al, al
mov ecx, PATH_SIZE
mov ecx, 1024
repne scasb
dec edi
mov eax, '.ini'
176,7 → 170,7
 
; clear command area too
mov edi, servercommand
mov ecx, SERVERCOMMAND_SIZE/4
mov ecx, 600/4
rep stosd
 
; allocate window data block
183,7 → 177,7
mov ebx, windows
call window_create_textbox
test eax, eax
jz exit
jz error
mov [ebx + window.type], WINDOWTYPE_SERVER
 
; get system colors
218,7 → 212,7
cmp byte[param], 0
je @f
mov esi, param
mov ecx, PARAM_SIZE
mov ecx, 1024
call cmd_usr_server.now
@@:
 
261,7 → 255,7
ror eax, 8
 
cmp ax, 1 ; close program
je quit
je exit
 
cmp ax, WINDOW_BTN_CLOSE
jne @f
324,10 → 318,10
 
@@:
sub ax, WINDOW_BTN_START
jb quit
jb exit
 
cmp ax, MAX_WINDOWS
ja quit
ja exit
 
; Save users scrollbar position
push [scroll1.position]
341,7 → 335,7
mov dx, ax
add edx, windows
cmp [edx + window.type], WINDOWTYPE_NONE
je quit
je exit
mov [window_active], edx
 
push [edx + window.text_line_print]
353,7 → 347,8
call draw_window
jmp mainloop
 
quit:
exit:
 
cmp [socketnum], 0
je @f
mov esi, quit_msg
360,29 → 355,8
call quit_server
@@:
 
exit:
error:
 
; 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
 
 
485,7 → 459,6
topic_header db 3, '3* ', 0
action_header db 3, '6* ', 0
ctcp_header db 3, '13-> [', 0
ctcp_header_recv db 3, '13', 0
msg_header db 3, '7-> *', 0
ctcp_version db '] VERSION', 10, 0
ctcp_ping db '] PING', 10, 0
532,9 → 505,9
db '/part <channel> : part from a channel', 10
db '/quit : quit server', 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 'Other commands are sent straight to a server', 10
db 'Other commands are send straight to server.', 10
db 10, 0
 
str_welcome db 3, '3 ___', 3, '7__________', 3, '6_________ ', 3, '4 __ __ __', 10
582,7 → 555,6
.ip dd 0
rb 10
 
SOCKADDR1_SIZE = 18
 
status dd STATUS_DISCONNECTED
 
629,11 → 601,11
utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence
utf8_char dd ? ; first bits of current UTF8 character
 
packetbuf rb PACKETBUF_SIZE ; buffer for packets to server
path rb PATH_SIZE
param rb PARAM_SIZE
packetbuf rb 1024 ; buffer for packets to server
path rb 1024
param rb 1024
 
servercommand rb SERVERCOMMAND_SIZE
servercommand rb 600
 
thread_info process_information
xsize dd ?
650,7 → 622,7
 
user_nick rb MAX_NICK_LEN
user_real_name rb MAX_REAL_LEN
quit_msg rb QUIT_MSG_LEN
quit_msg rb 250
 
windows rb MAX_WINDOWS*sizeof.window
 
/programs/network/ircc/gui.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Written by hidnplayr@kolibrios.org ;;
56,9 → 56,6
test [thread_info.wnd_state], 100b ; skip if window is rolled up
jne .exit
 
cmp [window_active], 0
je .no_window
 
; calculate available space for textbox and coordinates for scrollbars
mov eax, [ysize]
sub eax, TOP_Y + INPUTBOX_HEIGHT - 1
131,7 → 128,6
mov edx, [colors.work_graph]
mcall 38
.not_channel:
.no_window:
 
; draw editbox
mov eax, [ysize]
/programs/network/ircc/serverparser.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Written by hidnplayr@kolibrios.org ;;
328,39 → 328,10
cmp eax, 'dcc ' ; TODO
je cmd_dcc
 
; Unknown CTCP command - just print to window
; Unknown CTCP command: TODO: just print to window??
 
.just_print:
.fail:
 
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
 
.time:
/programs/network/ircc/userparser.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Written by hidnplayr@kolibrios.org ;;
204,6 → 204,9
stosw
mov byte[edi], 0
 
lea esi, [edi - packetbuf]
mcall send, [socketnum], packetbuf, , 0
 
; now print to the window
if TIMESTAMP
call print_timestamp
223,14 → 226,8
call print_char
 
pop esi
push esi
call print_asciiz
pop esi
 
 
lea esi, [edi - packetbuf]
mcall send, [socketnum], packetbuf, , 0
 
.fail:
ret
 
530,8 → 527,6
mov al, 0x01
stosb
 
push edi esi
 
; copy the message itself
@@:
lodsb
550,35 → 545,13
stosb
mov ax, 0x0a0d
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
lea esi, [edi - packetbuf] ; calculate length
mcall send, [socketnum], packetbuf, , 0 ; and finally send to server
 
;; TODO: print to window
 
.fail:
 
ret
/programs/network/ircc/socket.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Written by hidnplayr@kolibrios.org ;;
213,7 → 213,7
; FIXME: make this a proper stream!
 
.nextpacket:
mcall recv, [socketnum], packetbuf, PACKETBUF_SIZE, MSG_DONTWAIT ; read a packet
mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet
inc eax ; check if we got any data
jz .done ; TODO: handle errors!
dec eax
/programs/network/ircc/window.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Written by hidnplayr@kolibrios.org ;;
81,17 → 81,7
 
ret
 
window_close_all:
 
.loop:
call window_close
 
cmp [window_print], 0
jne .loop
 
ret
 
 
window_close: ; closes the 'print' window
 
; Remove the window (overwrite current structure with trailing ones)
107,36 → 97,20
xor al, al
rep stosb
 
; 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
; free the window data block
pop ecx
mcall 68, 13
 
; We closed this window so we need to show another
; Is there still a window in the active position?
mov edi, [window_active]
cmp [edi + window.data_ptr], 0
jne .redraw
; Did we just close the last window?
cmp edi, windows
je .closed_last
; Nope, move one window to the left
jne @f
sub edi, sizeof.window
mov [window_active], edi
mov [window_print], edi
jmp .redraw
@@:
 
.closed_last:
xor edi, edi
mov [window_active], edi
mov [window_print], edi
 
; At last, redraw everything
.redraw:
call draw_window
 
ret