storm-1267

meow-7.2.2
Oz Linden 2011-05-18 18:27:17 -04:00
commit eb8f5d843f
8 changed files with 118 additions and 4 deletions

View File

@ -109,6 +109,8 @@ def main(command, libpath=[], vars={}):
os.environ.update(dict([(str(key), str(value)) for key, value in vars.iteritems()]))
# Run the child process.
print "Running: %s" % " ".join(command)
# Make sure we see all relevant output *before* child-process output.
sys.stdout.flush()
return subprocess.call(command)
if __name__ == "__main__":

View File

@ -76,6 +76,7 @@ include_directories(
)
set(viewer_SOURCE_FILES
groupchatlistener.cpp
llagent.cpp
llagentaccess.cpp
llagentcamera.cpp
@ -624,6 +625,7 @@ endif (LINUX)
set(viewer_HEADER_FILES
CMakeLists.txt
ViewerInstall.cmake
groupchatlistener.h
llagent.h
llagentaccess.h
llagentcamera.h

View File

@ -0,0 +1,59 @@
/**
* @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"
#include "llimview.h"
namespace {
void startIm_wrapper(LLSD const & event)
{
LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID());
sendReply(LLSDMap("session_id", LLSD(session_id)), event);
}
void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id)
{
LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START);
}
}
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.",
&startIm_wrapper);
add("endIM",
"Leave a group chat in group with UUID [\"id\"]\n"
"Assumes a prior successful startIM request.",
&LLGroupActions::endIM,
LLSDArray("id"));
add("sendIM",
"send a groupchat IM",
&send_message_wrapper,
LLSDArray("text")("session_id")("group_id"));
}
/*
static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
const LLUUID& other_participant_id, EInstantMessage dialog);
*/

View File

@ -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) */

View File

@ -64,6 +64,12 @@ LLAgentListener::LLAgentListener(LLAgent &agent)
"[\"quat\"]: array of [x, y, z, w] quaternion values",
&LLAgentListener::getAxes,
LLSDMap("reply", LLSD()));
add("getGroups",
"Send on [\"reply\"], in [\"groups\"], an array describing agent's groups:\n"
"[\"id\"]: UUID of group\n"
"[\"name\"]: name of group",
&LLAgentListener::getGroups,
LLSDMap("reply", LLSD()));
}
void LLAgentListener::requestTeleport(LLSD const & event_data) const
@ -140,3 +146,21 @@ void LLAgentListener::getAxes(const LLSD& event) const
("euler", LLSDMap("roll", roll)("pitch", pitch)("yaw", yaw)),
event);
}
void LLAgentListener::getGroups(const LLSD& event) const
{
LLSD reply(LLSD::emptyArray());
for (LLDynamicArray<LLGroupData>::const_iterator
gi(mAgent.mGroups.begin()), gend(mAgent.mGroups.end());
gi != gend; ++gi)
{
reply.append(LLSDMap
("id", gi->mID)
("name", gi->mName)
("insignia", gi->mInsigniaID)
("notices", bool(gi->mAcceptNotices))
("display", bool(gi->mListInProfile))
("contrib", gi->mContribution));
}
sendReply(LLSDMap("groups", reply), event);
}

View File

@ -46,6 +46,7 @@ private:
void requestStand(LLSD const & event_data) const;
void resetAxes(const LLSD& event) const;
void getAxes(const LLSD& event) const;
void getGroups(const LLSD& event) const;
private:
LLAgent & mAgent;

View File

@ -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
{
@ -320,10 +322,9 @@ void LLGroupActions::closeGroup(const LLUUID& group_id)
// static
void LLGroupActions::startIM(const LLUUID& group_id)
LLUUID LLGroupActions::startIM(const LLUUID& group_id)
{
if (group_id.isNull())
return;
if (group_id.isNull()) return LLUUID::null;
LLGroupData group_data;
if (gAgent.getGroupData(group_id, group_data))
@ -337,12 +338,14 @@ void LLGroupActions::startIM(const LLUUID& group_id)
LLIMFloater::show(session_id);
}
make_ui_sound("UISndStartIM");
return session_id;
}
else
{
// this should never happen, as starting a group IM session
// relies on you belonging to the group and hence having the group data
make_ui_sound("UISndInvalidOp");
return LLUUID::null;
}
}

View File

@ -87,7 +87,7 @@ public:
/**
* Start group instant messaging session.
*/
static void startIM(const LLUUID& group_id);
static LLUUID startIM(const LLUUID& group_id);
/**
* End group instant messaging session.