summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/groupchatlistener.cpp4
-rw-r--r--indra/newview/scripts/lua/require/LLAgent.lua11
-rw-r--r--indra/newview/scripts/lua/test_group_chat.lua16
3 files changed, 29 insertions, 2 deletions
diff --git a/indra/newview/groupchatlistener.cpp b/indra/newview/groupchatlistener.cpp
index ab367d9fa1..09951ba1cc 100644
--- a/indra/newview/groupchatlistener.cpp
+++ b/indra/newview/groupchatlistener.cpp
@@ -56,7 +56,7 @@ LLGroupChatListener::LLGroupChatListener():
&LLGroupChatListener::leaveGroupChat,
llsd::map("group_id", LLSD()));
add("sendGroupIM",
- "send a groupchat IM",
+ "send a [\"message\"] to group with UUID [\"group_id\"]",
&LLGroupChatListener::sendGroupIM,
llsd::map("message", LLSD(), "group_id", LLSD()));
}
@@ -114,5 +114,5 @@ void LLGroupChatListener::sendGroupIM(LLSD const &data)
LLIMModel::sendMessage(LUA_PREFIX + data["message"].asString(),
gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id),
group_id,
- IM_SESSION_GROUP_START);
+ IM_SESSION_SEND);
}
diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua
index bc9a6b23a0..5ee092f2f6 100644
--- a/indra/newview/scripts/lua/require/LLAgent.lua
+++ b/indra/newview/scripts/lua/require/LLAgent.lua
@@ -11,6 +11,17 @@ function LLAgent.getGlobalPosition()
return leap.request('LLAgent', {op = 'getPosition'}).global
end
+-- Return array information about the agent's groups
+-- id: group id\n"
+-- name: group name\n"
+-- insignia: group insignia texture id
+-- notices: bool indicating if this user accepts notices from this group
+-- display: bool indicating if this group is listed in the user's profile
+-- contrib: user's land contribution to this group
+function LLAgent.getGroups()
+ return leap.request('LLAgent', {op = 'getGroups'}).groups
+end
+
-- Use LL.leaphelp('LLAgent') and see 'setCameraParams' to get more info about params
-- -- TYPE -- DEFAULT -- RANGE
-- LLAgent.setCamera{ [, camera_pos] -- vector3
diff --git a/indra/newview/scripts/lua/test_group_chat.lua b/indra/newview/scripts/lua/test_group_chat.lua
new file mode 100644
index 0000000000..6299ba535f
--- /dev/null
+++ b/indra/newview/scripts/lua/test_group_chat.lua
@@ -0,0 +1,16 @@
+LLChat = require 'LLChat'
+inspect = require 'inspect'
+LLAgent = require 'LLAgent'
+popup = require 'popup'
+
+local OK = 'OK_okcancelbuttons'
+local GROUPS = LLAgent.getGroups()
+
+-- Choose one of the groups randomly and send group message
+math.randomseed(os.time())
+group_info = GROUPS[math.random(#GROUPS)]
+LLChat.startGroupChat(group_info.id)
+response = popup:alertYesCancel('Started group chat with ' .. group_info.name .. ' group. Send greetings?')
+if next(response) == OK then
+ LLChat.sendGroupIM('Greetings', group_info.id)
+end