PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. // Precompiled header
  29. #include "llviewerprecompiledheaders.h"
  30. // associated header
  31. #include "groupchatlistener.h"
  32. // STL headers
  33. // std headers
  34. // external library headers
  35. // other Linden headers
  36. #include "llgroupactions.h"
  37. #include "llimview.h"
  38. namespace {
  39. void startIm_wrapper(LLSD const & event)
  40. {
  41. LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID());
  42. sendReply(LLSDMap("session_id", LLSD(session_id)), event);
  43. }
  44. void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id)
  45. {
  46. LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START);
  47. }
  48. }
  49. GroupChatListener::GroupChatListener():
  50. LLEventAPI("GroupChat",
  51. "API to enter, leave, send and intercept group chat messages")
  52. {
  53. add("startIM",
  54. "Enter a group chat in group with UUID [\"id\"]\n"
  55. "Assumes the logged-in agent is already a member of this group.",
  56. &startIm_wrapper);
  57. add("endIM",
  58. "Leave a group chat in group with UUID [\"id\"]\n"
  59. "Assumes a prior successful startIM request.",
  60. &LLGroupActions::endIM,
  61. LLSDArray("id"));
  62. add("sendIM",
  63. "send a groupchat IM",
  64. &send_message_wrapper,
  65. LLSDArray("text")("session_id")("group_id"));
  66. }
  67. /*
  68. static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
  69. const LLUUID& other_participant_id, EInstantMessage dialog);
  70. */