00001
00032 #ifndef LL_LLIMVIEW_H
00033 #define LL_LLIMVIEW_H
00034
00035 #include "llfloater.h"
00036 #include "llinstantmessage.h"
00037 #include "lluuid.h"
00038
00039 class LLFloaterChatterBox;
00040 class LLUUID;
00041 class LLFloaterIMPanel;
00042 class LLFriendObserver;
00043 class LLFloaterIM;
00044
00045 class LLIMMgr : public LLSingleton<LLIMMgr>
00046 {
00047 public:
00048 enum EInvitationType
00049 {
00050 INVITATION_TYPE_INSTANT_MESSAGE = 0,
00051 INVITATION_TYPE_VOICE = 1,
00052 INVITATION_TYPE_IMMEDIATE = 2
00053 };
00054
00055 LLIMMgr();
00056 virtual ~LLIMMgr();
00057
00058
00059
00060 void addMessage(const LLUUID& session_id,
00061 const LLUUID& target_id,
00062 const char* from,
00063 const char* msg,
00064 const char* session_name = NULL,
00065 EInstantMessage dialog = IM_NOTHING_SPECIAL,
00066 U32 parent_estate_id = 0,
00067 const LLUUID& region_id = LLUUID::null,
00068 const LLVector3& position = LLVector3::zero,
00069 bool link_name = false);
00070
00071 void addSystemMessage(const LLUUID& session_id, const LLString& message_name, const LLString::format_map_t& args);
00072
00073
00074
00075
00076 BOOL isIMSessionOpen(const LLUUID& uuid);
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 LLUUID addSession(const std::string& name,
00087 EInstantMessage dialog,
00088 const LLUUID& other_participant_id);
00089
00090
00091
00092 LLUUID addSession(const std::string& name,
00093 EInstantMessage dialog,
00094 const LLUUID& other_participant_id,
00095 const LLDynamicArray<LLUUID>& ids);
00096
00097
00098 LLUUID addP2PSession(const std::string& name,
00099 const LLUUID& other_participant_id,
00100 const LLString& voice_session_handle);
00101
00102
00103
00104
00105 void removeSession(const LLUUID& session_id);
00106
00107 void inviteToSession(
00108 const LLUUID& session_id,
00109 const LLString& session_name,
00110 const LLUUID& caller,
00111 const LLString& caller_name,
00112 EInstantMessage type,
00113 EInvitationType inv_type,
00114 const LLString& session_handle = LLString::null);
00115
00116
00117
00118
00119 void updateFloaterSessionID(const LLUUID& old_session_id,
00120 const LLUUID& new_session_id);
00121
00122 void processIMTypingStart(const LLIMInfo* im_info);
00123 void processIMTypingStop(const LLIMInfo* im_info);
00124
00125
00126 void refresh();
00127
00128 void notifyNewIM();
00129 void clearNewIMNotification();
00130
00131
00132 BOOL getIMReceived() const;
00133
00134 void setFloaterOpen(BOOL open);
00135 BOOL getFloaterOpen();
00136
00137 LLFloaterChatterBox* getFloater();
00138
00139
00140
00141
00142
00143 void disconnectAllSessions();
00144
00145 static void toggle(void*);
00146
00147
00148
00149 static EInstantMessage defaultIMTypeForAgent(const LLUUID& agent_id);
00150
00151 BOOL hasSession(const LLUUID& session_id);
00152
00153
00154
00155
00156 LLFloaterIMPanel* findFloaterBySession(const LLUUID& session_id);
00157
00158 static LLUUID computeSessionID(EInstantMessage dialog, const LLUUID& other_participant_id);
00159
00160 void clearPendingInviation(const LLUUID& session_id);
00161
00162 LLSD getPendingAgentListUpdates(const LLUUID& session_id);
00163 void addPendingAgentListUpdates(
00164 const LLUUID& sessioN_id,
00165 const LLSD& updates);
00166 void clearPendingAgentListUpdates(const LLUUID& session_id);
00167
00168
00169 const std::set<LLHandle<LLFloater> >& getIMFloaterHandles() { return mFloaters; }
00170
00171 private:
00172 class LLIMSessionInvite;
00173
00174
00175
00176
00177
00178 LLFloaterIMPanel* createFloater(const LLUUID& session_id,
00179 const LLUUID& target_id,
00180 const std::string& name,
00181 EInstantMessage dialog,
00182 BOOL user_initiated = FALSE);
00183
00184 LLFloaterIMPanel* createFloater(const LLUUID& session_id,
00185 const LLUUID& target_id,
00186 const std::string& name,
00187 const LLDynamicArray<LLUUID>& ids,
00188 EInstantMessage dialog,
00189 BOOL user_initiated = FALSE);
00190
00191
00192
00193
00194
00195 void noteOfflineUsers(LLFloaterIMPanel* panel, const LLDynamicArray<LLUUID>& ids);
00196 void noteMutedUsers(LLFloaterIMPanel* panel, const LLDynamicArray<LLUUID>& ids);
00197
00198 void processIMTypingCore(const LLIMInfo* im_info, BOOL typing);
00199
00200 static void inviteUserResponse(S32 option, void* user_data);
00201 static void onInviteNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* userdata);
00202
00203 private:
00204 std::set<LLHandle<LLFloater> > mFloaters;
00205 LLFriendObserver* mFriendObserver;
00206
00207
00208 BOOL mIMReceived;
00209
00210 LLSD mPendingInvitations;
00211 LLSD mPendingAgentListUpdates;
00212 };
00213
00214
00215 class LLFloaterIM : public LLMultiFloater
00216 {
00217 public:
00218 LLFloaterIM();
00219 BOOL postBuild();
00220
00221 static std::map<std::string,LLString> sEventStringsMap;
00222 static std::map<std::string,LLString> sErrorStringsMap;
00223 static std::map<std::string,LLString> sForceCloseSessionMap;
00224 };
00225
00226
00227 extern LLIMMgr *gIMMgr;
00228
00229 #endif // LL_LLIMView_H