Rev 4623 | Rev 4981 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4623 | Rev 4659 | ||
---|---|---|---|
Line 115... | Line 115... | ||
115 | dd 'msg ', cmd_usr_msg |
115 | dd 'msg ', cmd_usr_msg |
Line 116... | Line 116... | ||
116 | 116 | ||
Line 117... | Line -... | ||
117 | .number = ($ - user_commands) / 8 |
- | |
118 | 117 | .number = ($ - user_commands) / 8 |
|
Line 119... | Line 118... | ||
119 | 118 | ||
120 | 119 | ||
Line 121... | Line 120... | ||
121 | server_command: |
120 | server_command: |
122 | 121 | ||
123 | mov eax, dword[usercommand+1] ; skip '/' |
122 | mov eax, dword[usercommand+1] ; skip '/' |
124 | or eax, 0x20202020 ; convert to lowercase |
123 | or eax, 0x20202020 ; convert to lowercase |
125 | 124 | ||
126 | mov edi, user_commands |
125 | mov edi, user_commands |
127 | mov ecx, user_commands.number |
126 | mov ecx, user_commands.number |
128 | cmp [status], STATUS_CONNECTED |
127 | cmp [status], STATUS_CONNECTED |
129 | jne .loop |
128 | je .loop |
130 | mov ecx, user_commands.number2 |
129 | mov ecx, user_commands.number2 |
131 | .loop: |
130 | .loop: |
Line 132... | Line 131... | ||
132 | scasd |
131 | scasd |
133 | je .got_cmd |
132 | je .got_cmd |
- | 133 | add edi, 4 |
|
- | 134 | dec ecx |
|
- | 135 | jnz .loop |
|
- | 136 | ||
Line 134... | Line 137... | ||
134 | add edi, 4 |
137 | cmp [status], STATUS_CONNECTED |
Line 135... | Line 138... | ||
135 | dec ecx |
138 | jne .notconnected |
136 | jnz .loop |
139 | ; Commands shorter then 3 chars are placed here |
Line 430... | Line 433... | ||
430 | 433 | ||
431 | ; close active window |
434 | ; close active window |
Line 432... | Line 435... | ||
432 | cmd_usr_close_window: |
435 | cmd_usr_close_window: |
433 | - | ||
434 | mov esi, [window_active] |
436 | |
435 | mov [window_print], esi |
437 | mov esi, [window_active] |
Line 436... | Line 438... | ||
436 | cmp [esi + window.type], WINDOWTYPE_SERVER |
438 | cmp [esi + window.type], WINDOWTYPE_SERVER |
437 | je .not_channel |
439 | je .not_channel |
Line 538... | Line 540... | ||
538 | 540 | ||
Line -... | Line 541... | ||
- | 541 | ret |
|
- | 542 | ||
- | 543 | ||
- | 544 | ||
- | 545 | cmd_usr_me: |
|
- | 546 | ||
- | 547 | ; prepare a 'PRIVMSG ' |
|
- | 548 | mov dword[packetbuf], 'PRIV' |
|
- | 549 | mov dword[packetbuf+4], 'MSG ' |
|
- | 550 | lea edi, [packetbuf+8] |
|
- | 551 | ||
- | 552 | ; append the destination (nickname/channel) |
|
- | 553 | mov esi, [window_active] |
|
- | 554 | lea esi, [esi + window.name] |
|
- | 555 | @@: |
|
- | 556 | lodsb |
|
- | 557 | test al, al |
|
- | 558 | je @f |
|
- | 559 | stosb |
|
- | 560 | jmp @r |
|
- | 561 | @@: |
|
- | 562 | ||
- | 563 | ; Make the CTCP action header |
|
- | 564 | mov eax, ' :' + 0x01 shl 16 + 'A' shl 24 |
|
- | 565 | stosd |
|
- | 566 | mov eax, 'CTIO' |
|
- | 567 | stosd |
|
- | 568 | mov al, 'N' |
|
- | 569 | stosb |
|
- | 570 | ||
- | 571 | ; copy the message itself (including first space) |
|
- | 572 | mov esi, usercommand+3 |
|
- | 573 | @@: |
|
- | 574 | lodsb |
|
- | 575 | cmp al, 13 |
|
- | 576 | je @f |
|
- | 577 | stosb |
|
- | 578 | jmp @r |
|
- | 579 | @@: |
|
- | 580 | ||
- | 581 | ; end of CTCP message |
|
- | 582 | mov al, 0x01 |
|
- | 583 | stosb |
|
- | 584 | mov ax, 0x0a0d |
|
- | 585 | stosw |
|
- | 586 | ||
- | 587 | ; now send it to the server |
|
- | 588 | lea esi, [edi - packetbuf] ; calculate length |
|
- | 589 | mcall send, [socketnum], packetbuf, , 0 ; and finally send to server |
|
- | 590 | ||
- | 591 | ; print to local window |
|
- | 592 | if TIMESTAMP |
|
- | 593 | call print_timestamp |
|
- | 594 | end if |
|
- | 595 | ||
- | 596 | mov esi, action_header |
|
- | 597 | call print_asciiz |
|
- | 598 | ||
- | 599 | mov esi, user_nick |
|
- | 600 | call print_asciiz |
|
- | 601 | ||
- | 602 | mov esi, usercommand+3 |
|
- | 603 | mov bl, 13 |
|
- | 604 | call print_string |
|
- | 605 | ||
- | 606 | mov al, 10 |
|
- | 607 | call print_char |
|
- | 608 | ||
539 | ret |
609 | ret |
540 | 610 | ||
Line 541... | Line 611... | ||
541 | 611 | ||
542 | 612 |