FSData refactor: /reqsysinfo and /sysinfo

Added working /sysinfo command.
Clean up /reqsysinfo code.
Merged dupe code in reqsysinfo and sysinfo button.
Fix reqsysinfo/sysinfo output text bugs: 'r' in font info, '\n' in vovix info.
Techwolf Lupindo 2011-11-20 03:22:03 -05:00
parent 2885f32e82
commit 8e320641b0
3 changed files with 34 additions and 70 deletions

View File

@ -616,40 +616,40 @@ BOOL FSData::isSupportGroup(LLUUID id)
std::string FSData::processRequestForInfo(LLUUID requester, std::string message, std::string name, LLUUID sessionid)
{
std::string detectstring = "/reqsysinfo";
if(!message.find(detectstring)==0)
if(!message.find(detectstring) == 0)
{
//llinfos << "sysinfo was not found in this message, it was at " << message.find("/sysinfo") << " pos." << llendl;
return message;
}
if(!(is_support(requester)||is_developer(requester)))
{
return message;
}
//llinfos << "sysinfo was found in this message, it was at " << message.find("/sysinfo") << " pos." << llendl;
std::string outmessage("I am requesting information about your system setup.");
std::string reason("");
if(message.length()>detectstring.length())
if(message.length() > detectstring.length())
{
reason = std::string(message.substr(detectstring.length()));
//there is more to it!
outmessage = std::string("I am requesting information about your system setup for this reason : "+reason);
reason = "The reason provided was : "+reason;
outmessage = std::string("I am requesting information about your system setup for this reason : " + reason);
reason = "The reason provided was : " + reason;
}
LLSD args;
args["REASON"] =reason;
args["REASON"] = reason;
args["NAME"] = name;
args["FROMUUID"]=requester;
args["SESSIONID"]=sessionid;
LLNotifications::instance().add("FireStormReqInfo",args,LLSD(), callbackReqInfo);
args["FROMUUID"] = requester;
args["SESSIONID"] = sessionid;
LLNotifications::instance().add("FireStormReqInfo", args, LLSD(), callbackReqInfo);
return outmessage;
}
//static
void FSData::sendInfo(LLUUID destination, LLUUID sessionid, std::string myName, EInstantMessage dialog)
{
std::string myInfo1 = getMyInfo(1);
// std::string myInfo2 = getMyInfo(2);
std::string SystemInfo = getSystemInfo();
pack_instant_message(
gMessageSystem,
@ -658,27 +658,18 @@ void FSData::sendInfo(LLUUID destination, LLUUID sessionid, std::string myName,
gAgent.getSessionID(),
destination,
myName,
myInfo1,
SystemInfo,
IM_ONLINE,
dialog,
sessionid
);
gAgent.sendReliableMessage();
// pack_instant_message(
// gMessageSystem,
// gAgent.getID(),
// FALSE,
// gAgent.getSessionID(),
// destination,
// myName,
// myInfo2,
// IM_ONLINE,
// dialog,
// sessionid);
// gAgent.sendReliableMessage();
gIMMgr->addMessage(gIMMgr->computeSessionID(dialog,destination),destination,myName,"Information Sent: "+
myInfo1); //+"\n"+myInfo2);
gIMMgr->addMessage(gIMMgr->computeSessionID(dialog,destination),destination,myName,
"Information Sent: " + SystemInfo);
}
//static
void FSData::callbackReqInfo(const LLSD &notification, const LLSD &response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
@ -689,14 +680,13 @@ void FSData::callbackReqInfo(const LLSD &notification, const LLSD &response)
llinfos << "the uuid is " << uid.asString().c_str() << llendl;
LLAgentUI::buildFullname(my_name);
//LLUUID sessionid = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,uid);
if ( option == 0 )//yes
{
sendInfo(uid,sessionid,my_name,IM_NOTHING_SPECIAL);
}
else
{
pack_instant_message(
gMessageSystem,
gAgent.getID(),
@ -713,11 +703,10 @@ void FSData::callbackReqInfo(const LLSD &notification, const LLSD &response)
gIMMgr->addMessage(sessionid,uid,my_name,"Request Denied");
}
}
//part , 0 for all, 1 for 1st half, 2 for 2nd
std::string FSData::getMyInfo(int part)
//static
std::string FSData::getSystemInfo()
{
//copied from Zi llimfloater sendinfobutton function.
//TODO: create a single function to elemenate code dupe.
LLSD info=LLFloaterAbout::getInfo();
std::ostringstream support;
@ -738,14 +727,14 @@ std::string FSData::getMyInfo(int part)
"Skin: " << info["SKIN"] << "(" << info["THEME"] << ")\n" <<
"Mode: " << info["MODE"] << "\n" <<
"Font: " << info["FONT"] << "\n" <<
"Fontsize: " << info["FONT_SIZE"] <<"\n" <<
"Font screen DPI: " << info["FONT_SCREEN_DPI"] << "\n" <<
"Fontsize: " << info["FONT_SIZE"].asInteger() <<"\n" <<
"Font screen DPI: " << info["FONT_SCREEN_DPI"].asInteger() << "\n" <<
"RLV: " << info["RLV_VERSION"] << "\n" <<
"Curl: " << info ["LIBCURL_VERSION"] << "\n" <<
"J2C: " << info["J2C_VERSION"] << "\n" <<
"Audio: " << info["AUDIO_DRIVER_VERSION"] << "\n" <<
"Webkit: " << info["QT_WEBKIT_VERSION"] << "\n" <<
"Voice: " << info["VOICE_VERSION"] << "\n" <<
"Voice: " << info["VOICE_VERSION"].asString() << "\n" <<
"Compiler: " << info["COMPILER"] << " Version " << info["COMPILER_VERSION"].asInteger() << "\n"
;

View File

@ -84,7 +84,7 @@ public:
LLSD allowed_login();
std::string processRequestForInfo(LLUUID requester,std::string message, std::string name, LLUUID sessionid);
static std::string getMyInfo(int part =0);
static std::string getSystemInfo();
static void callbackReqInfo(const LLSD &notification, const LLSD &response);
static void sendInfo(LLUUID destination, LLUUID sessionid, std::string myName, EInstantMessage dialog);

View File

@ -304,6 +304,12 @@ void LLIMFloater::sendMsg()
}
}
// TL: Allow user to send system info.
if(mDialog == IM_NOTHING_SPECIAL && utf8_text.find("/sysinfo") == 0)
{
utf8_text = FSData::getSystemInfo();
}
// Truncate for transport
utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);
@ -456,39 +462,8 @@ void LLIMFloater::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_s
// support sysinfo button -Zi
void LLIMFloater::onSysinfoButtonClicked()
{
LLSD info=LLFloaterAbout::getInfo();
std::ostringstream support;
support <<
info["CHANNEL"] << " " << info["VIEWER_VERSION_STR"] << "\n" <<
"Sim: " << info["HOSTNAME"] << "(" << info["HOSTIP"] << ") " << info["SERVER_VERSION"] << "\n" <<
"Packet loss: " << info["PACKETS_PCT"].asReal() << "% (" << info["PACKETS_LOST"].asReal() << "/" << info["PACKETS_IN"].asReal() << ")\n" <<
"CPU: " << info["CPU"] << "\n" <<
"Memory: " << info["MEMORY_MB"] << "\n" <<
"OS: " << info["OS_VERSION"] << "\n" <<
"GPU: " << info["GRAPHICS_CARD_VENDOR"] << " " << info["GRAPHICS_CARD"] << "\n";
if(info.has("GRAPHICS_DRIVER_VERSION"))
support << "Driver: " << info["GRAPHICS_DRIVER_VERSION"] << "\n";
support <<
"OpenGL: " << info["OPENGL_VERSION"] << "\n" <<
"Skin: " << info["SKIN"] << "(" << info["THEME"] << ")\n" <<
"Mode: " << info["MODE"] << "\n" <<
"Font: " << info["FONT"] << "\n" <<
"Fontsize: " << info["FONT_SIZE"] <<"\n" <<
"Font screen DPI: " << info["FONT_SCREEN_DPI"] << "\n" <<
"RLV: " << info["RLV_VERSION"] << "\n" <<
"Curl: " << info ["LIBCURL_VERSION"] << "\n" <<
"J2C: " << info["J2C_VERSION"] << "\n" <<
"Audio: " << info["AUDIO_DRIVER_VERSION"] << "\n" <<
"Webkit: " << info["QT_WEBKIT_VERSION"] << "\n" <<
"Voice: " << info["VOICE_VERSION"] << "\n" <<
"Compiler: " << info["COMPILER"] << " Version " << info["COMPILER_VERSION"].asInteger() << "\n"
;
LLSD args;
args["SYSINFO"]=support.str();
args["SYSINFO"] = FSData::getSystemInfo();
LLNotificationsUtil::add("SendSysinfoToIM",args,LLSD(),boost::bind(&LLIMFloater::onSendSysinfo,this,_1,_2));
}