From 8e320641b080f010a01a35fd87d766dc0a4a0146 Mon Sep 17 00:00:00 2001 From: Techwolf Lupindo Date: Sun, 20 Nov 2011 03:22:03 -0500 Subject: [PATCH] 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. --- indra/newview/fsdata.cpp | 63 +++++++++++++++-------------------- indra/newview/fsdata.h | 2 +- indra/newview/llimfloater.cpp | 39 ++++------------------ 3 files changed, 34 insertions(+), 70 deletions(-) diff --git a/indra/newview/fsdata.cpp b/indra/newview/fsdata.cpp index 4ea73bac49..1d6bea81c9 100644 --- a/indra/newview/fsdata.cpp +++ b/indra/newview/fsdata.cpp @@ -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 ¬ification, const LLSD &response) { S32 option = LLNotification::getSelectedOption(notification, response); @@ -689,14 +680,13 @@ void FSData::callbackReqInfo(const LLSD ¬ification, 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 ¬ification, 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" ; diff --git a/indra/newview/fsdata.h b/indra/newview/fsdata.h index bf05a39eb4..6c12a55be9 100644 --- a/indra/newview/fsdata.h +++ b/indra/newview/fsdata.h @@ -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 ¬ification, const LLSD &response); static void sendInfo(LLUUID destination, LLUUID sessionid, std::string myName, EInstantMessage dialog); diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a09f9544c5..864b91cae2 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -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)); }