Rev 3220 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3220 | Rev 3222 | ||
---|---|---|---|
Line 532... | Line 532... | ||
532 | 532 | ||
533 | mov esi, action_header |
533 | mov esi, action_header |
Line 534... | Line 534... | ||
534 | call print_text2 |
534 | call print_text2 |
535 | 535 | ||
536 | mov eax, servercommand+1 |
536 | mov eax, servercommand+1 |
Line 537... | Line 537... | ||
537 | mov dl, ' ' |
537 | mov dl, '!' |
538 | call print_text |
538 | call print_text |
Line 551... | Line 551... | ||
551 | ret |
551 | ret |
Line 552... | Line 552... | ||
552 | 552 | ||
Line 553... | Line 553... | ||
553 | 553 | ||
Line 554... | Line 554... | ||
554 | 554 | ||
555 | 555 | ||
556 | cmd_nick: ; FIXME |
- | |
557 | - | ||
558 | add esi, 5 ; skip 'NICK ' |
- | |
559 | - | ||
560 | push esi |
- | |
561 | ; test for change of my nick |
- | |
562 | mov esi, servercommand+1 |
- | |
563 | mov edi, user_nick |
- | |
564 | mov ecx, MAX_NICK_LEN |
- | |
565 | rep cmpsb |
- | |
566 | cmp byte[edi-1], 0 |
- | |
567 | jne .notmy |
- | |
568 | cmp byte[esi-1], '!' |
- | |
569 | jne .notmy |
- | |
570 | - | ||
571 | ; yes, this is my nick, set to new |
- | |
572 | pop esi |
- | |
573 | or ecx, -1 |
- | |
574 | mov edi, esi |
- | |
575 | xor eax, eax |
- | |
576 | repne scasb |
- | |
577 | neg ecx |
- | |
578 | cmp ecx, MAX_NICK_LEN |
- | |
579 | jb @f |
- | |
580 | mov ecx, MAX_NICK_LEN |
- | |
581 | @@: |
- | |
582 | mov edi, user_nick |
- | |
583 | rep movsb |
- | |
584 | .notmy: |
- | |
585 | - | ||
586 | ; replace nick in all lists of users |
- | |
587 | mov ebx, windows |
- | |
588 | .channels: |
556 | cmd_nick: |
589 | mov esi, [ebx + window.data_ptr] |
557 | |
590 | lea esi, [esi + window_data.names] |
- | |
591 | ;;;;; mov edx, [esi + window_data.nameslen] |
- | |
592 | add edx, esi |
- | |
593 | .nicks: |
- | |
594 | mov edi, servercommand+1 |
- | |
595 | cmp byte[esi], '@' |
558 | add esi, 5 ; skip 'NICK ' |
596 | jne @f |
- | |
597 | inc esi |
- | |
598 | - | ||
599 | @@: |
- | |
600 | cmp esi, edx |
- | |
601 | jae .srcdone |
- | |
602 | lodsb |
- | |
603 | cmp al, ' ' |
- | |
604 | je .srcdone |
- | |
605 | scasb |
- | |
606 | je @b |
- | |
607 | - | ||
Line 608... | Line 559... | ||
608 | @@: |
559 | |
609 | cmp esi, edx |
560 | push esi |
610 | jae .nextchannel |
561 | ; Is it me who changed nick? |
611 | lodsb |
562 | mov edi, servercommand+1 |
- | 563 | call compare_to_nick |
|
- | 564 | jne .not_me |
|
612 | cmp al, ' ' |
565 | |
613 | jne @b |
566 | mov ecx, MAX_NICK_LEN-1 |
614 | - | ||
615 | .nextnick: |
- | |
616 | cmp esi, edx |
- | |
617 | jae .nextchannel |
- | |
618 | lodsb |
- | |
619 | cmp al, ' ' |
- | |
620 | jz .nextnick |
- | |
621 | dec esi |
- | |
622 | jmp .nicks |
- | |
623 | - | ||
624 | - | ||
625 | .srcdone: |
- | |
626 | cmp byte [edi], '!' |
- | |
627 | jne .nextnick |
- | |
628 | 567 | push esi |
|
629 | ; here we have esi -> end of nick which must be replaced to [servercommand_position]+6 |
- | |
630 | lea edx, [edi-servercommand-1] |
568 | .copyloop: |
631 | sub esi, edx |
- | |
632 | or ecx, -1 |
- | |
633 | xor eax, eax |
- | |
634 | ; mov edi, [servercommand_position] ;;;;; FIXME |
569 | lodsb |
635 | repnz scasb |
- | |
636 | not ecx |
- | |
637 | dec ecx |
- | |
638 | push ecx |
- | |
639 | cmp ecx, edx |
- | |
640 | jb .decrease |
- | |
641 | jz .copy |
- | |
642 | .increase: |
- | |
643 | - | ||
644 | ; new nick is longer than the old |
- | |
645 | push esi |
- | |
646 | lea edi, [ebx+120*10] ;;;;;; |
- | |
647 | lea esi, [edi+edx] |
- | |
648 | sub esi, ecx |
- | |
649 | mov ecx, esi |
- | |
650 | sub ecx, [esp] |
- | |
651 | dec esi |
- | |
652 | dec edi |
- | |
653 | std |
- | |
654 | rep movsb |
- | |
655 | cld |
- | |
656 | pop esi |
- | |
657 | jmp .copy |
- | |
658 | .decrease: |
- | |
659 | ; new nick is shorter than the old |
- | |
660 | push esi |
570 | test al, al |
661 | lea edi, [esi+ecx] |
- | |
662 | add esi, edx |
- | |
663 | lea ecx, [ebx+120*10] |
- | |
664 | sub ecx, edi |
- | |
665 | rep movsb |
- | |
666 | pop esi |
- | |
667 | .copy: |
- | |
668 | ; copy nick |
- | |
669 | mov edi, esi |
571 | jz .copydone |
670 | dec edi |
572 | cmp al, ' ' |
- | 573 | je .copydone |
|
Line 671... | Line 574... | ||
671 | ; mov esi, [servercommand_position] ;;;;; FIXME |
574 | stosb |
672 | pop ecx |
- | |
673 | sub edx, ecx |
- | |
674 | sub [ebx-4], edx |
- | |
Line 675... | Line 575... | ||
675 | rep movsb |
575 | dec ecx |
676 | mov al, ' ' |
- | |
Line -... | Line 576... | ||
- | 576 | jnz .copyloop |
|
677 | stosb |
577 | .copydone: |
678 | 578 | xor al, al |
|
Line 679... | Line 579... | ||
679 | .nextchannel: |
579 | stosb |
680 | add ebx, sizeof.window |
580 | pop esi |
681 | cmp ebx, windows + sizeof.window*MAX_WINDOWS |
581 | |
Line 682... | Line 582... | ||
682 | jb .channels |
582 | .not_me: |
683 | 583 | ||
Line 684... | Line 584... | ||
684 | ; mov [text_start], window_text + 120*80 |
584 | ; TODO: if we reach here: change nick in userlist(s) |
685 | new_all_channels3: |
585 | |
Line 686... | Line -... | ||
686 | - | ||
687 | mov esi, action_header_short |
- | |
688 | call print_text2 |
- | |
689 | - | ||
690 | mov eax, servercommand+1 |
586 | push esi |
691 | mov dl,'!' |
- | |
692 | call print_text |
587 | mov esi, action_header_short |
Line 693... | Line 588... | ||
693 | 588 | call print_text2 |
|
Line 733... | Line 628... | ||
733 | call print_text2 |
628 | call print_text2 |
Line 734... | Line 629... | ||
734 | 629 | ||
735 | pop esi |
630 | pop esi |
Line -... | Line 631... | ||
- | 631 | call print_text2 |
|
- | 632 | ||
- | 633 | mov esi, str_newline |
|
736 | call print_text2 |
634 | call print_text2 |
Line 737... | Line 635... | ||
737 | 635 | ||
Line 787... | Line 685... | ||
787 | 685 | ||
Line 788... | Line 686... | ||
788 | cmd_353: ; channel usernames reply |
686 | cmd_353: ; channel usernames reply |
Line 789... | Line -... | ||
789 | - | ||
790 | add esi, 4 ; skip '353 ' |
- | |
791 | 687 | ||
792 | ; TODO: mark a bit that we are receiving names |
688 | add esi, 4 ; skip '353 ' |
793 | 689 | ||
794 | ; first, find the channel name |
690 | ; first, find the channel name |
795 | .loop1: |
691 | .loop1: |
796 | lodsb |
692 | lodsb |
797 | cmp al, '#' |
693 | cmp al, '#' |
798 | je .got_channel |
- | |
799 | test al, al |
694 | je .got_channel |
Line 800... | Line 695... | ||
800 | jnz .loop1 |
695 | test al, al |
801 | - | ||
802 | ret |
- | |
803 | - | ||
804 | .got_channel: |
- | |
805 | ; call find_channel ;;;; ASSUME current channel for now |
- | |
806 | mov ebx, [window_print] |
- | |
Line 807... | Line 696... | ||
807 | mov [ebx + window.users], 0 ;;; FIXME: Only if we have just set the receiving names bit |
696 | jnz .loop1 |
808 | mov eax, [ebx + window.data_ptr] |
697 | ret |
809 | lea edi, [eax + window_data.names] |
698 | |
810 | mov edx, edi |
699 | .got_channel: |
811 | 700 | ||
812 | ; now find the semicolon separating channelname and usernames |
701 | ; now find the semicolon separating channelname and usernames |
813 | .loop2: |
702 | .loop2: |
814 | lodsb |
- | |
815 | cmp al, ':' |
703 | lodsb |
Line -... | Line 704... | ||
- | 704 | cmp al, ':' |
|
- | 705 | je .got_list |
|
- | 706 | test al, al |
|
- | 707 | jnz .loop2 |
|
- | 708 | ret |
|
- | 709 | ||
- | 710 | .got_list: |
|
- | 711 | ||
- | 712 | ; now find window ptr and check if this is the first 353 message |
|
- | 713 | mov ebx, [window_print] |
|
816 | je .newname |
714 | test [ebx + window.flags], FLAG_RECEIVING_NAMES |
- | 715 | jnz .start |
|
- | 716 | ||
817 | test al, al |
717 | or [ebx + window.flags], FLAG_RECEIVING_NAMES |
- | 718 | mov [ebx + window.users], 0 |
|
- | 719 | ||
- | 720 | .start: |
|
- | 721 | mov eax, [ebx + window.users] |
|
818 | jnz .loop2 |
722 | xor edx, edx |
- | 723 | mov ecx, MAX_NICK_LEN |
|
819 | 724 | mul ecx |
|
- | 725 | ; eax is now offset |
|
Line 820... | Line 726... | ||
820 | ret |
726 | add eax, [ebx + window.data_ptr] |
- | 727 | lea edi, [eax + window_data.names] |
|
- | 728 | mov edx, edi |
|
821 | 729 | ||
822 | .next: |
730 | lea ecx, [eax + window_data.names] |
823 | add edx, MAX_NICK_LEN |
- | |
824 | mov edi, edx |
731 | add ecx, MAX_NICK_LEN + MAX_USERS |
825 | ;;; cmp edi, .. ; TODO: Check for buffer overflow |
732 | |
826 | 733 | .newname: |
|
827 | .newname: |
734 | cmp edi, ecx ; check buffer overflow |
828 | inc [ebx + window.users] |
735 | jae .done |
829 | .namesloop: |
736 | inc [ebx + window.users] |
830 | ; now the names list begins, separated with spaces |
737 | .namesloop: |
- | 738 | lodsb |
|
- | 739 | test al, al |
|
- | 740 | jz .done |
|
- | 741 | cmp al, ' ' ; names list is separated with spaces |
|
- | 742 | je .next |
|
- | 743 | stosb |
|
- | 744 | jmp .namesloop |
|
- | 745 | .next: |
|
- | 746 | add edx, MAX_NICK_LEN |
|
- | 747 | mov edi, edx |
|
- | 748 | .loop3: |
|
Line 831... | Line 749... | ||
831 | lodsb |
749 | lodsb |
832 | test al, al |
- | |
833 | jz .done |
750 | test al, al |
Line 834... | Line 751... | ||
834 | cmp al, ' ' |
751 | jz .done |
Line 835... | Line 752... | ||
835 | jz .next |
752 | cmp al, ' ' |
Line 836... | Line 753... | ||
836 | stosb |
753 | je .loop3 |
- | 754 | stosb |
|
Line 837... | Line 755... | ||
837 | jmp .namesloop |
755 | jmp .newname |