Rev 6026 | Rev 9979 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6026 | Rev 6027 | ||
---|---|---|---|
Line 11... | Line 11... | ||
11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 12... | Line 12... | ||
12 | 12 | ||
Line 13... | Line 13... | ||
13 | 13 | ||
14 | user_parser: |
14 | user_parser: |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | mov ebp, [window_active] ; print to the current window |
16 | mov ebp, [window_active] ; print to the current window |
17 | mov [window_print], ebp |
17 | mov [window_print], ebp |
18 | - | ||
Line -... | Line 18... | ||
- | 18 | ||
- | 19 | mov ecx, [edit1.size] |
|
- | 20 | test ecx, ecx |
|
- | 21 | jz .ret ; ignore empty commands |
|
- | 22 | ||
- | 23 | mov esi, input_text |
|
- | 24 | mov edi, user_command |
|
19 | mov eax, [edit1.size] |
25 | call recode ; Convert to UTF-8 |
20 | test eax, eax |
26 | mov word[edi], 0x0a0d ; terminate the line |
Line 21... | Line 27... | ||
21 | jz .ret ; ignore empty commands |
27 | sub edi, user_command |
22 | mov word[usercommand + eax], 0x0a0d ; terminate the line |
28 | mov [user_command.size], edi |
Line 23... | Line 29... | ||
23 | 29 | ||
24 | cmp byte[usercommand], '/' ; is it a server command ? |
30 | cmp byte[user_command], '/' ; is it a server command ? |
25 | je .command |
31 | je .command |
26 | 32 | ||
Line 46... | Line 52... | ||
46 | mov al, '>' |
52 | mov al, '>' |
47 | call print_char |
53 | call print_char |
48 | mov al, ' ' |
54 | mov al, ' ' |
49 | call print_char |
55 | call print_char |
Line 50... | Line 56... | ||
50 | 56 | ||
51 | mov eax, [edit1.size] |
57 | mov eax, [user_command.size] |
52 | mov byte[usercommand + eax],0 |
- | |
53 | 58 | mov byte[user_command + eax],0 |
|
54 | mov esi, usercommand |
59 | mov esi, user_command |
Line 55... | Line 60... | ||
55 | call print_asciiz |
60 | call print_asciiz |
56 | 61 | ||
Line 74... | Line 79... | ||
74 | .done: |
79 | .done: |
Line 75... | Line 80... | ||
75 | 80 | ||
76 | mov ax, ' :' |
81 | mov ax, ' :' |
Line 77... | Line 82... | ||
77 | stosw |
82 | stosw |
78 | 83 | ||
79 | mov esi, usercommand |
84 | mov esi, user_command |
80 | mov ecx, [edit1.size] |
85 | mov ecx, [user_command.size] |
Line 81... | Line 86... | ||
81 | inc ecx |
86 | ; inc ecx |
82 | call recode |
87 | rep movsb |
83 | 88 | ||
Line 91... | Line 96... | ||
91 | .ret: |
96 | .ret: |
92 | ret |
97 | ret |
Line 93... | Line 98... | ||
93 | 98 | ||
94 | ; Text begins with a '/' lets try to find the command in the lookup table. |
99 | ; Text begins with a '/' lets try to find the command in the lookup table. |
95 | .command: |
100 | .command: |
96 | mov eax, dword[usercommand+1] ; skip '/' |
101 | mov eax, dword[user_command+1] ; skip '/' |
Line 97... | Line 102... | ||
97 | or eax, 0x20202020 ; convert to lowercase |
102 | or eax, 0x20202020 ; convert to lowercase |
98 | 103 | ||
99 | mov edi, user_commands |
104 | mov edi, user_commands |
100 | mov ecx, user_commands.number |
105 | mov ecx, user_commands.number |
101 | cmp [status], STATUS_CONNECTED |
106 | cmp [status], STATUS_CONNECTED |
102 | je .cmd_loop |
107 | jae .cmd_loop |
103 | mov ecx, user_commands.number2 |
108 | mov ecx, user_commands.number2 |
104 | .cmd_loop: |
109 | .cmd_loop: |
105 | scasd |
110 | scasd |
106 | je .got_cmd |
111 | je .got_cmd |
107 | add edi, 4 |
112 | add edi, 4 |
Line 108... | Line 113... | ||
108 | dec ecx |
113 | dec ecx |
109 | jnz .cmd_loop |
114 | jnz .cmd_loop |
Line 110... | Line 115... | ||
110 | 115 | ||
111 | cmp [status], STATUS_CONNECTED |
116 | cmp [status], STATUS_CONNECTED |
112 | jne .not_connected |
117 | jb .not_connected |
113 | 118 | ||
Line 120... | Line 125... | ||
120 | jmp cmd_usr_send |
125 | jmp cmd_usr_send |
Line 121... | Line 126... | ||
121 | 126 | ||
122 | .got_cmd: |
127 | .got_cmd: |
Line -... | Line 128... | ||
- | 128 | jmp dword[edi] |
|
- | 129 | ||
- | 130 | .not_loggedin: |
|
- | 131 | mov esi, str_notloggedin |
|
- | 132 | call print_asciiz |
|
123 | jmp dword[edi] |
133 | ret |
124 | 134 | ||
125 | .not_connected: |
135 | .not_connected: |
126 | mov esi, str_notconnected |
136 | mov esi, str_notconnected |
Line 154... | Line 164... | ||
154 | 164 | ||
Line 155... | Line 165... | ||
155 | 165 | ||
Line 156... | Line 166... | ||
156 | 166 | ||
157 | cmd_usr_msg: |
167 | cmd_usr_msg: |
158 | 168 | ||
Line 224... | Line 234... | ||
224 | 234 | ||
Line 225... | Line 235... | ||
225 | 235 | ||
226 | cmd_usr_quit: |
236 | cmd_usr_quit: |
227 | 237 | ||
228 | mov esi, quit_msg |
238 | mov esi, quit_msg |
Line 229... | Line 239... | ||
229 | cmp byte[usercommand+5], ' ' |
239 | cmp byte[user_command+5], ' ' |
230 | jne quit_server |
240 | jne quit_server |
Line 231... | Line 241... | ||
231 | lea esi, [usercommand+6] |
241 | lea esi, [user_command+6] |
Line 280... | Line 290... | ||
280 | 290 | ||
Line 281... | Line 291... | ||
281 | 291 | ||
282 | 292 | ||
283 | cmd_usr_nick: |
293 | cmd_usr_nick: |
284 | 294 | ||
285 | cmp [edit1.size], 5 |
295 | cmp [user_command.size], 5 |
286 | je .justprint |
296 | je .justprint |
Line 287... | Line 297... | ||
287 | cmp byte[usercommand+5], ' ' |
297 | cmp byte[user_command+5], ' ' |
288 | jne .fail |
298 | jne .fail |
289 | cmp [socketnum], 0 |
299 | cmp [socketnum], 0 |
290 | je .dontsend |
300 | je .dontsend |
291 | 301 | ||
292 | ; Request nickname change to server |
302 | ; Request nickname change to server |
Line 293... | Line 303... | ||
293 | mov dword[usercommand+1], 'NICK' |
303 | mov dword[user_command+1], 'NICK' |
294 | mov esi, [edit1.size] |
304 | mov esi, [user_command.size] |
Line 295... | Line 305... | ||
295 | mov word[usercommand + esi], 0x0a0d |
305 | mov word[user_command + esi], 0x0a0d |
296 | inc esi |
306 | inc esi |
297 | mcall send, [socketnum], usercommand+1, , 0 |
307 | mcall send, [socketnum], user_command+1, , 0 |
298 | 308 | ||
299 | .fail: |
309 | .fail: |
300 | ret |
310 | ret |
301 | 311 | ||
302 | ; We arent logged in yet, directly change user_nick field and print notification to user. |
312 | ; We arent logged in yet, directly change user_nick field and print notification to user. |
303 | .dontsend: |
313 | .dontsend: |
Line 329... | Line 339... | ||
329 | 339 | ||
Line 330... | Line 340... | ||
330 | 340 | ||
331 | 341 | ||
Line 332... | Line 342... | ||
332 | cmd_usr_real: |
342 | cmd_usr_real: |
333 | 343 | ||
334 | cmp byte[usercommand+5], ' ' |
344 | cmp byte[user_command+5], ' ' |
335 | jne cmd_usr_send |
345 | jne cmd_usr_send |
336 | 346 | ||
337 | mov ecx, MAX_REAL_LEN |
347 | mov ecx, MAX_REAL_LEN |
338 | mov esi, usercommand+6 |
348 | mov esi, user_command+6 |
Line 361... | Line 371... | ||
361 | 371 | ||
Line 362... | Line 372... | ||
362 | 372 | ||
363 | 373 | ||
364 | cmd_usr_server: |
374 | cmd_usr_server: |
365 | 375 | ||
366 | mov eax, dword[usercommand+5] ; check for 'er ', we only checked 'serv' |
376 | mov eax, dword[user_command+5] ; check for 'er ', we only checked 'serv' |
Line 367... | Line 377... | ||
367 | or eax, 0x00002020 |
377 | or eax, 0x00002020 |
368 | and eax, 0x00ffffff |
378 | and eax, 0x00ffffff |
369 | cmp eax, 'er ' |
379 | cmp eax, 'er ' |
Line 370... | Line 380... | ||
370 | jne cmd_usr_send |
380 | jne cmd_usr_send |
371 | 381 | ||
Line 372... | Line 382... | ||
372 | ; Server window is always first window in the list, switch to it. |
382 | ; Server window is always first window in the list, switch to it. |
373 | mov [window_print], windows |
383 | mov [window_print], windows |
374 | mov [window_active], windows |
384 | mov [window_active], windows |
375 | 385 | ||
376 | mov ecx, [edit1.size] ; ok now set the address |
386 | mov ecx, [user_command.size] ; ok now set the address |
377 | sub ecx, 8 |
387 | sub ecx, 8 |
Line 402... | Line 412... | ||
402 | ret |
412 | ret |
Line 403... | Line 413... | ||
403 | 413 | ||
Line 404... | Line 414... | ||
404 | 414 | ||
405 | cmd_usr_quer: |
415 | cmd_usr_quer: |
406 | 416 | ||
407 | mov esi, usercommand+7 |
417 | mov esi, user_command+7 |
Line 408... | Line 418... | ||
408 | call window_open |
418 | call window_open |
Line 431... | Line 441... | ||
431 | 441 | ||
432 | 442 | ||
Line 433... | Line 443... | ||
433 | ; User typed a part command |
443 | ; User typed a part command |
434 | cmd_usr_part: |
444 | cmd_usr_part: |
Line 435... | Line 445... | ||
435 | 445 | ||
436 | cmp byte[usercommand+5], 13 ; parameters given? |
446 | cmp byte[user_command+5], 13 ; parameters given? |
Line 490... | Line 500... | ||
490 | 500 | ||
Line 491... | Line 501... | ||
491 | 501 | ||
492 | 502 | ||
Line 493... | Line 503... | ||
493 | cmd_usr_ctcp: |
503 | cmd_usr_ctcp: |
494 | 504 | ||
495 | cmp byte[usercommand+5], ' ' |
505 | cmp byte[user_command+5], ' ' |
496 | jne cmd_usr_send |
506 | jne cmd_usr_send |
497 | 507 | ||
Line 573... | Line 583... | ||
573 | stosd |
583 | stosd |
574 | mov al, 'N' |
584 | mov al, 'N' |
575 | stosb |
585 | stosb |
Line 576... | Line 586... | ||
576 | 586 | ||
577 | ; copy the message itself (including first space) |
587 | ; copy the message itself (including first space) |
578 | mov esi, usercommand+3 |
588 | mov esi, user_command+3 |
579 | @@: |
589 | @@: |
580 | lodsb |
590 | lodsb |
581 | cmp al, 13 |
591 | cmp al, 13 |
582 | je @f |
592 | je @f |
Line 603... | Line 613... | ||
603 | call print_asciiz |
613 | call print_asciiz |
Line 604... | Line 614... | ||
604 | 614 | ||
605 | mov esi, user_nick |
615 | mov esi, user_nick |
Line 606... | Line 616... | ||
606 | call print_asciiz |
616 | call print_asciiz |
607 | 617 | ||
608 | mov esi, usercommand+3 |
618 | mov esi, user_command+3 |
Line 609... | Line 619... | ||
609 | mov bl, 13 |
619 | mov bl, 13 |
610 | call print_string |
620 | call print_string |
Line 611... | Line 621... | ||
611 | 621 | ||
Line 612... | Line 622... | ||
612 | mov al, 10 |
622 | mov al, 10 |
613 | call print_char |
623 | call print_char |
Line 614... | Line 624... | ||
614 | 624 | ||
615 | ret |
625 | ret |
616 | 626 | ||
617 | 627 | ||
618 | 628 | ||
619 | ; The user typed some undefined command, just recode it and send to the server |
- | |
620 | cmd_usr_send: |
- | |
621 | 629 | ; The user typed some undefined command, just send it to the server |
|
Line 622... | Line 630... | ||
622 | mov esi, usercommand+1 |
630 | cmd_usr_send: |