PageRenderTime 899ms CodeModel.GetById 892ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/groupchatlistener.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 76 lines | 33 code | 6 blank | 37 comment | 0 complexity | bd8ec212a4266db2a6e4f75373e26c8d MD5 | raw file
 1/**
 2 * @file   groupchatlistener.cpp
 3 * @author Nat Goodspeed
 4 * @date   2011-04-11
 5 * @brief  Implementation for groupchatlistener.
 6 * 
 7 * $LicenseInfo:firstyear=2011&license=viewerlgpl$
 8 * Second Life Viewer Source Code
 9 * Copyright (C) 2011, Linden Research, Inc.
10 * 
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation;
14 * version 2.1 of the License only.
15 * 
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * Lesser General Public License for more details.
20 * 
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 * 
25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
26 * $/LicenseInfo$
27 */
28
29// Precompiled header
30#include "llviewerprecompiledheaders.h"
31// associated header
32#include "groupchatlistener.h"
33// STL headers
34// std headers
35// external library headers
36// other Linden headers
37#include "llgroupactions.h"
38#include "llimview.h"
39
40
41namespace {
42	void startIm_wrapper(LLSD const & event)
43	{
44		LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID());
45		sendReply(LLSDMap("session_id", LLSD(session_id)), event);
46	}
47
48	void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id)
49	{
50		LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START);
51	}
52}
53
54
55GroupChatListener::GroupChatListener():
56    LLEventAPI("GroupChat",
57               "API to enter, leave, send and intercept group chat messages")
58{
59    add("startIM",
60        "Enter a group chat in group with UUID [\"id\"]\n"
61        "Assumes the logged-in agent is already a member of this group.",
62        &startIm_wrapper);
63    add("endIM",
64        "Leave a group chat in group with UUID [\"id\"]\n"
65        "Assumes a prior successful startIM request.",
66        &LLGroupActions::endIM,
67        LLSDArray("id"));
68	add("sendIM",
69		"send a groupchat IM",
70		&send_message_wrapper,
71        LLSDArray("text")("session_id")("group_id"));
72}
73/*
74	static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
75								const LLUUID& other_participant_id, EInstantMessage dialog);
76*/