From 3ac91b70dc18388d68e428ea68502ee89121c7ea Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Thu, 28 Dec 2023 00:46:42 -0500
Subject: [PATCH] Add copy group name/slurl/id to chui tab

---
 indra/newview/llconversationmodel.cpp         |  4 ++++
 indra/newview/llfloaterimcontainer.cpp        | 20 +++++++++++++++++++
 .../default/xui/en/menu_conversation.xml      | 20 ++++++++++++++++++-
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index da5e1e8c4bc..7a4ca69729e 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -461,6 +461,10 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags)
         items.push_back(std::string("group_profile"));
         items.push_back(std::string("activate_group"));
         items.push_back(std::string("leave_group"));
+		items.push_back(std::string("separator_group_copy"));
+		items.push_back(std::string("copy_group_name"));
+		items.push_back(std::string("copy_group_slurl"));
+		items.push_back(std::string("copy_group_id"));
     }
     else if(this->getType() == CONV_SESSION_AD_HOC)
     {
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index e7cb3748c7d..c6504464129 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -30,8 +30,10 @@
 #include "llfloaterimsession.h"
 #include "llfloaterimcontainer.h"
 
+#include "llclipboard.h"
 #include "llfloaterreg.h"
 #include "lllayoutstack.h"
+#include "llslurl.h"
 #include "llfloaterimnearbychat.h"
 
 #include "alavataractions.h"
@@ -1482,6 +1484,24 @@ void LLFloaterIMContainer::doToSelectedGroup(const LLSD& userdata)
     {
         LLGroupActions::leave(mSelectedSession);
     }
+	else if (action == "copy_group_name")
+	{
+		if (auto group = LLGroupMgr::getInstance()->getGroupData(mSelectedSession))
+		{
+			LLWString wstr = utf8str_to_wstring(group->mName);
+			LLClipboard::instance().copyToClipboard(wstr, 0, wstr.length());
+		}
+	}
+	else if (action == "copy_group_slurl")
+	{
+		LLWString wstr = utf8str_to_wstring(LLSLURL("group", mSelectedSession, "about").getSLURLString());
+		LLClipboard::instance().copyToClipboard(wstr, 0, wstr.length());
+	}
+	else if (action == "copy_group_id")
+	{
+		LLWString wstr = utf8str_to_wstring(mSelectedSession.asString());
+		LLClipboard::instance().copyToClipboard(wstr, 0, wstr.length());
+	}
 }
 
 bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata)
diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml
index ce03113c8ff..c98dc5dd88a 100644
--- a/indra/newview/skins/default/xui/en/menu_conversation.xml
+++ b/indra/newview/skins/default/xui/en/menu_conversation.xml
@@ -166,7 +166,6 @@
      layout="topleft"
      name="group_profile">
         <on_click function="Group.DoToSelected" parameter="group_profile"/>
-        <on_enable function="Avatar.EnableItem" parameter="can_group_profile" />
     </menu_item_call>	
     <menu_item_call
      label="Activate Group"
@@ -182,6 +181,25 @@
         <on_click function="Group.DoToSelected" parameter="leave_group"/>
         <on_enable function="Avatar.EnableItem" parameter="can_leave_group" />
     </menu_item_call>
+	<menu_item_separator layout="topleft" name="separator_group_copy"/>
+    <menu_item_call
+     label="Copy Name"
+     layout="topleft"
+     name="copy_group_name">
+        <on_click function="Group.DoToSelected" parameter="copy_group_name"/>
+    </menu_item_call>
+    <menu_item_call
+     label="Copy SLurl"
+     layout="topleft"
+     name="copy_group_slurl">
+        <on_click function="Group.DoToSelected" parameter="copy_group_slurl"/>
+    </menu_item_call>
+    <menu_item_call
+     label="Copy UUID"
+     layout="topleft"
+     name="copy_group_id">
+        <on_click function="Group.DoToSelected" parameter="copy_group_id"/>
+    </menu_item_call>	
 	<menu_item_separator layout="topleft" name="Moderator Options Separator"/>
 	<context_menu
 	 label="Moderator Options"
-- 
GitLab