diff options
Diffstat (limited to 'linden/indra/newview/llstartup.cpp')
-rw-r--r-- | linden/indra/newview/llstartup.cpp | 663 |
1 files changed, 306 insertions, 357 deletions
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 7c76634..3f02f6a 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp | |||
@@ -64,7 +64,7 @@ | |||
64 | #include "llsecondlifeurls.h" | 64 | #include "llsecondlifeurls.h" |
65 | #include "llstring.h" | 65 | #include "llstring.h" |
66 | #include "lluserrelations.h" | 66 | #include "lluserrelations.h" |
67 | #include "llversion.h" | 67 | #include "llversionviewer.h" |
68 | #include "llvfs.h" | 68 | #include "llvfs.h" |
69 | #include "llwindow.h" // for shell_open | 69 | #include "llwindow.h" // for shell_open |
70 | #include "llxorcipher.h" // saved password, MAC address | 70 | #include "llxorcipher.h" // saved password, MAC address |
@@ -216,6 +216,9 @@ LLString gInitialOutfitGender; // "male" or "female" | |||
216 | 216 | ||
217 | static bool gUseCircuitCallbackCalled = false; | 217 | static bool gUseCircuitCallbackCalled = false; |
218 | 218 | ||
219 | S32 LLStartUp::gStartupState = STATE_FIRST; | ||
220 | |||
221 | |||
219 | // | 222 | // |
220 | // local function declaration | 223 | // local function declaration |
221 | // | 224 | // |
@@ -356,7 +359,7 @@ BOOL idle_startup() | |||
356 | gImageList.updateImages(0.01f); | 359 | gImageList.updateImages(0.01f); |
357 | } | 360 | } |
358 | 361 | ||
359 | if (STATE_FIRST == gStartupState) | 362 | if ( STATE_FIRST == LLStartUp::getStartupState() ) |
360 | { | 363 | { |
361 | gViewerWindow->showCursor(); | 364 | gViewerWindow->showCursor(); |
362 | gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT); | 365 | gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT); |
@@ -565,10 +568,7 @@ BOOL idle_startup() | |||
565 | #endif // LL_LINUX | 568 | #endif // LL_LINUX |
566 | 569 | ||
567 | std::ostringstream codec; | 570 | std::ostringstream codec; |
568 | codec << "[Second Life "; | 571 | codec << "[Second Life " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << "." << LL_VERSION_BUILD << "]"; |
569 | codec << "(" << gChannelName << ")"; | ||
570 | codec << " - " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << "." << LL_VERSION_BUILD; | ||
571 | codec << "]"; | ||
572 | LLMozLib::getInstance()->setBrowserAgentId( codec.str() ); | 572 | LLMozLib::getInstance()->setBrowserAgentId( codec.str() ); |
573 | #endif | 573 | #endif |
574 | 574 | ||
@@ -608,67 +608,49 @@ BOOL idle_startup() | |||
608 | llwarns << "Unreliable timers detected (may be bad PCI chipset)!!" << llendl; | 608 | llwarns << "Unreliable timers detected (may be bad PCI chipset)!!" << llendl; |
609 | } | 609 | } |
610 | 610 | ||
611 | // Get ready to show the login dialog | 611 | // |
612 | if (!gConnectToSomething) | 612 | // Log on to system |
613 | // | ||
614 | if( !gCmdLineFirstName.empty() | ||
615 | && !gCmdLineLastName.empty() | ||
616 | && !gCmdLinePassword.empty()) | ||
613 | { | 617 | { |
614 | // Don't use a session token, and generate a random user id | 618 | firstname = gCmdLineFirstName; |
615 | gAgentID.generate(); | 619 | lastname = gCmdLineLastName; |
616 | gAgentSessionID = LLUUID::null; | ||
617 | 620 | ||
618 | gStartupState = STATE_WORLD_INIT; | 621 | LLMD5 pass((unsigned char*)gCmdLinePassword.c_str()); |
619 | return do_normal_idle; | 622 | char md5pass[33]; /* Flawfinder: ignore */ |
623 | pass.hex_digest(md5pass); | ||
624 | password = md5pass; | ||
625 | |||
626 | remember_password = gSavedSettings.getBOOL("RememberPassword"); | ||
627 | show_connect_box = FALSE; | ||
620 | } | 628 | } |
621 | else if (!gRunLocal) | 629 | else if (gAutoLogin || gSavedSettings.getBOOL("AutoLogin")) |
622 | { | 630 | { |
623 | // | 631 | firstname = gSavedSettings.getString("FirstName"); |
624 | // Log on to userserver | 632 | lastname = gSavedSettings.getString("LastName"); |
625 | // | 633 | password = load_password_from_disk(); |
626 | if( !gCmdLineFirstName.empty() | 634 | remember_password = TRUE; |
627 | && !gCmdLineLastName.empty() | 635 | show_connect_box = FALSE; |
628 | && !gCmdLinePassword.empty()) | ||
629 | { | ||
630 | firstname = gCmdLineFirstName; | ||
631 | lastname = gCmdLineLastName; | ||
632 | |||
633 | LLMD5 pass((unsigned char*)gCmdLinePassword.c_str()); | ||
634 | char md5pass[33]; /* Flawfinder: ignore */ | ||
635 | pass.hex_digest(md5pass); | ||
636 | password = md5pass; | ||
637 | |||
638 | remember_password = gSavedSettings.getBOOL("RememberPassword"); | ||
639 | show_connect_box = FALSE; | ||
640 | } | ||
641 | else if (gAutoLogin || gSavedSettings.getBOOL("AutoLogin")) | ||
642 | { | ||
643 | firstname = gSavedSettings.getString("FirstName"); | ||
644 | lastname = gSavedSettings.getString("LastName"); | ||
645 | password = load_password_from_disk(); | ||
646 | remember_password = TRUE; | ||
647 | show_connect_box = FALSE; | ||
648 | } | ||
649 | else | ||
650 | { | ||
651 | // if not automatically logging in, display login dialog | ||
652 | // until a valid userserver is selected | ||
653 | firstname = gSavedSettings.getString("FirstName"); | ||
654 | lastname = gSavedSettings.getString("LastName"); | ||
655 | password = load_password_from_disk(); | ||
656 | remember_password = gSavedSettings.getBOOL("RememberPassword"); | ||
657 | show_connect_box = TRUE; | ||
658 | } | ||
659 | |||
660 | // Go to the next startup state | ||
661 | gStartupState++; | ||
662 | return do_normal_idle; | ||
663 | } | 636 | } |
664 | else | 637 | else |
665 | { | 638 | { |
666 | gStartupState++; | 639 | // if not automatically logging in, display login dialog |
667 | return do_normal_idle; | 640 | // until a valid userserver is selected |
641 | firstname = gSavedSettings.getString("FirstName"); | ||
642 | lastname = gSavedSettings.getString("LastName"); | ||
643 | password = load_password_from_disk(); | ||
644 | remember_password = gSavedSettings.getBOOL("RememberPassword"); | ||
645 | show_connect_box = TRUE; | ||
668 | } | 646 | } |
647 | |||
648 | // Go to the next startup state | ||
649 | LLStartUp::setStartupState( STATE_LOGIN_SHOW ); | ||
650 | return do_normal_idle; | ||
669 | } | 651 | } |
670 | 652 | ||
671 | if (STATE_LOGIN_SHOW == gStartupState) | 653 | if (STATE_LOGIN_SHOW == LLStartUp::getStartupState()) |
672 | { | 654 | { |
673 | llinfos << "Initializing Window" << llendl; | 655 | llinfos << "Initializing Window" << llendl; |
674 | 656 | ||
@@ -678,45 +660,37 @@ BOOL idle_startup() | |||
678 | 660 | ||
679 | timeout_count = 0; | 661 | timeout_count = 0; |
680 | 662 | ||
681 | if (gConnectToSomething && !gRunLocal) | 663 | if (show_connect_box) |
682 | { | 664 | { |
683 | if (show_connect_box) | 665 | if (gNoRender) |
684 | { | 666 | { |
685 | if (gNoRender) | 667 | llerrs << "Need to autologin or use command line with norender!" << llendl; |
686 | { | 668 | } |
687 | llerrs << "Need to autologin or use command line with norender!" << llendl; | 669 | // Make sure the process dialog doesn't hide things |
688 | } | 670 | gViewerWindow->setShowProgress(FALSE); |
689 | // Make sure the process dialog doesn't hide things | ||
690 | gViewerWindow->setShowProgress(FALSE); | ||
691 | 671 | ||
692 | // Show the login dialog | 672 | // Show the login dialog |
693 | login_show(); | 673 | login_show(); |
694 | 674 | ||
695 | // connect dialog is already shown, so fill in the names | 675 | // connect dialog is already shown, so fill in the names |
696 | LLPanelLogin::setFields( firstname, lastname, password, remember_password ); | 676 | LLPanelLogin::setFields( firstname, lastname, password, remember_password ); |
697 | LLPanelLogin::giveFocus(); | 677 | LLPanelLogin::giveFocus(); |
698 | 678 | ||
699 | gSavedSettings.setBOOL("FirstRunThisInstall", FALSE); | 679 | gSavedSettings.setBOOL("FirstRunThisInstall", FALSE); |
700 | 680 | ||
701 | gStartupState++; | 681 | LLStartUp::setStartupState( STATE_LOGIN_WAIT ); // Wait for user input |
702 | } | ||
703 | else | ||
704 | { | ||
705 | // skip directly to message template verification | ||
706 | gStartupState = STATE_LOGIN_CLEANUP; | ||
707 | } | ||
708 | } | 682 | } |
709 | else | 683 | else |
710 | { | 684 | { |
711 | gMessageSystem->setCircuitProtection(FALSE); | 685 | // skip directly to message template verification |
712 | gStartupState = STATE_LOGIN_CLEANUP; | 686 | LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); |
713 | } | 687 | } |
714 | 688 | ||
715 | timeout.reset(); | 689 | timeout.reset(); |
716 | return do_normal_idle; | 690 | return do_normal_idle; |
717 | } | 691 | } |
718 | 692 | ||
719 | if (STATE_LOGIN_WAIT == gStartupState) | 693 | if (STATE_LOGIN_WAIT == LLStartUp::getStartupState()) |
720 | { | 694 | { |
721 | // Don't do anything. Wait for the login view to call the login_callback, | 695 | // Don't do anything. Wait for the login view to call the login_callback, |
722 | // which will push us to the next state. | 696 | // which will push us to the next state. |
@@ -726,7 +700,7 @@ BOOL idle_startup() | |||
726 | return do_normal_idle; | 700 | return do_normal_idle; |
727 | } | 701 | } |
728 | 702 | ||
729 | if (STATE_LOGIN_CLEANUP == gStartupState) | 703 | if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState()) |
730 | { | 704 | { |
731 | if (show_connect_box) | 705 | if (show_connect_box) |
732 | { | 706 | { |
@@ -794,7 +768,7 @@ BOOL idle_startup() | |||
794 | { | 768 | { |
795 | LLString server_label; | 769 | LLString server_label; |
796 | S32 domain_name_index; | 770 | S32 domain_name_index; |
797 | LLPanelLogin::getServer( server_label, domain_name_index ); | 771 | BOOL user_picked_server = LLPanelLogin::getServer( server_label, domain_name_index ); |
798 | gUserServerChoice = (EUserServerDomain) domain_name_index; | 772 | gUserServerChoice = (EUserServerDomain) domain_name_index; |
799 | gSavedSettings.setS32("ServerChoice", gUserServerChoice); | 773 | gSavedSettings.setS32("ServerChoice", gUserServerChoice); |
800 | if (gUserServerChoice == USERSERVER_OTHER) | 774 | if (gUserServerChoice == USERSERVER_OTHER) |
@@ -802,14 +776,11 @@ BOOL idle_startup() | |||
802 | snprintf(gUserServerName, MAX_STRING, "%s", server_label.c_str()); /* Flawfinder: ignore */ | 776 | snprintf(gUserServerName, MAX_STRING, "%s", server_label.c_str()); /* Flawfinder: ignore */ |
803 | } | 777 | } |
804 | 778 | ||
805 | // Dave S temp reversion of SL-49082 fix - this code breaks command line urls. I'll fix this with | 779 | if ( user_picked_server ) |
806 | // the control isDirty() functionality tomorrow. | 780 | { // User picked a grid from the popup, so clear the stored urls and they will be re-generated from gUserServerChoice |
807 | 781 | auth_uris.clear(); | |
808 | //if ( userPickedServer ) | 782 | resetURIs(); |
809 | //{ // User picked a grid from the popup, so clear the stored urls so they will be re-generated from gUserServerChoice | 783 | } |
810 | // auth_uris.clear(); | ||
811 | // resetURIs(); | ||
812 | //} | ||
813 | 784 | ||
814 | LLString location; | 785 | LLString location; |
815 | LLPanelLogin::getLocation( location ); | 786 | LLPanelLogin::getLocation( location ); |
@@ -872,18 +843,18 @@ BOOL idle_startup() | |||
872 | init_colors(); | 843 | init_colors(); |
873 | 844 | ||
874 | // skipping over STATE_UPDATE_CHECK because that just waits for input | 845 | // skipping over STATE_UPDATE_CHECK because that just waits for input |
875 | gStartupState = STATE_LOGIN_AUTH_INIT; | 846 | LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); |
876 | 847 | ||
877 | return do_normal_idle; | 848 | return do_normal_idle; |
878 | } | 849 | } |
879 | 850 | ||
880 | if (STATE_UPDATE_CHECK == gStartupState) | 851 | if (STATE_UPDATE_CHECK == LLStartUp::getStartupState()) |
881 | { | 852 | { |
882 | // wait for user to give input via dialog box | 853 | // wait for user to give input via dialog box |
883 | return do_normal_idle; | 854 | return do_normal_idle; |
884 | } | 855 | } |
885 | 856 | ||
886 | if(STATE_LOGIN_AUTH_INIT == gStartupState) | 857 | if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState()) |
887 | { | 858 | { |
888 | //#define LL_MINIMIAL_REQUESTED_OPTIONS | 859 | //#define LL_MINIMIAL_REQUESTED_OPTIONS |
889 | lldebugs << "STATE_LOGIN_AUTH_INIT" << llendl; | 860 | lldebugs << "STATE_LOGIN_AUTH_INIT" << llendl; |
@@ -930,10 +901,10 @@ BOOL idle_startup() | |||
930 | auth_desc = "Logging in. "; | 901 | auth_desc = "Logging in. "; |
931 | auth_desc += gSecondLife; | 902 | auth_desc += gSecondLife; |
932 | auth_desc += " may appear frozen. Please wait."; | 903 | auth_desc += " may appear frozen. Please wait."; |
933 | ++gStartupState; | 904 | LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); |
934 | } | 905 | } |
935 | 906 | ||
936 | if (STATE_LOGIN_AUTHENTICATE == gStartupState) | 907 | if (STATE_LOGIN_AUTHENTICATE == LLStartUp::getStartupState()) |
937 | { | 908 | { |
938 | lldebugs << "STATE_LOGIN_AUTHENTICATE" << llendl; | 909 | lldebugs << "STATE_LOGIN_AUTHENTICATE" << llendl; |
939 | set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); | 910 | set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); |
@@ -985,11 +956,11 @@ BOOL idle_startup() | |||
985 | // reset globals | 956 | // reset globals |
986 | gAcceptTOS = FALSE; | 957 | gAcceptTOS = FALSE; |
987 | gAcceptCriticalMessage = FALSE; | 958 | gAcceptCriticalMessage = FALSE; |
988 | ++gStartupState; | 959 | LLStartUp::setStartupState( STATE_LOGIN_NO_DATA_YET ); |
989 | return do_normal_idle; | 960 | return do_normal_idle; |
990 | } | 961 | } |
991 | 962 | ||
992 | if(STATE_LOGIN_NO_DATA_YET == gStartupState) | 963 | if(STATE_LOGIN_NO_DATA_YET == LLStartUp::getStartupState()) |
993 | { | 964 | { |
994 | //lldebugs << "STATE_LOGIN_NO_DATA_YET" << llendl; | 965 | //lldebugs << "STATE_LOGIN_NO_DATA_YET" << llendl; |
995 | if (!gUserAuthp) | 966 | if (!gUserAuthp) |
@@ -1008,13 +979,13 @@ BOOL idle_startup() | |||
1008 | //llinfos << "waiting..." << llendl; | 979 | //llinfos << "waiting..." << llendl; |
1009 | return do_normal_idle; | 980 | return do_normal_idle; |
1010 | } | 981 | } |
1011 | ++gStartupState; | 982 | LLStartUp::setStartupState( STATE_LOGIN_DOWNLOADING ); |
1012 | progress += 0.01f; | 983 | progress += 0.01f; |
1013 | set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); | 984 | set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); |
1014 | return do_normal_idle; | 985 | return do_normal_idle; |
1015 | } | 986 | } |
1016 | 987 | ||
1017 | if(STATE_LOGIN_DOWNLOADING == gStartupState) | 988 | if(STATE_LOGIN_DOWNLOADING == LLStartUp::getStartupState()) |
1018 | { | 989 | { |
1019 | lldebugs << "STATE_LOGIN_DOWNLOADING" << llendl; | 990 | lldebugs << "STATE_LOGIN_DOWNLOADING" << llendl; |
1020 | if (!gUserAuthp) | 991 | if (!gUserAuthp) |
@@ -1033,13 +1004,13 @@ BOOL idle_startup() | |||
1033 | //llinfos << "downloading..." << llendl; | 1004 | //llinfos << "downloading..." << llendl; |
1034 | return do_normal_idle; | 1005 | return do_normal_idle; |
1035 | } | 1006 | } |
1036 | ++gStartupState; | 1007 | LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE ); |
1037 | progress += 0.01f; | 1008 | progress += 0.01f; |
1038 | set_startup_status(progress, "Processing Response...", auth_message.c_str()); | 1009 | set_startup_status(progress, "Processing Response...", auth_message.c_str()); |
1039 | return do_normal_idle; | 1010 | return do_normal_idle; |
1040 | } | 1011 | } |
1041 | 1012 | ||
1042 | if(STATE_LOGIN_PROCESS_RESPONSE == gStartupState) | 1013 | if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState()) |
1043 | { | 1014 | { |
1044 | lldebugs << "STATE_LOGIN_PROCESS_RESPONSE" << llendl; | 1015 | lldebugs << "STATE_LOGIN_PROCESS_RESPONSE" << llendl; |
1045 | std::ostringstream emsg; | 1016 | std::ostringstream emsg; |
@@ -1078,7 +1049,7 @@ BOOL idle_startup() | |||
1078 | } | 1049 | } |
1079 | // ignoring the duration & options array for now. | 1050 | // ignoring the duration & options array for now. |
1080 | // Go back to authenticate. | 1051 | // Go back to authenticate. |
1081 | gStartupState = STATE_LOGIN_AUTHENTICATE; | 1052 | LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); |
1082 | return do_normal_idle; | 1053 | return do_normal_idle; |
1083 | } | 1054 | } |
1084 | else | 1055 | else |
@@ -1101,7 +1072,7 @@ BOOL idle_startup() | |||
1101 | if (show_connect_box) | 1072 | if (show_connect_box) |
1102 | { | 1073 | { |
1103 | llinfos << "Need tos agreement" << llendl; | 1074 | llinfos << "Need tos agreement" << llendl; |
1104 | gStartupState = STATE_UPDATE_CHECK; | 1075 | LLStartUp::setStartupState( STATE_UPDATE_CHECK ); |
1105 | LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS, | 1076 | LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS, |
1106 | message_response); | 1077 | message_response); |
1107 | tos_dialog->startModal(); | 1078 | tos_dialog->startModal(); |
@@ -1118,7 +1089,7 @@ BOOL idle_startup() | |||
1118 | if (show_connect_box) | 1089 | if (show_connect_box) |
1119 | { | 1090 | { |
1120 | llinfos << "Need critical message" << llendl; | 1091 | llinfos << "Need critical message" << llendl; |
1121 | gStartupState = STATE_UPDATE_CHECK; | 1092 | LLStartUp::setStartupState( STATE_UPDATE_CHECK ); |
1122 | LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_CRITICAL_MESSAGE, | 1093 | LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_CRITICAL_MESSAGE, |
1123 | message_response); | 1094 | message_response); |
1124 | tos_dialog->startModal(); | 1095 | tos_dialog->startModal(); |
@@ -1142,7 +1113,7 @@ BOOL idle_startup() | |||
1142 | if (show_connect_box) | 1113 | if (show_connect_box) |
1143 | { | 1114 | { |
1144 | update_app(TRUE, auth_message); | 1115 | update_app(TRUE, auth_message); |
1145 | gStartupState = STATE_UPDATE_CHECK; | 1116 | LLStartUp::setStartupState( STATE_UPDATE_CHECK ); |
1146 | return FALSE; | 1117 | return FALSE; |
1147 | } | 1118 | } |
1148 | else | 1119 | else |
@@ -1157,7 +1128,7 @@ BOOL idle_startup() | |||
1157 | if (show_connect_box) | 1128 | if (show_connect_box) |
1158 | { | 1129 | { |
1159 | update_app(FALSE, auth_message); | 1130 | update_app(FALSE, auth_message); |
1160 | gStartupState = STATE_UPDATE_CHECK; | 1131 | LLStartUp::setStartupState( STATE_UPDATE_CHECK ); |
1161 | gSkipOptionalUpdate = TRUE; | 1132 | gSkipOptionalUpdate = TRUE; |
1162 | return FALSE; | 1133 | return FALSE; |
1163 | } | 1134 | } |
@@ -1180,7 +1151,7 @@ BOOL idle_startup() | |||
1180 | s << "Previous login attempt failed. Logging in, attempt " | 1151 | s << "Previous login attempt failed. Logging in, attempt " |
1181 | << (auth_uri_num + 1) << ". "; | 1152 | << (auth_uri_num + 1) << ". "; |
1182 | auth_desc = s.str(); | 1153 | auth_desc = s.str(); |
1183 | gStartupState = STATE_LOGIN_AUTHENTICATE; | 1154 | LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); |
1184 | auth_uri_num++; | 1155 | auth_uri_num++; |
1185 | return do_normal_idle; | 1156 | return do_normal_idle; |
1186 | } | 1157 | } |
@@ -1410,7 +1381,7 @@ BOOL idle_startup() | |||
1410 | && first_sim.isOk() | 1381 | && first_sim.isOk() |
1411 | && gAgent.mInventoryRootID.notNull()) | 1382 | && gAgent.mInventoryRootID.notNull()) |
1412 | { | 1383 | { |
1413 | ++gStartupState; | 1384 | LLStartUp::setStartupState( STATE_WORLD_INIT ); |
1414 | } | 1385 | } |
1415 | else | 1386 | else |
1416 | { | 1387 | { |
@@ -1454,7 +1425,7 @@ BOOL idle_startup() | |||
1454 | //--------------------------------------------------------------------- | 1425 | //--------------------------------------------------------------------- |
1455 | // World Init | 1426 | // World Init |
1456 | //--------------------------------------------------------------------- | 1427 | //--------------------------------------------------------------------- |
1457 | if (STATE_WORLD_INIT == gStartupState) | 1428 | if (STATE_WORLD_INIT == LLStartUp::getStartupState()) |
1458 | { | 1429 | { |
1459 | set_startup_status(0.40f, "Initializing World...", gAgent.mMOTD.c_str()); | 1430 | set_startup_status(0.40f, "Initializing World...", gAgent.mMOTD.c_str()); |
1460 | display_startup(); | 1431 | display_startup(); |
@@ -1497,38 +1468,26 @@ BOOL idle_startup() | |||
1497 | // User might have overridden far clip | 1468 | // User might have overridden far clip |
1498 | gWorldp->setLandFarClip( gAgent.mDrawDistance ); | 1469 | gWorldp->setLandFarClip( gAgent.mDrawDistance ); |
1499 | 1470 | ||
1500 | if (!gRunLocal) | 1471 | // Before we create the first region, we need to set the agent's mOriginGlobal |
1501 | { | 1472 | // This is necessary because creating objects before this is set will result in a |
1502 | // Before we create the first region, we need to set the agent's mOriginGlobal | 1473 | // bad mPositionAgent cache. |
1503 | // This is necessary because creating objects before this is set will result in a | ||
1504 | // bad mPositionAgent cache. | ||
1505 | 1474 | ||
1506 | gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); | 1475 | gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); |
1507 | 1476 | ||
1508 | gWorldp->addRegion(first_sim_handle, first_sim); | 1477 | gWorldp->addRegion(first_sim_handle, first_sim); |
1509 | 1478 | ||
1510 | LLViewerRegion *regionp = gWorldp->getRegionFromHandle(first_sim_handle); | 1479 | LLViewerRegion *regionp = gWorldp->getRegionFromHandle(first_sim_handle); |
1511 | llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl; | 1480 | llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl; |
1512 | 1481 | ||
1513 | gStartupState = STATE_SEED_GRANTED_WAIT; | 1482 | LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT ); |
1514 | regionp->setSeedCapability(first_sim_seed_cap); | 1483 | regionp->setSeedCapability(first_sim_seed_cap); |
1515 | 1484 | ||
1516 | // Set agent's initial region to be the one we just created. | 1485 | // Set agent's initial region to be the one we just created. |
1517 | gAgent.setRegion(regionp); | 1486 | gAgent.setRegion(regionp); |
1518 | 1487 | ||
1519 | // Set agent's initial position, which will be read by LLVOAvatar when the avatar | 1488 | // Set agent's initial position, which will be read by LLVOAvatar when the avatar |
1520 | // object is created. I think this must be done after setting the region. JC | 1489 | // object is created. I think this must be done after setting the region. JC |
1521 | gAgent.setPositionAgent(agent_start_position_region); | 1490 | gAgent.setPositionAgent(agent_start_position_region); |
1522 | } | ||
1523 | else | ||
1524 | { | ||
1525 | // With one simulator, assume region is at 0,0, hence has regionHandle 0 | ||
1526 | // VEFFECT: Login | ||
1527 | gWorldp->addRegion(0, gAgentSimHost); | ||
1528 | gAgent.setRegion(gWorldp->getRegionFromHandle(0)); | ||
1529 | |||
1530 | gStartupState = STATE_SEED_CAP_GRANTED; | ||
1531 | } | ||
1532 | 1491 | ||
1533 | display_startup(); | 1492 | display_startup(); |
1534 | return do_normal_idle; | 1493 | return do_normal_idle; |
@@ -1538,7 +1497,7 @@ BOOL idle_startup() | |||
1538 | //--------------------------------------------------------------------- | 1497 | //--------------------------------------------------------------------- |
1539 | // Wait for Seed Cap Grant | 1498 | // Wait for Seed Cap Grant |
1540 | //--------------------------------------------------------------------- | 1499 | //--------------------------------------------------------------------- |
1541 | if(STATE_SEED_GRANTED_WAIT == gStartupState) | 1500 | if(STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) |
1542 | { | 1501 | { |
1543 | llinfos << "Waiting for seed grant ...." << llendl; | 1502 | llinfos << "Waiting for seed grant ...." << llendl; |
1544 | return do_normal_idle; | 1503 | return do_normal_idle; |
@@ -1549,7 +1508,7 @@ BOOL idle_startup() | |||
1549 | // Seed Capability Granted | 1508 | // Seed Capability Granted |
1550 | // no newMessage calls should happen before this point | 1509 | // no newMessage calls should happen before this point |
1551 | //--------------------------------------------------------------------- | 1510 | //--------------------------------------------------------------------- |
1552 | if (STATE_SEED_CAP_GRANTED == gStartupState) | 1511 | if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState()) |
1553 | { | 1512 | { |
1554 | update_texture_fetch(); | 1513 | update_texture_fetch(); |
1555 | 1514 | ||
@@ -1682,42 +1641,35 @@ BOOL idle_startup() | |||
1682 | // For all images pre-loaded into viewer cache, decode them. | 1641 | // For all images pre-loaded into viewer cache, decode them. |
1683 | // Need to do this AFTER we init the sky | 1642 | // Need to do this AFTER we init the sky |
1684 | gImageList.decodeAllImages(2.f); | 1643 | gImageList.decodeAllImages(2.f); |
1685 | gStartupState++; | 1644 | LLStartUp::setStartupState( STATE_QUICKTIME_INIT ); |
1686 | 1645 | ||
1687 | // JC - Do this as late as possible to increase likelihood Purify | 1646 | // JC - Do this as late as possible to increase likelihood Purify |
1688 | // will run. | 1647 | // will run. |
1689 | if (!gRunLocal) | 1648 | LLMessageSystem* msg = gMessageSystem; |
1649 | if (!msg->mOurCircuitCode) | ||
1690 | { | 1650 | { |
1691 | LLMessageSystem* msg = gMessageSystem; | 1651 | llwarns << "Attempting to connect to simulator with a zero circuit code!" << llendl; |
1692 | if (!msg->mOurCircuitCode) | ||
1693 | { | ||
1694 | llwarns << "Attempting to connect to simulator with a zero circuit code!" << llendl; | ||
1695 | } | ||
1696 | |||
1697 | gUseCircuitCallbackCalled = FALSE; | ||
1698 | |||
1699 | msg->enableCircuit(first_sim, TRUE); | ||
1700 | // now, use the circuit info to tell simulator about us! | ||
1701 | llinfos << "viewer: UserLoginLocationReply() Enabling " << first_sim << " with code " << msg->mOurCircuitCode << llendl; | ||
1702 | msg->newMessageFast(_PREHASH_UseCircuitCode); | ||
1703 | msg->nextBlockFast(_PREHASH_CircuitCode); | ||
1704 | msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode); | ||
1705 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
1706 | msg->addUUIDFast(_PREHASH_ID, gAgent.getID()); | ||
1707 | msg->sendReliable( | ||
1708 | first_sim, | ||
1709 | MAX_TIMEOUT_COUNT, | ||
1710 | FALSE, | ||
1711 | TIMEOUT_SECONDS, | ||
1712 | use_circuit_callback, | ||
1713 | NULL); | ||
1714 | } | 1652 | } |
1715 | 1653 | ||
1654 | gUseCircuitCallbackCalled = FALSE; | ||
1655 | |||
1656 | msg->enableCircuit(first_sim, TRUE); | ||
1657 | // now, use the circuit info to tell simulator about us! | ||
1658 | llinfos << "viewer: UserLoginLocationReply() Enabling " << first_sim << " with code " << msg->mOurCircuitCode << llendl; | ||
1659 | msg->newMessageFast(_PREHASH_UseCircuitCode); | ||
1660 | msg->nextBlockFast(_PREHASH_CircuitCode); | ||
1661 | msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode); | ||
1662 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
1663 | msg->addUUIDFast(_PREHASH_ID, gAgent.getID()); | ||
1664 | msg->sendReliable( | ||
1665 | first_sim, | ||
1666 | MAX_TIMEOUT_COUNT, | ||
1667 | FALSE, | ||
1668 | TIMEOUT_SECONDS, | ||
1669 | use_circuit_callback, | ||
1670 | NULL); | ||
1671 | |||
1716 | timeout.reset(); | 1672 | timeout.reset(); |
1717 | if (!gConnectToSomething) | ||
1718 | { | ||
1719 | gStartupState = STATE_MISC; | ||
1720 | } | ||
1721 | 1673 | ||
1722 | return do_normal_idle; | 1674 | return do_normal_idle; |
1723 | } | 1675 | } |
@@ -1725,7 +1677,7 @@ BOOL idle_startup() | |||
1725 | //--------------------------------------------------------------------- | 1677 | //--------------------------------------------------------------------- |
1726 | // LLMediaEngine Init | 1678 | // LLMediaEngine Init |
1727 | //--------------------------------------------------------------------- | 1679 | //--------------------------------------------------------------------- |
1728 | if (STATE_QUICKTIME_INIT == gStartupState) | 1680 | if (STATE_QUICKTIME_INIT == LLStartUp::getStartupState()) |
1729 | { | 1681 | { |
1730 | if (gViewerWindow) | 1682 | if (gViewerWindow) |
1731 | { | 1683 | { |
@@ -1760,20 +1712,20 @@ BOOL idle_startup() | |||
1760 | } | 1712 | } |
1761 | #endif | 1713 | #endif |
1762 | 1714 | ||
1763 | gStartupState++; | 1715 | LLStartUp::setStartupState( STATE_WORLD_WAIT ); |
1764 | return do_normal_idle; | 1716 | return do_normal_idle; |
1765 | } | 1717 | } |
1766 | 1718 | ||
1767 | //--------------------------------------------------------------------- | 1719 | //--------------------------------------------------------------------- |
1768 | // Agent Send | 1720 | // Agent Send |
1769 | //--------------------------------------------------------------------- | 1721 | //--------------------------------------------------------------------- |
1770 | if(STATE_WORLD_WAIT == gStartupState) | 1722 | if(STATE_WORLD_WAIT == LLStartUp::getStartupState()) |
1771 | { | 1723 | { |
1772 | //llinfos << "Waiting for simulator ack...." << llendl; | 1724 | //llinfos << "Waiting for simulator ack...." << llendl; |
1773 | set_startup_status(0.49f, "Waiting for region handshake...", gAgent.mMOTD.c_str()); | 1725 | set_startup_status(0.49f, "Waiting for region handshake...", gAgent.mMOTD.c_str()); |
1774 | if(gGotUseCircuitCodeAck) | 1726 | if(gGotUseCircuitCodeAck) |
1775 | { | 1727 | { |
1776 | ++gStartupState; | 1728 | LLStartUp::setStartupState( STATE_AGENT_SEND ); |
1777 | } | 1729 | } |
1778 | LLMessageSystem* msg = gMessageSystem; | 1730 | LLMessageSystem* msg = gMessageSystem; |
1779 | while (msg->checkAllMessages(gFrameCount, gServicePump)) | 1731 | while (msg->checkAllMessages(gFrameCount, gServicePump)) |
@@ -1786,7 +1738,7 @@ BOOL idle_startup() | |||
1786 | //--------------------------------------------------------------------- | 1738 | //--------------------------------------------------------------------- |
1787 | // Agent Send | 1739 | // Agent Send |
1788 | //--------------------------------------------------------------------- | 1740 | //--------------------------------------------------------------------- |
1789 | if (STATE_AGENT_SEND == gStartupState) | 1741 | if (STATE_AGENT_SEND == LLStartUp::getStartupState()) |
1790 | { | 1742 | { |
1791 | llinfos << "Connecting to region..." << llendl; | 1743 | llinfos << "Connecting to region..." << llendl; |
1792 | set_startup_status(0.50f, "Connecting to region...", gAgent.mMOTD.c_str()); | 1744 | set_startup_status(0.50f, "Connecting to region...", gAgent.mMOTD.c_str()); |
@@ -1797,7 +1749,7 @@ BOOL idle_startup() | |||
1797 | _PREHASH_AgentMovementComplete, | 1749 | _PREHASH_AgentMovementComplete, |
1798 | process_agent_movement_complete); | 1750 | process_agent_movement_complete); |
1799 | LLViewerRegion* regionp = gAgent.getRegion(); | 1751 | LLViewerRegion* regionp = gAgent.getRegion(); |
1800 | if(!gRunLocal && regionp) | 1752 | if(regionp) |
1801 | { | 1753 | { |
1802 | send_complete_agent_movement(regionp->getHost()); | 1754 | send_complete_agent_movement(regionp->getHost()); |
1803 | gAssetStorage->setUpstream(regionp->getHost()); | 1755 | gAssetStorage->setUpstream(regionp->getHost()); |
@@ -1805,10 +1757,6 @@ BOOL idle_startup() | |||
1805 | msg->newMessageFast(_PREHASH_EconomyDataRequest); | 1757 | msg->newMessageFast(_PREHASH_EconomyDataRequest); |
1806 | gAgent.sendReliableMessage(); | 1758 | gAgent.sendReliableMessage(); |
1807 | } | 1759 | } |
1808 | else | ||
1809 | { | ||
1810 | gStartupState++; | ||
1811 | } | ||
1812 | 1760 | ||
1813 | // Create login effect | 1761 | // Create login effect |
1814 | // But not on first login, because you can't see your avatar then | 1762 | // But not on first login, because you can't see your avatar then |
@@ -1820,7 +1768,7 @@ BOOL idle_startup() | |||
1820 | gHUDManager->sendEffects(); | 1768 | gHUDManager->sendEffects(); |
1821 | } | 1769 | } |
1822 | 1770 | ||
1823 | gStartupState++; | 1771 | LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT |
1824 | 1772 | ||
1825 | timeout.reset(); | 1773 | timeout.reset(); |
1826 | return do_normal_idle; | 1774 | return do_normal_idle; |
@@ -1829,14 +1777,13 @@ BOOL idle_startup() | |||
1829 | //--------------------------------------------------------------------- | 1777 | //--------------------------------------------------------------------- |
1830 | // Agent Wait | 1778 | // Agent Wait |
1831 | //--------------------------------------------------------------------- | 1779 | //--------------------------------------------------------------------- |
1832 | if (STATE_AGENT_WAIT == gStartupState) | 1780 | if (STATE_AGENT_WAIT == LLStartUp::getStartupState()) |
1833 | { | 1781 | { |
1834 | LLMessageSystem* msg = gMessageSystem; | 1782 | LLMessageSystem* msg = gMessageSystem; |
1835 | while (msg->checkAllMessages(gFrameCount, gServicePump)) | 1783 | while (msg->checkAllMessages(gFrameCount, gServicePump)) |
1836 | { | 1784 | { |
1837 | if (gAgentMovementCompleted) | 1785 | if (gAgentMovementCompleted) |
1838 | { | 1786 | { |
1839 | gStartupState++; | ||
1840 | // Sometimes we have more than one message in the | 1787 | // Sometimes we have more than one message in the |
1841 | // queue. break out of this loop and continue | 1788 | // queue. break out of this loop and continue |
1842 | // processing. If we don't, then this could skip one | 1789 | // processing. If we don't, then this could skip one |
@@ -1850,183 +1797,187 @@ BOOL idle_startup() | |||
1850 | } | 1797 | } |
1851 | } | 1798 | } |
1852 | msg->processAcks(); | 1799 | msg->processAcks(); |
1800 | |||
1801 | if (gAgentMovementCompleted) | ||
1802 | { | ||
1803 | LLStartUp::setStartupState( STATE_INVENTORY_SEND ); | ||
1804 | } | ||
1805 | |||
1853 | return do_normal_idle; | 1806 | return do_normal_idle; |
1854 | } | 1807 | } |
1855 | 1808 | ||
1856 | //--------------------------------------------------------------------- | 1809 | //--------------------------------------------------------------------- |
1857 | // Inventory Send | 1810 | // Inventory Send |
1858 | //--------------------------------------------------------------------- | 1811 | //--------------------------------------------------------------------- |
1859 | if (STATE_INVENTORY_SEND == gStartupState) | 1812 | if (STATE_INVENTORY_SEND == LLStartUp::getStartupState()) |
1860 | { | 1813 | { |
1861 | if (!gUserAuthp) | 1814 | if (!gUserAuthp) |
1862 | { | 1815 | { |
1863 | llerrs << "No userauth in STATE_INVENTORY_SEND!" << llendl; | 1816 | llerrs << "No userauth in STATE_INVENTORY_SEND!" << llendl; |
1864 | } | 1817 | } |
1865 | 1818 | ||
1866 | if (gConnectToSomething && !gRunLocal) | 1819 | // unpack thin inventory |
1820 | LLUserAuth::options_t options; | ||
1821 | options.clear(); | ||
1822 | //bool dump_buffer = false; | ||
1823 | |||
1824 | if(gUserAuthp->getOptions("inventory-lib-root", options) | ||
1825 | && !options.empty()) | ||
1867 | { | 1826 | { |
1868 | // unpack thin inventory | 1827 | // should only be one |
1869 | LLUserAuth::options_t options; | 1828 | LLUserAuth::response_t::iterator it; |
1870 | options.clear(); | 1829 | it = options[0].find("folder_id"); |
1871 | //bool dump_buffer = false; | 1830 | if(it != options[0].end()) |
1872 | |||
1873 | if(gUserAuthp->getOptions("inventory-lib-root", options) | ||
1874 | && !options.empty()) | ||
1875 | { | 1831 | { |
1876 | // should only be one | 1832 | gInventoryLibraryRoot.set((*it).second.c_str()); |
1877 | LLUserAuth::response_t::iterator it; | ||
1878 | it = options[0].find("folder_id"); | ||
1879 | if(it != options[0].end()) | ||
1880 | { | ||
1881 | gInventoryLibraryRoot.set((*it).second.c_str()); | ||
1882 | } | ||
1883 | } | 1833 | } |
1884 | options.clear(); | 1834 | } |
1885 | if(gUserAuthp->getOptions("inventory-lib-owner", options) | 1835 | options.clear(); |
1886 | && !options.empty()) | 1836 | if(gUserAuthp->getOptions("inventory-lib-owner", options) |
1837 | && !options.empty()) | ||
1838 | { | ||
1839 | // should only be one | ||
1840 | LLUserAuth::response_t::iterator it; | ||
1841 | it = options[0].find("agent_id"); | ||
1842 | if(it != options[0].end()) | ||
1887 | { | 1843 | { |
1888 | // should only be one | 1844 | gInventoryLibraryOwner.set((*it).second.c_str()); |
1889 | LLUserAuth::response_t::iterator it; | ||
1890 | it = options[0].find("agent_id"); | ||
1891 | if(it != options[0].end()) | ||
1892 | { | ||
1893 | gInventoryLibraryOwner.set((*it).second.c_str()); | ||
1894 | } | ||
1895 | } | 1845 | } |
1896 | options.clear(); | 1846 | } |
1897 | if(gUserAuthp->getOptions("inventory-skel-lib", options) | 1847 | options.clear(); |
1898 | && gInventoryLibraryOwner.notNull()) | 1848 | if(gUserAuthp->getOptions("inventory-skel-lib", options) |
1849 | && gInventoryLibraryOwner.notNull()) | ||
1850 | { | ||
1851 | if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner)) | ||
1899 | { | 1852 | { |
1900 | if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner)) | 1853 | llwarns << "Problem loading inventory-skel-lib" << llendl; |
1901 | { | ||
1902 | llwarns << "Problem loading inventory-skel-lib" << llendl; | ||
1903 | } | ||
1904 | } | 1854 | } |
1905 | options.clear(); | 1855 | } |
1906 | if(gUserAuthp->getOptions("inventory-skeleton", options)) | 1856 | options.clear(); |
1857 | if(gUserAuthp->getOptions("inventory-skeleton", options)) | ||
1858 | { | ||
1859 | if(!gInventory.loadSkeleton(options, gAgent.getID())) | ||
1907 | { | 1860 | { |
1908 | if(!gInventory.loadSkeleton(options, gAgent.getID())) | 1861 | llwarns << "Problem loading inventory-skel-targets" |
1909 | { | 1862 | << llendl; |
1910 | llwarns << "Problem loading inventory-skel-targets" | ||
1911 | << llendl; | ||
1912 | } | ||
1913 | } | 1863 | } |
1914 | 1864 | } | |
1915 | options.clear(); | 1865 | |
1916 | if(gUserAuthp->getOptions("buddy-list", options)) | 1866 | options.clear(); |
1917 | { | 1867 | if(gUserAuthp->getOptions("buddy-list", options)) |
1918 | LLUserAuth::options_t::iterator it = options.begin(); | 1868 | { |
1919 | LLUserAuth::options_t::iterator end = options.end(); | 1869 | LLUserAuth::options_t::iterator it = options.begin(); |
1920 | LLAvatarTracker::buddy_map_t list; | 1870 | LLUserAuth::options_t::iterator end = options.end(); |
1921 | LLUUID agent_id; | 1871 | LLAvatarTracker::buddy_map_t list; |
1922 | S32 has_rights = 0, given_rights = 0; | 1872 | LLUUID agent_id; |
1923 | for (; it != end; ++it) | 1873 | S32 has_rights = 0, given_rights = 0; |
1874 | for (; it != end; ++it) | ||
1875 | { | ||
1876 | LLUserAuth::response_t::const_iterator option_it; | ||
1877 | option_it = (*it).find("buddy_id"); | ||
1878 | if(option_it != (*it).end()) | ||
1924 | { | 1879 | { |
1925 | LLUserAuth::response_t::const_iterator option_it; | 1880 | agent_id.set((*option_it).second.c_str()); |
1926 | option_it = (*it).find("buddy_id"); | ||
1927 | if(option_it != (*it).end()) | ||
1928 | { | ||
1929 | agent_id.set((*option_it).second.c_str()); | ||
1930 | } | ||
1931 | option_it = (*it).find("buddy_rights_has"); | ||
1932 | if(option_it != (*it).end()) | ||
1933 | { | ||
1934 | has_rights = atoi((*option_it).second.c_str()); | ||
1935 | } | ||
1936 | option_it = (*it).find("buddy_rights_given"); | ||
1937 | if(option_it != (*it).end()) | ||
1938 | { | ||
1939 | given_rights = atoi((*option_it).second.c_str()); | ||
1940 | } | ||
1941 | list[agent_id] = new LLRelationship(given_rights, has_rights, false); | ||
1942 | } | 1881 | } |
1943 | LLAvatarTracker::instance().addBuddyList(list); | 1882 | option_it = (*it).find("buddy_rights_has"); |
1944 | } | 1883 | if(option_it != (*it).end()) |
1945 | |||
1946 | options.clear(); | ||
1947 | if(gUserAuthp->getOptions("ui-config", options)) | ||
1948 | { | ||
1949 | LLUserAuth::options_t::iterator it = options.begin(); | ||
1950 | LLUserAuth::options_t::iterator end = options.end(); | ||
1951 | for (; it != end; ++it) | ||
1952 | { | 1884 | { |
1953 | LLUserAuth::response_t::const_iterator option_it; | 1885 | has_rights = atoi((*option_it).second.c_str()); |
1954 | option_it = (*it).find("allow_first_life"); | ||
1955 | if(option_it != (*it).end()) | ||
1956 | { | ||
1957 | if (option_it->second == "Y") | ||
1958 | { | ||
1959 | LLPanelAvatar::sAllowFirstLife = TRUE; | ||
1960 | } | ||
1961 | } | ||
1962 | } | 1886 | } |
1963 | } | 1887 | option_it = (*it).find("buddy_rights_given"); |
1964 | 1888 | if(option_it != (*it).end()) | |
1965 | options.clear(); | 1889 | { |
1966 | if(gUserAuthp->getOptions("event_categories", options)) | 1890 | given_rights = atoi((*option_it).second.c_str()); |
1967 | { | 1891 | } |
1968 | LLEventInfo::loadCategories(options); | 1892 | list[agent_id] = new LLRelationship(given_rights, has_rights, false); |
1969 | } | ||
1970 | if(gUserAuthp->getOptions("event_notifications", options)) | ||
1971 | { | ||
1972 | gEventNotifier.load(options); | ||
1973 | } | 1893 | } |
1974 | options.clear(); | 1894 | LLAvatarTracker::instance().addBuddyList(list); |
1975 | if(gUserAuthp->getOptions("classified_categories", options)) | 1895 | } |
1896 | |||
1897 | options.clear(); | ||
1898 | if(gUserAuthp->getOptions("ui-config", options)) | ||
1899 | { | ||
1900 | LLUserAuth::options_t::iterator it = options.begin(); | ||
1901 | LLUserAuth::options_t::iterator end = options.end(); | ||
1902 | for (; it != end; ++it) | ||
1976 | { | 1903 | { |
1977 | LLClassifiedInfo::loadCategories(options); | 1904 | LLUserAuth::response_t::const_iterator option_it; |
1905 | option_it = (*it).find("allow_first_life"); | ||
1906 | if(option_it != (*it).end()) | ||
1907 | { | ||
1908 | if (option_it->second == "Y") | ||
1909 | { | ||
1910 | LLPanelAvatar::sAllowFirstLife = TRUE; | ||
1911 | } | ||
1912 | } | ||
1978 | } | 1913 | } |
1979 | gInventory.buildParentChildMap(); | 1914 | } |
1980 | gInventory.addChangedMask(LLInventoryObserver::ALL, LLUUID::null); | ||
1981 | gInventory.notifyObservers(); | ||
1982 | 1915 | ||
1983 | // set up callbacks | 1916 | options.clear(); |
1984 | LLMessageSystem* msg = gMessageSystem; | 1917 | if(gUserAuthp->getOptions("event_categories", options)) |
1985 | LLInventoryModel::registerCallbacks(msg); | 1918 | { |
1986 | LLAvatarTracker::instance().registerCallbacks(msg); | 1919 | LLEventInfo::loadCategories(options); |
1987 | LLLandmark::registerCallbacks(msg); | 1920 | } |
1988 | 1921 | if(gUserAuthp->getOptions("event_notifications", options)) | |
1989 | // request mute list | 1922 | { |
1990 | gMuteListp->requestFromServer(gAgent.getID()); | 1923 | gEventNotifier.load(options); |
1991 | 1924 | } | |
1992 | // Get L$ and ownership credit information | 1925 | options.clear(); |
1993 | msg->newMessageFast(_PREHASH_MoneyBalanceRequest); | 1926 | if(gUserAuthp->getOptions("classified_categories", options)) |
1994 | msg->nextBlockFast(_PREHASH_AgentData); | 1927 | { |
1995 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 1928 | LLClassifiedInfo::loadCategories(options); |
1996 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 1929 | } |
1997 | msg->nextBlockFast(_PREHASH_MoneyData); | 1930 | gInventory.buildParentChildMap(); |
1998 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); | 1931 | gInventory.addChangedMask(LLInventoryObserver::ALL, LLUUID::null); |
1999 | gAgent.sendReliableMessage(); | 1932 | gInventory.notifyObservers(); |
2000 | 1933 | ||
2001 | // request all group information | 1934 | // set up callbacks |
2002 | // *FIX: This will not do the right thing if the message | 1935 | LLMessageSystem* msg = gMessageSystem; |
2003 | // gets there before the requestuserserverconnection | 1936 | LLInventoryModel::registerCallbacks(msg); |
2004 | // circuit is completed. | 1937 | LLAvatarTracker::instance().registerCallbacks(msg); |
2005 | gAgent.sendAgentDataUpdateRequest(); | 1938 | LLLandmark::registerCallbacks(msg); |
2006 | 1939 | ||
1940 | // request mute list | ||
1941 | gMuteListp->requestFromServer(gAgent.getID()); | ||
2007 | 1942 | ||
2008 | // NOTE: removed as part of user-privacy | 1943 | // Get L$ and ownership credit information |
2009 | // enhancements. this information should be available from | 1944 | msg->newMessageFast(_PREHASH_MoneyBalanceRequest); |
2010 | // login. 2006-10-16 Phoenix. | 1945 | msg->nextBlockFast(_PREHASH_AgentData); |
2011 | // get the users that have been granted modify powers | 1946 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); |
2012 | //msg->newMessageFast(_PREHASH_RequestGrantedProxies); | 1947 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
2013 | //msg->nextBlockFast(_PREHASH_AgentData); | 1948 | msg->nextBlockFast(_PREHASH_MoneyData); |
2014 | //msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | 1949 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); |
2015 | //msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 1950 | gAgent.sendReliableMessage(); |
2016 | //gAgent.sendReliableMessage(); | ||
2017 | 1951 | ||
2018 | BOOL shown_at_exit = gSavedSettings.getBOOL("ShowInventory"); | 1952 | // request all group information |
1953 | // *FIX: This will not do the right thing if the message | ||
1954 | // gets there before the requestuserserverconnection | ||
1955 | // circuit is completed. | ||
1956 | gAgent.sendAgentDataUpdateRequest(); | ||
2019 | 1957 | ||
2020 | // Create the inventory views | ||
2021 | LLInventoryView::showAgentInventory(); | ||
2022 | 1958 | ||
2023 | // Hide the inventory if it wasn't shown at exit | 1959 | // NOTE: removed as part of user-privacy |
2024 | if(!shown_at_exit) | 1960 | // enhancements. this information should be available from |
2025 | { | 1961 | // login. 2006-10-16 Phoenix. |
2026 | LLInventoryView::toggleVisibility(NULL); | 1962 | // get the users that have been granted modify powers |
2027 | } | 1963 | //msg->newMessageFast(_PREHASH_RequestGrantedProxies); |
1964 | //msg->nextBlockFast(_PREHASH_AgentData); | ||
1965 | //msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
1966 | //msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
1967 | //gAgent.sendReliableMessage(); | ||
1968 | |||
1969 | BOOL shown_at_exit = gSavedSettings.getBOOL("ShowInventory"); | ||
1970 | |||
1971 | // Create the inventory views | ||
1972 | LLInventoryView::showAgentInventory(); | ||
1973 | |||
1974 | // Hide the inventory if it wasn't shown at exit | ||
1975 | if(!shown_at_exit) | ||
1976 | { | ||
1977 | LLInventoryView::toggleVisibility(NULL); | ||
2028 | } | 1978 | } |
2029 | gStartupState++; | 1979 | |
1980 | LLStartUp::setStartupState( STATE_MISC ); | ||
2030 | return do_normal_idle; | 1981 | return do_normal_idle; |
2031 | } | 1982 | } |
2032 | 1983 | ||
@@ -2034,14 +1985,8 @@ BOOL idle_startup() | |||
2034 | //--------------------------------------------------------------------- | 1985 | //--------------------------------------------------------------------- |
2035 | // Misc | 1986 | // Misc |
2036 | //--------------------------------------------------------------------- | 1987 | //--------------------------------------------------------------------- |
2037 | if (STATE_MISC == gStartupState) | 1988 | if (STATE_MISC == LLStartUp::getStartupState()) |
2038 | { | 1989 | { |
2039 | // Create a few objects if we don't actually have a world | ||
2040 | if (!gConnectToSomething) | ||
2041 | { | ||
2042 | // could add them here | ||
2043 | } | ||
2044 | |||
2045 | // We have a region, and just did a big inventory download. | 1990 | // We have a region, and just did a big inventory download. |
2046 | // We can estimate the user's connection speed, and set their | 1991 | // We can estimate the user's connection speed, and set their |
2047 | // max bandwidth accordingly. JC | 1992 | // max bandwidth accordingly. JC |
@@ -2060,7 +2005,7 @@ BOOL idle_startup() | |||
2060 | { | 2005 | { |
2061 | llinfos << "Fast network connection, increasing max bandwidth to " | 2006 | llinfos << "Fast network connection, increasing max bandwidth to " |
2062 | << FASTER_RATE_BPS/1024.f | 2007 | << FASTER_RATE_BPS/1024.f |
2063 | << " Kbps" << llendl; | 2008 | << " kbps" << llendl; |
2064 | gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f); | 2009 | gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f); |
2065 | } | 2010 | } |
2066 | else if (rate_bps > FAST_RATE_BPS | 2011 | else if (rate_bps > FAST_RATE_BPS |
@@ -2068,7 +2013,7 @@ BOOL idle_startup() | |||
2068 | { | 2013 | { |
2069 | llinfos << "Fast network connection, increasing max bandwidth to " | 2014 | llinfos << "Fast network connection, increasing max bandwidth to " |
2070 | << FAST_RATE_BPS/1024.f | 2015 | << FAST_RATE_BPS/1024.f |
2071 | << " Kbps" << llendl; | 2016 | << " kbps" << llendl; |
2072 | gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f); | 2017 | gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f); |
2073 | } | 2018 | } |
2074 | } | 2019 | } |
@@ -2220,12 +2165,12 @@ BOOL idle_startup() | |||
2220 | } | 2165 | } |
2221 | } | 2166 | } |
2222 | 2167 | ||
2223 | gStartupState++; | 2168 | LLStartUp::setStartupState( STATE_PRECACHE ); |
2224 | timeout.reset(); | 2169 | timeout.reset(); |
2225 | return do_normal_idle; | 2170 | return do_normal_idle; |
2226 | } | 2171 | } |
2227 | 2172 | ||
2228 | if (STATE_PRECACHE == gStartupState) | 2173 | if (STATE_PRECACHE == LLStartUp::getStartupState()) |
2229 | { | 2174 | { |
2230 | do_normal_idle = TRUE; | 2175 | do_normal_idle = TRUE; |
2231 | 2176 | ||
@@ -2234,7 +2179,7 @@ BOOL idle_startup() | |||
2234 | if(((timeout_frac > 1.f) && gAgent.getAvatarObject()) | 2179 | if(((timeout_frac > 1.f) && gAgent.getAvatarObject()) |
2235 | || (timeout_frac > 3.f)) | 2180 | || (timeout_frac > 3.f)) |
2236 | { | 2181 | { |
2237 | gStartupState++; | 2182 | LLStartUp::setStartupState( STATE_WEARABLES_WAIT ); |
2238 | } | 2183 | } |
2239 | else | 2184 | else |
2240 | { | 2185 | { |
@@ -2246,7 +2191,7 @@ BOOL idle_startup() | |||
2246 | return do_normal_idle; | 2191 | return do_normal_idle; |
2247 | } | 2192 | } |
2248 | 2193 | ||
2249 | if (STATE_WEARABLES_WAIT == gStartupState) | 2194 | if (STATE_WEARABLES_WAIT == LLStartUp::getStartupState()) |
2250 | { | 2195 | { |
2251 | do_normal_idle = TRUE; | 2196 | do_normal_idle = TRUE; |
2252 | 2197 | ||
@@ -2257,13 +2202,13 @@ BOOL idle_startup() | |||
2257 | 2202 | ||
2258 | if(gAgent.getWearablesLoaded() || !gAgent.isGenderChosen()) | 2203 | if(gAgent.getWearablesLoaded() || !gAgent.isGenderChosen()) |
2259 | { | 2204 | { |
2260 | gStartupState++; | 2205 | LLStartUp::setStartupState( STATE_CLEANUP ); |
2261 | } | 2206 | } |
2262 | else if (wearables_time > MAX_WEARABLES_TIME) | 2207 | else if (wearables_time > MAX_WEARABLES_TIME) |
2263 | { | 2208 | { |
2264 | gViewerWindow->alertXml("ClothingLoading"); | 2209 | gViewerWindow->alertXml("ClothingLoading"); |
2265 | gViewerStats->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); | 2210 | gViewerStats->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); |
2266 | gStartupState++; | 2211 | LLStartUp::setStartupState( STATE_CLEANUP ); |
2267 | } | 2212 | } |
2268 | else | 2213 | else |
2269 | { | 2214 | { |
@@ -2275,7 +2220,7 @@ BOOL idle_startup() | |||
2275 | return do_normal_idle; | 2220 | return do_normal_idle; |
2276 | } | 2221 | } |
2277 | 2222 | ||
2278 | if (STATE_CLEANUP == gStartupState) | 2223 | if (STATE_CLEANUP == LLStartUp::getStartupState()) |
2279 | { | 2224 | { |
2280 | set_startup_status(1.0, "", NULL); | 2225 | set_startup_status(1.0, "", NULL); |
2281 | 2226 | ||
@@ -2347,7 +2292,7 @@ BOOL idle_startup() | |||
2347 | gUserAuthp = NULL; | 2292 | gUserAuthp = NULL; |
2348 | } | 2293 | } |
2349 | 2294 | ||
2350 | gStartupState++; | 2295 | LLStartUp::setStartupState( STATE_STARTED ); |
2351 | 2296 | ||
2352 | // Unmute audio if desired and setup volumes | 2297 | // Unmute audio if desired and setup volumes |
2353 | audio_update_volume(); | 2298 | audio_update_volume(); |
@@ -2361,7 +2306,7 @@ BOOL idle_startup() | |||
2361 | return do_normal_idle; | 2306 | return do_normal_idle; |
2362 | } | 2307 | } |
2363 | 2308 | ||
2364 | llwarns << "Reached end of idle_startup for state " << gStartupState << llendl; | 2309 | llwarns << "Reached end of idle_startup for state " << LLStartUp::getStartupState() << llendl; |
2365 | return do_normal_idle; | 2310 | return do_normal_idle; |
2366 | } | 2311 | } |
2367 | 2312 | ||
@@ -2421,7 +2366,7 @@ void login_callback(S32 option, void *userdata) | |||
2421 | 2366 | ||
2422 | if (CONNECT_OPTION == option) | 2367 | if (CONNECT_OPTION == option) |
2423 | { | 2368 | { |
2424 | gStartupState++; | 2369 | LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); |
2425 | return; | 2370 | return; |
2426 | } | 2371 | } |
2427 | else if (QUIT_OPTION == option) | 2372 | else if (QUIT_OPTION == option) |
@@ -2688,7 +2633,7 @@ void update_dialog_callback(S32 option, void *userdata) | |||
2688 | #if !LL_RELEASE_FOR_DOWNLOAD | 2633 | #if !LL_RELEASE_FOR_DOWNLOAD |
2689 | if (option == 2) | 2634 | if (option == 2) |
2690 | { | 2635 | { |
2691 | gStartupState++; | 2636 | LLStartUp::setStartupState( STATE_WORLD_INIT ); |
2692 | return; | 2637 | return; |
2693 | } | 2638 | } |
2694 | #endif | 2639 | #endif |
@@ -2704,7 +2649,7 @@ void update_dialog_callback(S32 option, void *userdata) | |||
2704 | } | 2649 | } |
2705 | else | 2650 | else |
2706 | { | 2651 | { |
2707 | gStartupState++; | 2652 | LLStartUp::setStartupState( STATE_WORLD_INIT ); |
2708 | } | 2653 | } |
2709 | return; | 2654 | return; |
2710 | } | 2655 | } |
@@ -3089,7 +3034,7 @@ void init_stat_view() | |||
3089 | stat_barp->mDisplayHistory = FALSE; | 3034 | stat_barp->mDisplayHistory = FALSE; |
3090 | 3035 | ||
3091 | stat_barp = stat_viewp->addStat("Packet Loss", &(gViewerStats->mPacketsLostPercentStat)); | 3036 | stat_barp = stat_viewp->addStat("Packet Loss", &(gViewerStats->mPacketsLostPercentStat)); |
3092 | stat_barp->setUnitLabel(" %%"); | 3037 | stat_barp->setUnitLabel(" %"); |
3093 | stat_barp->mMinBar = 0.f; | 3038 | stat_barp->mMinBar = 0.f; |
3094 | stat_barp->mMaxBar = 5.f; | 3039 | stat_barp->mMaxBar = 5.f; |
3095 | stat_barp->mTickSpacing = 1.f; | 3040 | stat_barp->mTickSpacing = 1.f; |
@@ -3109,16 +3054,6 @@ void init_stat_view() | |||
3109 | stat_barp->mPerSec = FALSE; | 3054 | stat_barp->mPerSec = FALSE; |
3110 | stat_barp->mDisplayMean = FALSE; | 3055 | stat_barp->mDisplayMean = FALSE; |
3111 | 3056 | ||
3112 | stat_barp = stat_viewp->addStat("Ping User", &(gViewerStats->mUserserverPingStat)); | ||
3113 | stat_barp->setUnitLabel(" msec"); | ||
3114 | stat_barp->mMinBar = 0.f; | ||
3115 | stat_barp->mMaxBar = 1000.f; | ||
3116 | stat_barp->mTickSpacing = 100.f; | ||
3117 | stat_barp->mLabelSpacing = 200.f; | ||
3118 | stat_barp->mDisplayBar = FALSE; | ||
3119 | stat_barp->mPerSec = FALSE; | ||
3120 | stat_barp->mDisplayMean = FALSE; | ||
3121 | |||
3122 | 3057 | ||
3123 | stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect); | 3058 | stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect); |
3124 | gDebugView->mStatViewp->addChildAtEnd(stat_viewp); | 3059 | gDebugView->mStatViewp->addChildAtEnd(stat_viewp); |
@@ -3740,17 +3675,31 @@ void release_start_screen() | |||
3740 | gStartImageGL = NULL; | 3675 | gStartImageGL = NULL; |
3741 | } | 3676 | } |
3742 | 3677 | ||
3678 | // static | ||
3743 | bool LLStartUp::canGoFullscreen() | 3679 | bool LLStartUp::canGoFullscreen() |
3744 | { | 3680 | { |
3745 | return gStartupState >= STATE_WORLD_INIT; | 3681 | return LLStartUp::getStartupState() >= STATE_WORLD_INIT; |
3746 | } | 3682 | } |
3747 | 3683 | ||
3684 | |||
3685 | // static | ||
3686 | void LLStartUp::setStartupState( S32 state ) | ||
3687 | { | ||
3688 | llinfos << "Startup state changing from " << gStartupState << " to " << state << llendl; | ||
3689 | gStartupState = state; | ||
3690 | } | ||
3691 | |||
3692 | |||
3748 | void reset_login() | 3693 | void reset_login() |
3749 | { | 3694 | { |
3750 | gStartupState = STATE_LOGIN_SHOW; | 3695 | LLStartUp::setStartupState( STATE_LOGIN_SHOW ); |
3751 | 3696 | ||
3752 | if ( gViewerWindow ) | 3697 | if ( gViewerWindow ) |
3753 | { // Hide menus and normal buttons | 3698 | { // Hide menus and normal buttons |
3754 | gViewerWindow->setNormalControlsVisible( FALSE ); | 3699 | gViewerWindow->setNormalControlsVisible( FALSE ); |
3755 | } | 3700 | } |
3701 | |||
3702 | // Hide any other stuff | ||
3703 | if ( gFloaterMap ) | ||
3704 | gFloaterMap->setVisible( FALSE ); | ||
3756 | } | 3705 | } |