From e89db0b4b1a6c0d6e06bf5459ac97f531e9f3272 Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Tue, 4 Jan 2011 14:48:23 +0100 Subject: [PATCH] HTTP links in group notices and extended group limit ready. --- indra/llcommon/indra_constants.h | 2 +- indra/llui/lltexteditor.cpp | 1 + indra/llui/lltexteditor.h | 1 + indra/newview/llfloatergroups.cpp | 7 ++++--- indra/newview/llgroupnotify.cpp | 1 + indra/newview/llpanelgroupnotices.cpp | 8 +++++++- indra/newview/llstartup.cpp | 13 +++++++++++++ indra/newview/llstartup.h | 1 + indra/newview/llviewermessage.cpp | 2 +- 9 files changed, 30 insertions(+), 6 deletions(-) diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 2c7d701a1..3725b1d84 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -253,7 +253,7 @@ const U8 SIM_ACCESS_DOWN = 254; const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT; // group constants -const S32 MAX_AGENT_GROUPS = 25; +const S32 DEFAULT_MAX_AGENT_GROUPS = 25; // attachment constants const S32 MAX_AGENT_ATTACHMENTS = 38; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 2a7b91d8d..60eca9719 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -3899,6 +3899,7 @@ void LLTextEditor::removeTextFromEnd(S32 num_chars) { if (num_chars <= 0) return; + num_chars = llclamp(num_chars, 0, getLength()); remove(getLength() - num_chars, num_chars, FALSE); S32 len = getLength(); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index a2bc8695d..292779826 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -205,6 +205,7 @@ public: void setThumbColor( const LLColor4& color ); void setHighlightColor( const LLColor4& color ); void setShadowColor( const LLColor4& color ); + LLColor4 getReadOnlyFgColor() { return mReadOnlyFgColor; } // Hacky methods to make it into a word-wrapping, potentially scrolling, // read-only text box. diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index d730eeeaf..6b5204634 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -58,6 +58,7 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llimview.h" +#include "llstartup.h" // static std::map LLFloaterGroupPicker::sInstances; @@ -202,7 +203,7 @@ void LLPanelGroups::reset() group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count())); - childSetTextArg("groupcount", "[MAX]", llformat("%d",MAX_AGENT_GROUPS)); + childSetTextArg("groupcount", "[MAX]", llformat("%d", gMaxAgentGroups)); const std::string none_text = getString("none"); init_group_list(getChild("group list"), gAgent.getGroupID(), none_text); @@ -214,7 +215,7 @@ BOOL LLPanelGroups::postBuild() childSetCommitCallback("group list", onGroupList, this); childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count())); - childSetTextArg("groupcount", "[MAX]", llformat("%d",MAX_AGENT_GROUPS)); + childSetTextArg("groupcount", "[MAX]", llformat("%d", gMaxAgentGroups)); const std::string none_text = getString("none"); init_group_list(getChild("group list"), gAgent.getGroupID(), none_text); @@ -274,7 +275,7 @@ void LLPanelGroups::enableButtons() childDisable("IM"); childDisable("Leave"); } - if(gAgent.mGroups.count() < MAX_AGENT_GROUPS) + if(gAgent.mGroups.count() < gMaxAgentGroups) { childEnable("Create"); } diff --git a/indra/newview/llgroupnotify.cpp b/indra/newview/llgroupnotify.cpp index 77beab8ce..3648decc4 100644 --- a/indra/newview/llgroupnotify.cpp +++ b/indra/newview/llgroupnotify.cpp @@ -194,6 +194,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); + text->setParseHTML(TRUE); text->appendColoredText(std::string("\n\n") + message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 555b7ae63..43e1a09a4 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -247,6 +247,7 @@ BOOL LLPanelGroupNotices::postBuild() // View mViewSubject = getChild("view_subject",recurse); mViewMessage = getChild("view_message",recurse); + mViewMessage->setParseHTML(TRUE); mViewInventoryName = getChild("view_inventory_name",recurse); mViewInventoryName->setTabStop(FALSE); @@ -524,7 +525,12 @@ void LLPanelGroupNotices::showNotice(const std::string& subject, arrangeNoticeView(VIEW_PAST_NOTICE); if(mViewSubject) mViewSubject->setText(subject); - if(mViewMessage) mViewMessage->setText(message); + if (mViewMessage) { + // We need to prune the highlights, and clear() is not doing it... + mViewMessage->removeTextFromEnd(mViewMessage->getMaxLength()); + // Now we append the new text (setText() won't highlight URLs) + mViewMessage->appendColoredText(message, false, false, mViewMessage->getReadOnlyFgColor()); + } if (mInventoryOffer) { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6907b24f5..381fc5b79 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -226,6 +226,8 @@ std::string gInitialOutfitGender; std::string SCREEN_HOME_FILENAME = "screen_home.bmp"; std::string SCREEN_LAST_FILENAME = "screen_last.bmp"; +S32 gMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS; + // // Imported globals // @@ -2459,6 +2461,17 @@ bool idle_startup() } } + std::string max_agent_groups = LLUserAuth::getInstance()->getResponse("max-agent-groups"); + if (!max_agent_groups.empty()) + { + gMaxAgentGroups = atoi(max_agent_groups.c_str()); + LL_INFOS("LLStartup") << "gMaxAgentGroups read from login.cgi: " << gMaxAgentGroups << LL_ENDL; + } + else + { + gMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS; + } + std::string map_server_url = LLUserAuth::getInstance()->getResponse("map-server-url"); if(!map_server_url.empty()) { diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index 72e1e6dae..4bd9f9b52 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -78,6 +78,7 @@ extern bool gAgentMovementCompleted; extern LLPointer gStartImageGL; extern std::string gInitialOutfit; extern std::string gInitialOutfitGender; // "male" or "female" +extern S32 gMaxAgentGroups; class LLStartUp { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index aafb18200..7332240df 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -666,7 +666,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if(option == 0 && !group_id.isNull()) { // check for promotion or demotion. - S32 max_groups = MAX_AGENT_GROUPS; + S32 max_groups = gMaxAgentGroups; if(gAgent.isInGroup(group_id)) ++max_groups; if(gAgent.mGroups.count() < max_groups)