From e9f6de28b2e2be98bd8bb9e62fcffafebd29a939 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 12 Apr 2011 11:04:19 -0400
Subject: CHOP-581: Preliminary attempt to add enter/leave group chat hooks.
 Unstable! Using present "startIM" is known to crash the Mac viewer.
 Committing to migrate to different dev box for further debugging.

---
 indra/newview/CMakeLists.txt        |  2 ++
 indra/newview/groupchatlistener.cpp | 36 ++++++++++++++++++++++++++++++++++++
 indra/newview/groupchatlistener.h   | 23 +++++++++++++++++++++++
 indra/newview/llgroupactions.cpp    |  2 ++
 4 files changed, 63 insertions(+)
 create mode 100644 indra/newview/groupchatlistener.cpp
 create mode 100644 indra/newview/groupchatlistener.h

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index b1cb10665b..b2053d68a3 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -70,6 +70,7 @@ include_directories(
     )
 
 set(viewer_SOURCE_FILES
+    groupchatlistener.cpp
     llagent.cpp
     llagentaccess.cpp
     llagentcamera.cpp
@@ -612,6 +613,7 @@ endif (LINUX)
 set(viewer_HEADER_FILES
     CMakeLists.txt
     ViewerInstall.cmake
+    groupchatlistener.h
     llagent.h
     llagentaccess.h
     llagentcamera.h
diff --git a/indra/newview/groupchatlistener.cpp b/indra/newview/groupchatlistener.cpp
new file mode 100644
index 0000000000..9b463c9a3f
--- /dev/null
+++ b/indra/newview/groupchatlistener.cpp
@@ -0,0 +1,36 @@
+/**
+ * @file   groupchatlistener.cpp
+ * @author Nat Goodspeed
+ * @date   2011-04-11
+ * @brief  Implementation for groupchatlistener.
+ * 
+ * $LicenseInfo:firstyear=2011&license=internal$
+ * Copyright (c) 2011, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// Precompiled header
+#include "llviewerprecompiledheaders.h"
+// associated header
+#include "groupchatlistener.h"
+// STL headers
+// std headers
+// external library headers
+// other Linden headers
+#include "llgroupactions.h"
+
+GroupChatListener::GroupChatListener():
+    LLEventAPI("GroupChat",
+               "API to enter, leave, send and intercept group chat messages")
+{
+    add("startIM",
+        "Enter a group chat in group with UUID [\"id\"]\n"
+        "Assumes the logged-in agent is already a member of this group.",
+        &LLGroupActions::startIM,
+        LLSDArray("id"));
+    add("endIM",
+        "Leave a group chat in group with UUID [\"id\"]\n"
+        "Assumes a prior successful startIM request.",
+        &LLGroupActions::endIM,
+        LLSDArray("id"));
+}
diff --git a/indra/newview/groupchatlistener.h b/indra/newview/groupchatlistener.h
new file mode 100644
index 0000000000..719e3e877f
--- /dev/null
+++ b/indra/newview/groupchatlistener.h
@@ -0,0 +1,23 @@
+/**
+ * @file   groupchatlistener.h
+ * @author Nat Goodspeed
+ * @date   2011-04-11
+ * @brief  
+ * 
+ * $LicenseInfo:firstyear=2011&license=internal$
+ * Copyright (c) 2011, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_GROUPCHATLISTENER_H)
+#define LL_GROUPCHATLISTENER_H
+
+#include "lleventapi.h"
+
+class GroupChatListener: public LLEventAPI
+{
+public:
+    GroupChatListener();
+};
+
+#endif /* ! defined(LL_GROUPCHATLISTENER_H) */
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 7c56e610ce..92fd84ff5b 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -40,10 +40,12 @@
 #include "llsidetray.h"
 #include "llstatusbar.h"	// can_afford_transaction()
 #include "llimfloater.h"
+#include "groupchatlistener.h"
 
 //
 // Globals
 //
+static GroupChatListener sGroupChatListener;
 
 class LLGroupHandler : public LLCommandHandler
 {
-- 
cgit v1.2.3