Massive commit, mainly client tag stuff and random id0 and random mac,

red name if not actually in the sim in active speakers for voice.
This commit is contained in:
phr0z3nt04st
2010-07-01 22:16:03 -05:00
parent acab2bd974
commit 7f8b62d70e
16 changed files with 557 additions and 244 deletions

View File

@@ -77,11 +77,11 @@
#include "llglheaders.h"
// <edit>
// <edit>
#include "llappviewer.h"
#include "llspinctrl.h"
#include <boost/lexical_cast.hpp>
// </edit>
#include <boost/lexical_cast.hpp>
// </edit>
#define USE_VIEWER_AUTH 0
const S32 BLACK_BORDER_HEIGHT = 160;
@@ -108,8 +108,8 @@ public:
LLLoginRefreshHandler gLoginRefreshHandler;
// <edit>
std::string gFullName;
// <edit>
std::string gFullName;
// </edit>
// helper class that trys to download a URL from a web site and calls a method
@@ -303,10 +303,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
// childSetAction("quit_btn", onClickQuit, this);
// <edit>
//std::string channel = gSavedSettings.getString("VersionChannelName");
std::string channel = gSavedSettings.getString("SpecifiedChannel");
// </edit>
// <edit>
//std::string channel = gSavedSettings.getString("VersionChannelName");
std::string channel = gSavedSettings.getString("SpecifiedChannel");
// </edit>
std::string version = llformat("%d.%d.%d (%d)",
LL_VERSION_MAJOR,
LL_VERSION_MINOR,
@@ -365,64 +365,69 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
refreshLocation( false );
#endif
// <edit>
std::string specified_channel = gSavedSettings.getString("SpecifiedChannel");
// <edit>
std::string specified_channel = gSavedSettings.getString("SpecifiedChannel");
getChild<LLLineEditor>("channel_edit")->setText(specified_channel);
bool specify_mac = gSavedSettings.getBOOL("SpecifyMAC");
bool specify_id0 = gSavedSettings.getBOOL("SpecifyID0");
std::string specified_mac = gSavedSettings.getString("SpecifiedMAC");
std::string specified_id0 = gSavedSettings.getString("SpecifiedID0");
// Don't allow specify for empty strings (just in case)
if(specified_mac.length() == 0) specify_mac = false;
if(specified_id0.length() == 0) specify_id0 = false;
gSavedSettings.setBOOL("SpecifyMAC", specify_mac);
gSavedSettings.setBOOL("SpecifyID0", specify_id0);
getChild<LLCheckBoxCtrl>("mac_check")->setValue(specify_mac);
getChild<LLLineEditor>("mac_edit")->setEnabled(specify_mac);
getChild<LLCheckBoxCtrl>("id0_check")->setValue(specify_id0);
getChild<LLLineEditor>("id0_edit")->setEnabled(specify_id0);
fillMAC();
bool specify_mac = gSavedSettings.getBOOL("SpecifyMAC");
bool specify_id0 = gSavedSettings.getBOOL("SpecifyID0");
std::string specified_mac = gSavedSettings.getString("SpecifiedMAC");
std::string specified_id0 = gSavedSettings.getString("SpecifiedID0");
// Don't allow specify for empty strings (just in case)
if(specified_mac.length() == 0) specify_mac = false;
if(specified_id0.length() == 0) specify_id0 = false;
gSavedSettings.setBOOL("SpecifyMAC", specify_mac);
gSavedSettings.setBOOL("SpecifyID0", specify_id0);
getChild<LLCheckBoxCtrl>("mac_check")->setValue(specify_mac);
getChild<LLLineEditor>("mac_edit")->setEnabled(specify_mac);
getChild<LLCheckBoxCtrl>("id0_check")->setValue(specify_id0);
getChild<LLLineEditor>("id0_edit")->setEnabled(specify_id0);
childSetEnabled("mac_random_btn",specify_mac);
childSetEnabled("id0_random_btn",specify_id0);
fillMAC();
fillID0();
fillVer();
childSetCommitCallback("mac_check", onCheckMAC, this);
childSetCommitCallback("id0_check", onCheckID0, this);
// </edit>
}
// <edit>
void LLPanelLogin::fillMAC()
{
if(gSavedSettings.getBOOL("SpecifyMAC"))
{
getChild<LLLineEditor>("mac_edit")->setText(gSavedSettings.getString("SpecifiedMAC"));
}
else
{
char hashed_mac_string[MD5HEX_STR_SIZE];
LLMD5 hashed_mac;
hashed_mac.update( gMACAddress, MAC_ADDRESS_BYTES );
hashed_mac.finalize();
hashed_mac.hex_digest(hashed_mac_string);
getChild<LLLineEditor>("mac_edit")->setText(std::string(hashed_mac_string));
}
}
void LLPanelLogin::fillID0()
{
if(gSavedSettings.getBOOL("SpecifyID0"))
{
getChild<LLLineEditor>("id0_edit")->setText(gSavedSettings.getString("SpecifiedID0"));
}
else
{
getChild<LLLineEditor>("id0_edit")->setText(LLAppViewer::instance()->getSerialNumber());
}
fillVer();
childSetCommitCallback("mac_check", onCheckMAC, this);
childSetCommitCallback("id0_check", onCheckID0, this);
childSetAction("mac_random_btn", onClickMACRandom, this);
childSetAction("id0_random_btn", onClickID0Random, this);
// </edit>
}
// <edit>
void LLPanelLogin::fillMAC()
{
if(gSavedSettings.getBOOL("SpecifyMAC"))
{
getChild<LLLineEditor>("mac_edit")->setText(gSavedSettings.getString("SpecifiedMAC"));
}
else
{
char hashed_mac_string[MD5HEX_STR_SIZE];
LLMD5 hashed_mac;
hashed_mac.update( gMACAddress, MAC_ADDRESS_BYTES );
hashed_mac.finalize();
hashed_mac.hex_digest(hashed_mac_string);
getChild<LLLineEditor>("mac_edit")->setText(std::string(hashed_mac_string));
}
}
void LLPanelLogin::fillID0()
{
if(gSavedSettings.getBOOL("SpecifyID0"))
{
getChild<LLLineEditor>("id0_edit")->setText(gSavedSettings.getString("SpecifiedID0"));
}
else
{
getChild<LLLineEditor>("id0_edit")->setText(LLAppViewer::instance()->getSerialNumber());
}
}
void LLPanelLogin::fillVer()
@@ -431,27 +436,66 @@ void LLPanelLogin::fillVer()
getChild<LLSpinCtrl>("vermin_spin")->forceSetValue((S32)gSavedSettings.getU32("SpecifiedVersionMin"));
getChild<LLSpinCtrl>("verpatch_spin")->forceSetValue((S32)gSavedSettings.getU32("SpecifiedVersionPatch"));
getChild<LLSpinCtrl>("verbuild_spin")->forceSetValue((S32)gSavedSettings.getU32("SpecifiedVersionBuild"));
}
// static
void LLPanelLogin::onCheckMAC(LLUICtrl* ctrl, void* userData)
{
LLPanelLogin* panel = (LLPanelLogin*)userData;
bool enabled = ((LLCheckBoxCtrl*)ctrl)->getValue();
gSavedSettings.setBOOL("SpecifyMAC", enabled);
panel->getChild<LLLineEditor>("mac_edit")->setEnabled(enabled);
panel->fillMAC();
}
// static
void LLPanelLogin::onCheckID0(LLUICtrl* ctrl, void* userData)
{
LLPanelLogin* panel = (LLPanelLogin*)userData;
bool enabled = ((LLCheckBoxCtrl*)ctrl)->getValue();
gSavedSettings.setBOOL("SpecifyID0", enabled);
panel->getChild<LLLineEditor>("id0_edit")->setEnabled(enabled);
panel->fillID0();
}
}
// static
void LLPanelLogin::onCheckMAC(LLUICtrl* ctrl, void* userData)
{
LLPanelLogin* panel = (LLPanelLogin*)userData;
bool enabled = ((LLCheckBoxCtrl*)ctrl)->getValue();
gSavedSettings.setBOOL("SpecifyMAC", enabled);
panel->getChild<LLLineEditor>("mac_edit")->setEnabled(enabled);
panel->childSetEnabled("mac_random_btn",enabled);
panel->fillMAC();
}
// static
void LLPanelLogin::onCheckID0(LLUICtrl* ctrl, void* userData)
{
LLPanelLogin* panel = (LLPanelLogin*)userData;
bool enabled = ((LLCheckBoxCtrl*)ctrl)->getValue();
gSavedSettings.setBOOL("SpecifyID0", enabled);
panel->getChild<LLLineEditor>("id0_edit")->setEnabled(enabled);
panel->childSetEnabled("id0_random_btn",enabled);
panel->fillID0();
}
// static
void LLPanelLogin::onClickMACRandom(void* userData)
{
LLPanelLogin* panel = (LLPanelLogin*)userData;
unsigned char seed[16]; /* Flawfinder: ignore */
LLUUID::getNodeID(&seed[0]);
seed[6]='U';
seed[7]='W';
LLUUID::getSystemTime((uuid_time_t *)(&seed[8]));
char hash_string[MD5HEX_STR_SIZE];
LLMD5 hash;
hash.update( seed , 16 );
hash.finalize();
hash.hex_digest(hash_string);
gSavedSettings.setString("SpecifiedMAC",std::string(hash_string));
panel->fillMAC();
}
// static
void LLPanelLogin::onClickID0Random(void* userData)
{
LLPanelLogin* panel = (LLPanelLogin*)userData;
unsigned char seed[16]; /* Flawfinder: ignore */
LLUUID::getNodeID(&seed[0]);
seed[6]='W';
seed[7]='U';
LLUUID::getSystemTime((uuid_time_t *)(&seed[8]));
char hash_string[MD5HEX_STR_SIZE];
LLMD5 hash;
hash.update( seed , 16 );
hash.finalize();
hash.hex_digest(hash_string);
gSavedSettings.setString("SpecifiedID0",std::string(hash_string));
panel->fillID0();
}
// </edit>
void LLPanelLogin::setSiteIsAlive( bool alive )
@@ -1018,10 +1062,10 @@ void LLPanelLogin::loadLoginPage()
// Channel and Version
std::string version = llformat("%d.%d.%d (%d)",
gSavedSettings.getU32("SpecifiedVersionMaj"), gSavedSettings.getU32("SpecifiedVersionMin"), gSavedSettings.getU32("SpecifiedVersionPatch"), gSavedSettings.getU32("SpecifiedVersionBuild"));
//char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0);
char* curl_channel = curl_escape(gSavedSettings.getString("SpecifiedChannel").c_str(), 0);
// </edit>
//char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0);
char* curl_channel = curl_escape(gSavedSettings.getString("SpecifiedChannel").c_str(), 0);
// </edit>
char* curl_version = curl_escape(version.c_str(), 0);
oStr << "&channel=" << curl_channel;
@@ -1183,26 +1227,26 @@ void LLPanelLogin::onClickConnect(void *)
{
if (sInstance && sInstance->mCallback)
{
// <edit> save identity settings for login
bool specify_mac = sInstance->getChild<LLCheckBoxCtrl>("mac_check")->getValue();
// <edit> save identity settings for login
bool specify_mac = sInstance->getChild<LLCheckBoxCtrl>("mac_check")->getValue();
bool specify_id0 = sInstance->getChild<LLCheckBoxCtrl>("id0_check")->getValue();
gSavedSettings.setBOOL("SpecifyMAC", specify_mac);
gSavedSettings.setBOOL("SpecifyID0", specify_id0);
if(specify_mac)
{
std::string specified_mac = sInstance->getChild<LLLineEditor>("mac_edit")->getText();
gSavedSettings.setString("SpecifiedMAC", specified_mac);
}
gSavedSettings.setBOOL("SpecifyMAC", specify_mac);
gSavedSettings.setBOOL("SpecifyID0", specify_id0);
if(specify_id0)
{
std::string specified_id0 = sInstance->getChild<LLLineEditor>("id0_edit")->getText();
gSavedSettings.setString("SpecifiedID0", specified_id0);
}
if(specify_mac)
{
std::string specified_mac = sInstance->getChild<LLLineEditor>("mac_edit")->getText();
gSavedSettings.setString("SpecifiedMAC", specified_mac);
}
std::string specified_channel = sInstance->getChild<LLLineEditor>("channel_edit")->getText();
if(specify_id0)
{
std::string specified_id0 = sInstance->getChild<LLLineEditor>("id0_edit")->getText();
gSavedSettings.setString("SpecifiedID0", specified_id0);
}
std::string specified_channel = sInstance->getChild<LLLineEditor>("channel_edit")->getText();
gSavedSettings.setString("SpecifiedChannel", specified_channel);
U32 specified_ver_maj = (U32)sInstance->getChild<LLSpinCtrl>("vermaj_spin")->getValue().asInteger();
@@ -1213,7 +1257,7 @@ void LLPanelLogin::onClickConnect(void *)
gSavedSettings.setU32("SpecifiedVersionPatch", specified_ver_patch);
U32 specified_ver_build = (U32)sInstance->getChild<LLSpinCtrl>("verbuild_spin")->getValue().asInteger();
gSavedSettings.setU32("SpecifiedVersionBuild", specified_ver_build);
// </edit>
// tell the responder we're not here anymore
if ( gResponsePtr )