llchat.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * @file llchat.h
  3. * @author James Cook
  4. * @brief Chat constants and data structures.
  5. *
  6. * $LicenseInfo:firstyear=2006&license=viewergpl$
  7. *
  8. * Copyright (c) 2006-2009, Linden Research, Inc.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #ifndef LL_LLCHAT_H
  34. #define LL_LLCHAT_H
  35. #include "lluuid.h"
  36. #include "llvector3.h"
  37. // enumerations used by the chat system
  38. typedef enum e_chat_source_type
  39. {
  40. CHAT_SOURCE_SYSTEM = 0,
  41. CHAT_SOURCE_AGENT = 1,
  42. CHAT_SOURCE_OBJECT = 2,
  43. CHAT_SOURCE_UNKNOWN = 3
  44. } EChatSourceType;
  45. typedef enum e_chat_type
  46. {
  47. CHAT_TYPE_WHISPER = 0,
  48. CHAT_TYPE_NORMAL = 1,
  49. CHAT_TYPE_SHOUT = 2,
  50. CHAT_TYPE_START = 4,
  51. CHAT_TYPE_STOP = 5,
  52. CHAT_TYPE_DEBUG_MSG = 6,
  53. CHAT_TYPE_REGION = 7,
  54. CHAT_TYPE_OWNER = 8,
  55. CHAT_TYPE_DIRECT = 9 // From llRegionSayTo()
  56. } EChatType;
  57. typedef enum e_chat_audible_level
  58. {
  59. CHAT_AUDIBLE_NOT = -1,
  60. CHAT_AUDIBLE_BARELY = 0,
  61. CHAT_AUDIBLE_FULLY = 1
  62. } EChatAudible;
  63. // A piece of chat
  64. class LLChat
  65. {
  66. public:
  67. LLChat(const std::string& text = std::string())
  68. : mText(text),
  69. mSourceType(CHAT_SOURCE_UNKNOWN),
  70. mChatType(CHAT_TYPE_NORMAL),
  71. mAudible(CHAT_AUDIBLE_FULLY),
  72. mMuted(false),
  73. mTime(0.0)
  74. {
  75. }
  76. LLChat(const LLChat& chat)
  77. : mText(chat.mText),
  78. mFromName(chat.mFromName),
  79. mFromID(chat.mFromID),
  80. mOwnerID(chat.mOwnerID),
  81. mSourceType(chat.mSourceType),
  82. mChatType(chat.mChatType),
  83. mAudible(chat.mAudible),
  84. mMuted(chat.mMuted),
  85. mTime(chat.mTime),
  86. mPosAgent(chat.mPosAgent),
  87. mURL(chat.mURL)
  88. {
  89. }
  90. public:
  91. LLUUID mFromID; // agent id or object id
  92. LLUUID mOwnerID; // owner id of chatting object
  93. LLVector3 mPosAgent;
  94. F64 mTime; // viewer only, seconds from viewer start
  95. EChatSourceType mSourceType;
  96. EChatType mChatType;
  97. EChatAudible mAudible;
  98. std::string mText; // UTF-8 line of text
  99. std::string mFromName; // agent or object name
  100. std::string mURL;
  101. bool mMuted; // pass muted chat to maintain list of chatters
  102. };
  103. #endif