Rev 4143 | Rev 4617 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4143 | Rev 4477 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; Written by hidnplayr@kolibrios.org ;; |
6 | ;; Written by hidnplayr@kolibrios.org ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; GNU GENERAL PUBLIC LICENSE ;; |
8 | ;; GNU GENERAL PUBLIC LICENSE ;; |
Line 16... | Line 16... | ||
16 | push [window_active] ; print to the current window |
16 | push [window_active] ; print to the current window |
17 | pop [window_print] |
17 | pop [window_print] |
Line 18... | Line 18... | ||
18 | 18 | ||
19 | mov eax, [edit1.size] |
19 | mov eax, [edit1.size] |
20 | test eax, eax |
20 | test eax, eax |
21 | jz sdts_ret ; ignore empty commands |
21 | jz .ret ; ignore empty commands |
Line 22... | Line 22... | ||
22 | mov word [usercommand + eax], 0x0a0d ; terminate the line |
22 | mov word [usercommand + eax], 0x0a0d ; terminate the line |
23 | 23 | ||
Line 24... | Line 24... | ||
24 | cmp byte[usercommand], '/' ; is it a server command ? |
24 | cmp byte[usercommand], '/' ; is it a server command ? |
25 | je server_command |
25 | je server_command |
26 | 26 | ||
Line 27... | Line 27... | ||
27 | ; Ignore data commands when not connected. |
27 | ; Ignore data commands when not connected. |
28 | cmp [status], STATUS_CONNECTED |
28 | cmp [status], STATUS_CONNECTED |
Line 29... | Line 29... | ||
29 | jne sdts_ret |
29 | jne .notconnected |
Line 84... | Line 84... | ||
84 | mov ax, 0x0a0d |
84 | mov ax, 0x0a0d |
85 | stosw |
85 | stosw |
Line 86... | Line 86... | ||
86 | 86 | ||
87 | lea esi, [edi - packetbuf] |
87 | lea esi, [edi - packetbuf] |
- | 88 | mcall send, [socketnum], packetbuf, , 0 |
|
Line 88... | Line 89... | ||
88 | mcall send, [socketnum], packetbuf, , 0 |
89 | .ret: |
- | 90 | ||
- | 91 | ret |
|
- | 92 | ||
- | 93 | .notconnected: |
|
Line 89... | Line 94... | ||
89 | 94 | mov esi, str_notconnected |
|
Line 98... | Line 103... | ||
98 | dd 'real', cmd_usr_real |
103 | dd 'real', cmd_usr_real |
99 | dd 'serv', cmd_usr_server |
104 | dd 'serv', cmd_usr_server |
100 | dd 'help', cmd_usr_help |
105 | dd 'help', cmd_usr_help |
101 | dd 'code', cmd_usr_code |
106 | dd 'code', cmd_usr_code |
Line -... | Line 107... | ||
- | 107 | ||
- | 108 | .number2 = ($ - user_commands) / 8 |
|
102 | 109 | ||
103 | ; All following commands require a connection to the server. TODO: verify connection |
110 | ; All following commands require a connection to the server. |
104 | dd 'quer', cmd_usr_quer |
111 | dd 'quer', cmd_usr_quer |
105 | dd 'quit', cmd_usr_quit |
112 | dd 'quit', cmd_usr_quit |
106 | dd 'part', cmd_usr_part |
113 | dd 'part', cmd_usr_part |
107 | dd 'ctcp', cmd_usr_ctcp |
114 | dd 'ctcp', cmd_usr_ctcp |
Line 111... | Line 118... | ||
111 | 118 | ||
Line 112... | Line 119... | ||
112 | 119 | ||
113 | 120 | ||
Line 114... | Line 121... | ||
114 | server_command: |
121 | server_command: |
115 | 122 | ||
- | 123 | mov eax, dword[usercommand+1] ; skip '/' |
|
- | 124 | or eax, 0x20202020 ; convert to lowercase |
|
- | 125 | ||
116 | mov eax, dword[usercommand+1] |
126 | mov edi, user_commands |
117 | or eax, 0x20202020 |
127 | mov ecx, user_commands.number |
118 | 128 | cmp [status], STATUS_CONNECTED |
|
119 | mov edi, user_commands |
129 | jne .loop |
120 | mov ecx, user_commands.number |
130 | mov ecx, user_commands.number2 |
121 | .loop: |
131 | .loop: |
- | 132 | scasd |
|
- | 133 | je .got_cmd |
|
- | 134 | add edi, 4 |
|
- | 135 | dec ecx |
|
122 | scasd |
136 | jnz .loop |
Line 123... | Line 137... | ||
123 | je .got_cmd |
137 | |
124 | add edi, 4 |
138 | cmp [status], STATUS_CONNECTED |
Line -... | Line 139... | ||
- | 139 | jne .notconnected |
|
- | 140 | ||
- | 141 | jmp cmd_usr_send ; If none of the previous commands, just send to server |
|
Line -... | Line 142... | ||
- | 142 | ||
Line 125... | Line 143... | ||
125 | dec ecx |
143 | .got_cmd: |
Line 343... | Line 361... | ||
343 | 361 | ||
344 | mov ecx, [edit1.size] ; ok now set the address |
362 | mov ecx, [edit1.size] ; ok now set the address |
Line 345... | Line 363... | ||
345 | sub ecx, 8 |
363 | sub ecx, 8 |
- | 364 | ||
346 | 365 | mov esi, usercommand+8 |
|
347 | mov esi, usercommand+8 |
366 | .now: |
- | 367 | push esi |
|
- | 368 | mov edi, irc_server_name |
|
- | 369 | .loop: ; copy until zero byte, or ecx reaches zero. |
|
- | 370 | lodsb |
|
- | 371 | stosb |
|
348 | push esi |
372 | test al, al |
- | 373 | jz .done |
|
349 | mov edi, irc_server_name |
374 | dec ecx |
350 | rep movsb |
375 | jnz .loop |
- | 376 | xor al, al |
|
351 | xor al, al |
377 | stosb |
Line 352... | Line 378... | ||
352 | stosb |
378 | .done: |
353 | pop esi |
379 | pop esi |
354 | 380 | ||
Line 362... | Line 388... | ||
362 | ret |
388 | ret |
Line 363... | Line 389... | ||
363 | 389 | ||
Line 364... | Line -... | ||
364 | - | ||
365 | cmd_usr_quer: |
- | |
366 | - | ||
367 | mov ecx, MAX_WINDOWS |
- | |
368 | mov ebx, windows |
- | |
369 | .loop: |
- | |
370 | cmp [ebx + window.data_ptr], 0 |
- | |
371 | je .found |
- | |
372 | add ebx, sizeof.window |
- | |
373 | dec ecx |
- | |
374 | jnz .loop |
- | |
375 | - | ||
376 | ; error: no available channels ! FIXME |
- | |
377 | - | ||
378 | ret |
- | |
379 | - | ||
380 | - | ||
381 | .found: |
- | |
382 | call window_create |
- | |
383 | test eax, eax |
- | |
384 | jz .error |
390 | |
385 | mov [ebx + window.type], WINDOWTYPE_CHAT |
391 | cmd_usr_quer: |
386 | - | ||
387 | mov esi, usercommand+7 |
- | |
388 | call window_set_name |
- | |
Line 389... | Line 392... | ||
389 | 392 | ||
Line 468... | Line 471... | ||
468 | mcall send, [socketnum], packetbuf, , 0 ; and finally send to server |
471 | mcall send, [socketnum], packetbuf, , 0 ; and finally send to server |
Line 469... | Line 472... | ||
469 | 472 | ||
Line -... | Line 473... | ||
- | 473 | ret |
|
470 | ret |
474 | |
Line 471... | Line 475... | ||
471 | 475 | ||
472 | 476 | ||
Line 525... | Line 529... | ||
525 | .fail: |
529 | .fail: |
Line 526... | Line 530... | ||
526 | 530 | ||
Line -... | Line 531... | ||
- | 531 | ret |
|
527 | ret |
532 | |
528 | 533 | ||
Line 529... | Line 534... | ||
529 | 534 | ||
530 | ; The user typed some undefined command, just recode it and send to the server |
535 | ; The user typed some undefined command, just recode it and send to the server |