00001
00032 #ifndef LL_LLINSTANTMESSAGE_H
00033 #define LL_LLINSTANTMESSAGE_H
00034
00035 #include "llhost.h"
00036 #include "lluuid.h"
00037 #include "llsd.h"
00038 #include "llmemory.h"
00039 #include "v3math.h"
00040
00041 class LLMessageSystem;
00042
00043
00044
00045 enum EInstantMessage
00046 {
00047
00048 IM_NOTHING_SPECIAL = 0,
00049
00050
00051 IM_MESSAGEBOX = 1,
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 IM_GROUP_INVITATION = 3,
00065
00066
00067
00068
00069 IM_INVENTORY_OFFERED = 4,
00070 IM_INVENTORY_ACCEPTED = 5,
00071 IM_INVENTORY_DECLINED = 6,
00072
00073
00074
00075
00076 IM_GROUP_VOTE = 7,
00077
00078
00079
00080
00081
00082 IM_GROUP_MESSAGE_DEPRECATED = 8,
00083
00084
00085
00086
00087 IM_TASK_INVENTORY_OFFERED = 9,
00088 IM_TASK_INVENTORY_ACCEPTED = 10,
00089 IM_TASK_INVENTORY_DECLINED = 11,
00090
00091
00092
00093 IM_NEW_USER_DEFAULT = 12,
00094
00095
00096
00097
00098
00099
00100
00101 IM_SESSION_INVITE = 13,
00102
00103 IM_SESSION_P2P_INVITE = 14,
00104
00105
00106 IM_SESSION_GROUP_START = 15,
00107
00108
00109 IM_SESSION_CONFERENCE_START = 16,
00110
00111
00112 IM_SESSION_SEND = 17,
00113
00114
00115 IM_SESSION_LEAVE = 18,
00116
00117
00118
00119 IM_FROM_TASK = 19,
00120
00121
00122 IM_BUSY_AUTO_RESPONSE = 20,
00123
00124
00125 IM_CONSOLE_AND_CHAT_HISTORY = 21,
00126
00127
00128 IM_LURE_USER = 22,
00129 IM_LURE_ACCEPTED = 23,
00130 IM_LURE_DECLINED = 24,
00131 IM_GODLIKE_LURE_USER = 25,
00132 IM_YET_TO_BE_USED = 26,
00133
00134
00135
00136
00137 IM_GROUP_ELECTION_DEPRECATED = 27,
00138
00139
00140
00141
00142 IM_GOTO_URL = 28,
00143
00144
00145
00146
00147 IM_FROM_TASK_AS_ALERT = 31,
00148
00149
00150 IM_GROUP_NOTICE = 32,
00151 IM_GROUP_NOTICE_INVENTORY_ACCEPTED = 33,
00152 IM_GROUP_NOTICE_INVENTORY_DECLINED = 34,
00153
00154 IM_GROUP_INVITATION_ACCEPT = 35,
00155 IM_GROUP_INVITATION_DECLINE = 36,
00156
00157 IM_GROUP_NOTICE_REQUESTED = 37,
00158
00159 IM_FRIENDSHIP_OFFERED = 38,
00160 IM_FRIENDSHIP_ACCEPTED = 39,
00161 IM_FRIENDSHIP_DECLINED = 40,
00162
00163 IM_TYPING_START = 41,
00164 IM_TYPING_STOP = 42,
00165
00166 IM_COUNT
00167 };
00168
00169
00170
00171
00172
00173
00174
00175 enum EGodlikeRequest
00176 {
00177 GOD_WANTS_NOTHING,
00178
00179
00180 GOD_WANTS_HAVOK_INFO,
00181
00182
00183
00184 GOD_WANTS_FOO,
00185 GOD_WANTS_BAR,
00186
00187
00188 GOD_WANTS_TERRAIN_SAVE,
00189
00190 GOD_WANTS_TERRAIN_LOAD,
00191
00192 GOD_WANTS_TOGGLE_AVATAR_GEOMETRY,
00193
00194
00195 GOD_WANTS_TELEHUB_INFO,
00196 GOD_WANTS_CONNECT_TELEHUB,
00197 GOD_WANTS_DELETE_TELEHUB,
00198 GOD_WANTS_ADD_TELEHUB_SPAWNPOINT,
00199 GOD_WANTS_REMOVE_TELEHUB_SPAWNPOINT,
00200
00201 };
00202
00203 enum EIMSource
00204 {
00205 IM_FROM_VIEWER,
00206 IM_FROM_DATASERVER,
00207 IM_FROM_SIM
00208 };
00209
00210 extern const U8 IM_ONLINE;
00211 extern const U8 IM_OFFLINE;
00212
00213 extern const S32 VOTE_YES;
00214 extern const S32 VOTE_NO;
00215 extern const S32 VOTE_ABSTAIN;
00216
00217 extern const S32 VOTE_MAJORITY;
00218 extern const S32 VOTE_SUPER_MAJORITY;
00219 extern const S32 VOTE_UNANIMOUS;
00220
00221 extern const char EMPTY_BINARY_BUCKET[];
00222 extern const S32 EMPTY_BINARY_BUCKET_SIZE;
00223
00224 extern const U32 NO_TIMESTAMP;
00225 extern const char SYSTEM_FROM[];
00226
00227
00228 extern const S32 IM_TTL;
00229
00230
00231 class LLIMInfo : public LLRefCount
00232 {
00233 protected:
00234 LLIMInfo();
00235 ~LLIMInfo();
00236
00237 public:
00238 LLIMInfo(LLMessageSystem* msg,
00239 EIMSource source = IM_FROM_SIM,
00240 S32 ttl = IM_TTL);
00241
00242 LLIMInfo(
00243 const LLUUID& from_id,
00244 BOOL from_group,
00245 const LLUUID& to_id,
00246 EInstantMessage im_type,
00247 const std::string& name,
00248 const std::string& message,
00249 const LLUUID& id,
00250 U32 parent_estate_id,
00251 const LLUUID& region_id,
00252 const LLVector3& position,
00253 LLSD data,
00254 U8 offline,
00255 U32 timestamp,
00256 EIMSource source,
00257 S32 ttl = IM_TTL);
00258
00259 void packInstantMessage(LLMessageSystem* msg) const;
00260 void packMessageBlock(LLMessageSystem* msg) const;
00261 void unpackMessageBlock(LLMessageSystem* msg);
00262 LLPointer<LLIMInfo> clone();
00263 public:
00264 LLUUID mFromID;
00265 BOOL mFromGroup;
00266 LLUUID mToID;
00267 U32 mParentEstateID;
00268 LLUUID mRegionID;
00269 LLVector3 mPosition;
00270 U8 mOffline;
00271 bool mViewerThinksToIsOnline;
00272 EInstantMessage mIMType;
00273 LLUUID mID;
00274 U32 mTimeStamp;
00275 std::string mName;
00276 std::string mMessage;
00277 LLSD mData;
00278
00279 EIMSource mSource;
00280 S32 mTTL;
00281 };
00282
00283 LLPointer<LLIMInfo> llsd_to_im_info(const LLSD& im_info_sd);
00284 LLSD im_info_to_llsd(LLPointer<LLIMInfo> im_info);
00285
00286 void pack_instant_message(
00287 LLMessageSystem* msgsystem,
00288 const LLUUID& from_id,
00289 BOOL from_group,
00290 const LLUUID& session_id,
00291 const LLUUID& to_id,
00292 const char* name,
00293 const char* message,
00294 U8 offline = IM_ONLINE,
00295 EInstantMessage dialog = IM_NOTHING_SPECIAL,
00296 const LLUUID& id = LLUUID::null,
00297 U32 parent_estate_id = 0,
00298 const LLUUID& region_id = LLUUID::null,
00299 const LLVector3& position = LLVector3::zero,
00300 U32 timestamp = NO_TIMESTAMP,
00301 const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET,
00302 S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE);
00303
00304 void pack_instant_message_block(
00305 LLMessageSystem* msgsystem,
00306 const LLUUID& from_id,
00307 BOOL from_group,
00308 const LLUUID& session_id,
00309 const LLUUID& to_id,
00310 const char* name,
00311 const char* message,
00312 U8 offline = IM_ONLINE,
00313 EInstantMessage dialog = IM_NOTHING_SPECIAL,
00314 const LLUUID& id = LLUUID::null,
00315 U32 parent_estate_id = 0,
00316 const LLUUID& region_id = LLUUID::null,
00317 const LLVector3& position = LLVector3::zero,
00318 U32 timestamp = NO_TIMESTAMP,
00319 const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET,
00320 S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE);
00321
00322
00323 #endif // LL_LLINSTANTMESSAGE_H
00324