diff options
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/cmake/run_build_test.py | 2 | ||||
| -rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/newview/groupchatlistener.cpp | 59 | ||||
| -rw-r--r-- | indra/newview/groupchatlistener.h | 23 | ||||
| -rw-r--r-- | indra/newview/llagentlistener.cpp | 24 | ||||
| -rw-r--r-- | indra/newview/llagentlistener.h | 1 | ||||
| -rw-r--r-- | indra/newview/llgroupactions.cpp | 9 | ||||
| -rw-r--r-- | indra/newview/llgroupactions.h | 2 | 
8 files changed, 118 insertions, 4 deletions
| diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py index 320a9be8ab..ce2d1e0386 100755 --- a/indra/cmake/run_build_test.py +++ b/indra/cmake/run_build_test.py @@ -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__": diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2ecce0ebd3..cbf22b75e8 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -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 diff --git a/indra/newview/groupchatlistener.cpp b/indra/newview/groupchatlistener.cpp new file mode 100644 index 0000000000..3758896b85 --- /dev/null +++ b/indra/newview/groupchatlistener.cpp @@ -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); +*/ 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/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index ed24febf41..9cea33c7c6 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -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); +} diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h index 0aa58d0b16..5a89a99f6a 100644 --- a/indra/newview/llagentlistener.h +++ b/indra/newview/llagentlistener.h @@ -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; diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 7c56e610ce..97fa551441 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  { @@ -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;  	}  } diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h index c52a25818b..3f9852f194 100644 --- a/indra/newview/llgroupactions.h +++ b/indra/newview/llgroupactions.h @@ -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. | 
