Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7299 → Rev 7300

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