diff options
author | Oz Linden <oz@lindenlab.com> | 2011-03-27 06:43:54 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-03-27 06:43:54 -0400 |
commit | d6da299f4396488e8b7288e414c451f30df2b56e (patch) | |
tree | 17dac9ee044034e9459e5236a58f9b237e6d55d4 /indra/newview/llviewerchat.cpp | |
parent | b2ade764a91ad1b7edcf6e21af76430f670f54fb (diff) | |
parent | 5b316df2249fc62c1e6a4f089b9726c4e62f23e0 (diff) |
pull in latest changes from autoubuild2010 branch
Diffstat (limited to 'indra/newview/llviewerchat.cpp')
-rw-r--r-- | indra/newview/llviewerchat.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 0af850a46b..286b16bab2 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -31,6 +31,8 @@ #include "llagent.h" // gAgent #include "lluicolortable.h" #include "llviewercontrol.h" // gSavedSettings +#include "llviewerregion.h" +#include "llworld.h" #include "llinstantmessage.h" //SYSTEM_FROM // LLViewerChat @@ -214,3 +216,43 @@ void LLViewerChat::formatChatMsg(const LLChat& chat, std::string& formated_msg) } +//static +std::string LLViewerChat::getSenderSLURL(const LLChat& chat, const LLSD& args) +{ + switch (chat.mSourceType) + { + case CHAT_SOURCE_AGENT: + return LLSLURL("agent", chat.mFromID, "about").getSLURLString(); + + case CHAT_SOURCE_OBJECT: + return getObjectImSLURL(chat, args); + + default: + llwarns << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << llendl; + } + + return LLStringUtil::null; +} + +//static +std::string LLViewerChat::getObjectImSLURL(const LLChat& chat, const LLSD& args) +{ + std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString(); + url += "?name=" + chat.mFromName; + url += "&owner=" + chat.mOwnerID.asString(); + + std::string slurl = args["slurl"].asString(); + if (slurl.empty()) + { + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); + if(region) + { + LLSLURL region_slurl(region->getName(), chat.mPosAgent); + slurl = region_slurl.getLocationString(); + } + } + + url += "&slurl=" + LLURI::escape(slurl); + + return url; +} |