llinstantmessage.h

Go to the documentation of this file.
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 // The ImprovedInstantMessage only supports 8 bits in the "Dialog"
00044 // field, so don't go past the byte boundary
00045 enum EInstantMessage
00046 {
00047         // default. ID is meaningless, nothing in the binary bucket.
00048         IM_NOTHING_SPECIAL = 0,
00049 
00050         // pops a messagebox with a single OK button
00051         IM_MESSAGEBOX = 1,
00052 
00053         // pops a countdown messagebox with a single OK button
00054         // IM_MESSAGEBOX_COUNTDOWN = 2,
00055 
00056         // You've been invited to join a group.
00057         // ID is the group id.
00058 
00059         // The binary bucket contains a null terminated string
00060         // representation of the officer/member status and join cost for
00061         // the invitee. (bug # 7672) The format is 1 byte for
00062         // officer/member (O for officer, M for member), and as many bytes
00063         // as necessary for cost.
00064         IM_GROUP_INVITATION = 3,
00065 
00066         // Inventory offer.
00067         // ID is the transaction id
00068         // Binary bucket is a list of inventory uuid and type. 
00069         IM_INVENTORY_OFFERED = 4,
00070         IM_INVENTORY_ACCEPTED = 5,
00071         IM_INVENTORY_DECLINED = 6,
00072 
00073         // Group vote
00074         // Name is name of person who called vote.
00075         // ID is vote ID used for internal tracking
00076         IM_GROUP_VOTE = 7,
00077 
00078         // Group message
00079         // This means that the message is meant for everyone in the
00080         // agent's group. This will result in a database query to find all
00081         // participants and start an im session.
00082         IM_GROUP_MESSAGE_DEPRECATED = 8,
00083 
00084         // Task inventory offer.
00085         // ID is the transaction id
00086         // Binary bucket is a (mostly) complete packed inventory item
00087         IM_TASK_INVENTORY_OFFERED = 9,
00088         IM_TASK_INVENTORY_ACCEPTED = 10,
00089         IM_TASK_INVENTORY_DECLINED = 11,
00090 
00091         // Copied as pending, type LL_NOTHING_SPECIAL, for new users
00092         // used by offline tools
00093         IM_NEW_USER_DEFAULT = 12,
00094 
00095         //
00096         // session based messaging - the way that people usually actually
00097         // communicate with each other.
00098         //
00099 
00100         // Invite users to a session.
00101         IM_SESSION_INVITE = 13,
00102 
00103         IM_SESSION_P2P_INVITE = 14,
00104 
00105         // start a session with your gruop
00106         IM_SESSION_GROUP_START = 15,
00107 
00108         // start a session without a calling card (finder or objects)
00109         IM_SESSION_CONFERENCE_START = 16,
00110 
00111         // send a message to a session.
00112         IM_SESSION_SEND = 17,
00113 
00114         // leave a session
00115         IM_SESSION_LEAVE = 18,
00116 
00117         // an instant message from an object - for differentiation on the
00118         // viewer, since you can't IM an object yet.
00119         IM_FROM_TASK = 19,
00120 
00121         // sent an IM to a busy user, this is the auto response
00122         IM_BUSY_AUTO_RESPONSE = 20,
00123 
00124         // Shows the message in the console and chat history
00125         IM_CONSOLE_AND_CHAT_HISTORY = 21,
00126 
00127         // IM Types used for luring your friends
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         // IM that notifie of a new group election.
00135         // Name is name of person who called vote.
00136         // ID is election ID used for internal tracking
00137         IM_GROUP_ELECTION_DEPRECATED = 27,
00138 
00139         // IM to tell the user to go to an URL. Put a text message in the
00140         // message field, and put the url with a trailing \0 in the binary
00141         // bucket.
00142         IM_GOTO_URL = 28,
00143 
00144         // a message generated by a script which we don't want to
00145         // be sent through e-mail.  Similar to IM_FROM_TASK, but
00146         // it is shown as an alert on the viewer.
00147         IM_FROM_TASK_AS_ALERT = 31,
00148 
00149         // IM from group officer to all group members.
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 // Hooks for quickly hacking in experimental admin debug messages 
00171 // without needing to recompile the viewer
00172 // *NOTE: This functionality has been moved to be a string based
00173 // operation so that we don't even have to do a full recompile. This
00174 // enumeration will be phased out soon.
00175 enum EGodlikeRequest
00176 {
00177         GOD_WANTS_NOTHING,
00178 
00179         // for requesting physics information about an object
00180         GOD_WANTS_HAVOK_INFO,
00181         
00182         // two unused requests that can be appropriated for debug 
00183         // purposes (no viewer recompile necessary)
00184         GOD_WANTS_FOO,
00185         GOD_WANTS_BAR,
00186 
00187         // to dump simulator terrain data to terrain.raw file
00188         GOD_WANTS_TERRAIN_SAVE,
00189         // to load simulator terrain data from terrain.raw file
00190         GOD_WANTS_TERRAIN_LOAD,
00191 
00192         GOD_WANTS_TOGGLE_AVATAR_GEOMETRY,       // HACK for testing new avatar geom
00193 
00194         // real-time telehub operations
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 // Number of retry attempts on sending the im.
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 

Generated on Thu Jul 1 06:08:44 2010 for Second Life Viewer by  doxygen 1.4.7