PageRenderTime 114ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llmessage/llinstantmessage.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 322 lines | 172 code | 60 blank | 90 comment | 0 complexity | b9f9553b1597dceea29f93a054e31482 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llinstantmessage.h
  3. * @brief Constants and declarations used by instant messages.
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLINSTANTMESSAGE_H
  27. #define LL_LLINSTANTMESSAGE_H
  28. #include "llhost.h"
  29. #include "lluuid.h"
  30. #include "llsd.h"
  31. #include "llrefcount.h"
  32. #include "llpointer.h"
  33. #include "v3math.h"
  34. class LLMessageSystem;
  35. // The ImprovedInstantMessage only supports 8 bits in the "Dialog"
  36. // field, so don't go past the byte boundary
  37. enum EInstantMessage
  38. {
  39. // default. ID is meaningless, nothing in the binary bucket.
  40. IM_NOTHING_SPECIAL = 0,
  41. // pops a messagebox with a single OK button
  42. IM_MESSAGEBOX = 1,
  43. // pops a countdown messagebox with a single OK button
  44. // IM_MESSAGEBOX_COUNTDOWN = 2,
  45. // You've been invited to join a group.
  46. // ID is the group id.
  47. // The binary bucket contains a null terminated string
  48. // representation of the officer/member status and join cost for
  49. // the invitee. (bug # 7672) The format is 1 byte for
  50. // officer/member (O for officer, M for member), and as many bytes
  51. // as necessary for cost.
  52. IM_GROUP_INVITATION = 3,
  53. // Inventory offer.
  54. // ID is the transaction id
  55. // Binary bucket is a list of inventory uuid and type.
  56. IM_INVENTORY_OFFERED = 4,
  57. IM_INVENTORY_ACCEPTED = 5,
  58. IM_INVENTORY_DECLINED = 6,
  59. // Group vote
  60. // Name is name of person who called vote.
  61. // ID is vote ID used for internal tracking
  62. // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856
  63. IM_GROUP_VOTE = 7,
  64. // Group message
  65. // This means that the message is meant for everyone in the
  66. // agent's group. This will result in a database query to find all
  67. // participants and start an im session.
  68. IM_GROUP_MESSAGE_DEPRECATED = 8,
  69. // Task inventory offer.
  70. // ID is the transaction id
  71. // Binary bucket is a (mostly) complete packed inventory item
  72. IM_TASK_INVENTORY_OFFERED = 9,
  73. IM_TASK_INVENTORY_ACCEPTED = 10,
  74. IM_TASK_INVENTORY_DECLINED = 11,
  75. // Copied as pending, type LL_NOTHING_SPECIAL, for new users
  76. // used by offline tools
  77. IM_NEW_USER_DEFAULT = 12,
  78. //
  79. // session based messaging - the way that people usually actually
  80. // communicate with each other.
  81. //
  82. // Invite users to a session.
  83. IM_SESSION_INVITE = 13,
  84. IM_SESSION_P2P_INVITE = 14,
  85. // start a session with your gruop
  86. IM_SESSION_GROUP_START = 15,
  87. // start a session without a calling card (finder or objects)
  88. IM_SESSION_CONFERENCE_START = 16,
  89. // send a message to a session.
  90. IM_SESSION_SEND = 17,
  91. // leave a session
  92. IM_SESSION_LEAVE = 18,
  93. // an instant message from an object - for differentiation on the
  94. // viewer, since you can't IM an object yet.
  95. IM_FROM_TASK = 19,
  96. // sent an IM to a busy user, this is the auto response
  97. IM_BUSY_AUTO_RESPONSE = 20,
  98. // Shows the message in the console and chat history
  99. IM_CONSOLE_AND_CHAT_HISTORY = 21,
  100. // IM Types used for luring your friends
  101. IM_LURE_USER = 22,
  102. IM_LURE_ACCEPTED = 23,
  103. IM_LURE_DECLINED = 24,
  104. IM_GODLIKE_LURE_USER = 25,
  105. IM_YET_TO_BE_USED = 26,
  106. // IM that notifie of a new group election.
  107. // Name is name of person who called vote.
  108. // ID is election ID used for internal tracking
  109. IM_GROUP_ELECTION_DEPRECATED = 27,
  110. // IM to tell the user to go to an URL. Put a text message in the
  111. // message field, and put the url with a trailing \0 in the binary
  112. // bucket.
  113. IM_GOTO_URL = 28,
  114. // a message generated by a script which we don't want to
  115. // be sent through e-mail. Similar to IM_FROM_TASK, but
  116. // it is shown as an alert on the viewer.
  117. IM_FROM_TASK_AS_ALERT = 31,
  118. // IM from group officer to all group members.
  119. IM_GROUP_NOTICE = 32,
  120. IM_GROUP_NOTICE_INVENTORY_ACCEPTED = 33,
  121. IM_GROUP_NOTICE_INVENTORY_DECLINED = 34,
  122. IM_GROUP_INVITATION_ACCEPT = 35,
  123. IM_GROUP_INVITATION_DECLINE = 36,
  124. IM_GROUP_NOTICE_REQUESTED = 37,
  125. IM_FRIENDSHIP_OFFERED = 38,
  126. IM_FRIENDSHIP_ACCEPTED = 39,
  127. IM_FRIENDSHIP_DECLINED_DEPRECATED = 40,
  128. IM_TYPING_START = 41,
  129. IM_TYPING_STOP = 42,
  130. IM_COUNT
  131. };
  132. // Hooks for quickly hacking in experimental admin debug messages
  133. // without needing to recompile the viewer
  134. // *NOTE: This functionality has been moved to be a string based
  135. // operation so that we don't even have to do a full recompile. This
  136. // enumeration will be phased out soon.
  137. enum EGodlikeRequest
  138. {
  139. GOD_WANTS_NOTHING,
  140. // for requesting physics information about an object
  141. GOD_WANTS_PHYSICS_INFO,
  142. // two unused requests that can be appropriated for debug
  143. // purposes (no viewer recompile necessary)
  144. GOD_WANTS_FOO,
  145. GOD_WANTS_BAR,
  146. // to dump simulator terrain data to terrain.raw file
  147. GOD_WANTS_TERRAIN_SAVE,
  148. // to load simulator terrain data from terrain.raw file
  149. GOD_WANTS_TERRAIN_LOAD,
  150. GOD_WANTS_TOGGLE_AVATAR_GEOMETRY, // HACK for testing new avatar geom
  151. // real-time telehub operations
  152. GOD_WANTS_TELEHUB_INFO,
  153. GOD_WANTS_CONNECT_TELEHUB,
  154. GOD_WANTS_DELETE_TELEHUB,
  155. GOD_WANTS_ADD_TELEHUB_SPAWNPOINT,
  156. GOD_WANTS_REMOVE_TELEHUB_SPAWNPOINT,
  157. };
  158. enum EIMSource
  159. {
  160. IM_FROM_VIEWER,
  161. IM_FROM_DATASERVER,
  162. IM_FROM_SIM
  163. };
  164. extern const U8 IM_ONLINE;
  165. extern const U8 IM_OFFLINE;
  166. extern const S32 VOTE_YES;
  167. extern const S32 VOTE_NO;
  168. extern const S32 VOTE_ABSTAIN;
  169. extern const S32 VOTE_MAJORITY;
  170. extern const S32 VOTE_SUPER_MAJORITY;
  171. extern const S32 VOTE_UNANIMOUS;
  172. extern const char EMPTY_BINARY_BUCKET[];
  173. extern const S32 EMPTY_BINARY_BUCKET_SIZE;
  174. extern const U32 NO_TIMESTAMP;
  175. extern const std::string SYSTEM_FROM;
  176. extern const std::string INTERACTIVE_SYSTEM_FROM;
  177. // Number of retry attempts on sending the im.
  178. extern const S32 IM_TTL;
  179. class LLIMInfo : public LLRefCount
  180. {
  181. protected:
  182. LLIMInfo();
  183. ~LLIMInfo();
  184. public:
  185. LLIMInfo(LLMessageSystem* msg,
  186. EIMSource source = IM_FROM_SIM,
  187. S32 ttl = IM_TTL);
  188. LLIMInfo(
  189. const LLUUID& from_id,
  190. BOOL from_group,
  191. const LLUUID& to_id,
  192. EInstantMessage im_type,
  193. const std::string& name,
  194. const std::string& message,
  195. const LLUUID& id,
  196. U32 parent_estate_id,
  197. const LLUUID& region_id,
  198. const LLVector3& position,
  199. LLSD data,
  200. U8 offline,
  201. U32 timestamp,
  202. EIMSource source,
  203. S32 ttl = IM_TTL);
  204. void packInstantMessage(LLMessageSystem* msg) const;
  205. void packMessageBlock(LLMessageSystem* msg) const;
  206. void unpackMessageBlock(LLMessageSystem* msg);
  207. LLPointer<LLIMInfo> clone();
  208. public:
  209. LLUUID mFromID;
  210. BOOL mFromGroup;
  211. LLUUID mToID;
  212. U32 mParentEstateID;
  213. LLUUID mRegionID;
  214. LLVector3 mPosition;
  215. U8 mOffline;
  216. bool mViewerThinksToIsOnline;
  217. EInstantMessage mIMType;
  218. LLUUID mID;
  219. U32 mTimeStamp;
  220. std::string mName;
  221. std::string mMessage;
  222. LLSD mData;
  223. EIMSource mSource;
  224. S32 mTTL;
  225. };
  226. LLPointer<LLIMInfo> llsd_to_im_info(const LLSD& im_info_sd);
  227. LLSD im_info_to_llsd(LLPointer<LLIMInfo> im_info);
  228. void pack_instant_message(
  229. LLMessageSystem* msgsystem,
  230. const LLUUID& from_id,
  231. BOOL from_group,
  232. const LLUUID& session_id,
  233. const LLUUID& to_id,
  234. const std::string& name,
  235. const std::string& message,
  236. U8 offline = IM_ONLINE,
  237. EInstantMessage dialog = IM_NOTHING_SPECIAL,
  238. const LLUUID& id = LLUUID::null,
  239. U32 parent_estate_id = 0,
  240. const LLUUID& region_id = LLUUID::null,
  241. const LLVector3& position = LLVector3::zero,
  242. U32 timestamp = NO_TIMESTAMP,
  243. const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET,
  244. S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE);
  245. void pack_instant_message_block(
  246. LLMessageSystem* msgsystem,
  247. const LLUUID& from_id,
  248. BOOL from_group,
  249. const LLUUID& session_id,
  250. const LLUUID& to_id,
  251. const std::string& name,
  252. const std::string& message,
  253. U8 offline = IM_ONLINE,
  254. EInstantMessage dialog = IM_NOTHING_SPECIAL,
  255. const LLUUID& id = LLUUID::null,
  256. U32 parent_estate_id = 0,
  257. const LLUUID& region_id = LLUUID::null,
  258. const LLVector3& position = LLVector3::zero,
  259. U32 timestamp = NO_TIMESTAMP,
  260. const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET,
  261. S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE);
  262. #endif // LL_LLINSTANTMESSAGE_H