28,7 → 28,7 |
|
; TODO: dont send if it's a server window? |
|
push [window_open] ; print to the current window |
push [window_active] ; print to the current window |
pop [window_print] |
call window_refresh |
|
61,7 → 61,7 |
mov dword[packetbuf], 'priv' |
mov dword[packetbuf+4], 'msg ' |
|
mov esi, [window_open] |
mov esi, [window_active] |
add esi, window.name |
mov edi, packetbuf+8 |
mov ecx, MAX_WINDOWNAME_LEN |
103,6 → 103,7 |
; TODO: All other commands require a connection to the server. |
dd 'quer', cmd_usr_quer |
dd 'quit', cmd_usr_quit |
dd 'part', cmd_usr_part |
|
.number = ($ - user_commands) / 8 |
|
132,15 → 133,14 |
|
cmd_usr_quit: |
|
cmp [edit1.size], 5 |
je .ok |
jb cmd_usr_send |
mov esi, quit_msg |
|
cmp byte[usercommand+5], ' ' |
jne cmd_usr_send |
jne .default_msg |
lea esi,[usercommand+6] |
.default_msg: |
call cmd_usr_quit_server |
|
.ok: |
call cmd_usr_send |
|
mcall close, [socketnum] |
|
mov ecx, MAX_WINDOWS |
155,7 → 155,32 |
|
|
|
; esi = quit message |
cmd_usr_quit_server: |
|
; User wants to close a channel, send PART command to server |
mov dword[packetbuf], 'QUIT' |
mov word[packetbuf+4], ' :' |
lea edi, [packetbuf+6] |
; Append our quit msg |
@@: |
lodsb |
stosb |
test al, al |
jnz @r |
; end the command with a CRLF |
dec edi |
mov ax, 0x0a0d |
stosw |
|
lea esi, [edi - packetbuf] ; calculate length |
mcall send, [socketnum], packetbuf, , 0 ; and finally send to server |
|
ret |
|
|
|
|
cmd_usr_nick: |
|
cmp [edit1.size], 5 |
305,6 → 330,46 |
|
|
|
; User typed a part command |
cmd_usr_part: |
|
cmp byte[usercommand+5], 13 ; parameters given? |
jne cmd_usr_send |
|
mov esi, [window_active] ; window is not a server window? |
cmp [esi + window.type], WINDOWTYPE_SERVER |
je @f |
|
call window_close ; OK, close currently open (channel/chat/..) window |
@@: |
|
ret |
|
; Send part command to server |
; esi must point to channel name (ASCIIZ) |
cmd_usr_part_channel: |
|
; User wants to close a channel, send PART command to server |
mov dword[packetbuf], 'PART' |
mov byte[packetbuf+4], ' ' |
lea edi, [packetbuf+5] |
@@: |
lodsb |
stosb |
test al, al |
jnz @r |
; end the command with a CRLF |
dec edi |
mov ax, 0x0a0d |
stosw |
|
lea esi, [edi - packetbuf] ; calculate length |
mcall send, [socketnum], packetbuf, , 0 ; and finally send to server |
|
ret |
|
|
; The user typed some undefined command, just recode it and send to the server |
cmd_usr_send: |
|
mov esi, usercommand+1 |