llimview.h

Go to the documentation of this file.
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         LLIMMgr();
00049         virtual ~LLIMMgr();
00050 
00051         // Add a message to a session. The session can keyed to sesion id
00052         // or agent id.
00053         void addMessage(const LLUUID& session_id,
00054                                         const LLUUID& target_id,
00055                                         const char* from,
00056                                         const char* msg,
00057                                         const char* session_name = NULL,
00058                                         EInstantMessage dialog = IM_NOTHING_SPECIAL,
00059                                         U32 parent_estate_id = 0,
00060                                         const LLUUID& region_id = LLUUID::null,
00061                                         const LLVector3& position = LLVector3::zero);
00062 
00063         void addSystemMessage(const LLUUID& session_id, const LLString& message_name, const LLString::format_map_t& args);
00064 
00065         // This method returns TRUE if the local viewer has a session
00066         // currently open keyed to the uuid. The uuid can be keyed by
00067         // either session id or agent id.
00068         BOOL isIMSessionOpen(const LLUUID& uuid);
00069 
00070         // This adds a session to the talk view. The name is the local
00071         // name of the session, dialog specifies the type of
00072         // session. Since sessions can be keyed off of first recipient or
00073         // initiator, the session can be matched against the id
00074         // provided. If the session exists, it is brought forward.  This
00075         // method accepts a group id or an agent id. Specifying id = NULL
00076         // results in an im session to everyone. Returns the uuid of the
00077         // session.
00078         LLUUID addSession(const std::string& name,
00079                                           EInstantMessage dialog,
00080                                           const LLUUID& other_participant_id);
00081 
00082         // Adds a session using a specific group of starting agents
00083         // the dialog type is assumed correct. Returns the uuid of the session.
00084         LLUUID addSession(const std::string& name,
00085                                           EInstantMessage dialog,
00086                                           const LLUUID& other_participant_id,
00087                                           const LLDynamicArray<LLUUID>& ids);
00088 
00089         // Creates a P2P session with the requisite handle for responding to voice calls
00090         LLUUID addP2PSession(const std::string& name,
00091                                           const LLUUID& other_participant_id,
00092                                           const LLString& voice_session_handle);
00093 
00094         // This removes the panel referenced by the uuid, and then
00095         // restores internal consistency. The internal pointer is not
00096         // deleted.
00097         void removeSession(const LLUUID& session_id);
00098 
00099         void inviteToSession(const LLUUID& session_id, 
00100                                                 const LLString& session_name, 
00101                                                 const LLUUID& caller, 
00102                                                 const LLString& caller_name,
00103                                                 EInstantMessage type,
00104                                                 const LLString& session_handle = LLString::null);
00105 
00106         //Updates a given session's session IDs.  Does not open,
00107         //create or do anything new.  If the old session doesn't
00108         //exist, then nothing happens.
00109         void updateFloaterSessionID(const LLUUID& old_session_id,
00110                                                                 const LLUUID& new_session_id);
00111 
00112         void processIMTypingStart(const LLIMInfo* im_info);
00113         void processIMTypingStop(const LLIMInfo* im_info);
00114 
00115         // Rebuild stuff
00116         void refresh();
00117 
00118         void notifyNewIM();
00119         void clearNewIMNotification();
00120 
00121         // IM received that you haven't seen yet
00122         BOOL getIMReceived() const;
00123 
00124         void            setFloaterOpen(BOOL open);              /*Flawfinder: ignore*/
00125         BOOL            getFloaterOpen();
00126 
00127         LLFloaterChatterBox* getFloater();
00128 
00129         // This method is used to go through all active sessions and
00130         // disable all of them. This method is usally called when you are
00131         // forced to log out or similar situations where you do not have a
00132         // good connection.
00133         void disconnectAllSessions();
00134 
00135         static void     toggle(void*);
00136 
00137         // This is a helper function to determine what kind of im session
00138         // should be used for the given agent.
00139         static EInstantMessage defaultIMTypeForAgent(const LLUUID& agent_id);
00140 
00141         BOOL hasSession(const LLUUID& session_id);
00142 
00143         // This method returns the im panel corresponding to the uuid
00144         // provided. The uuid must be a session id. Returns NULL if there
00145         // is no matching panel.
00146         LLFloaterIMPanel* findFloaterBySession(const LLUUID& session_id);
00147 
00148         static LLUUID computeSessionID(EInstantMessage dialog, const LLUUID& other_participant_id);
00149 
00150         void clearPendingVoiceInviation(const LLUUID& session_id);
00151 
00152         LLSD getPendingAgentListUpdates(const LLUUID& session_id);
00153         void addPendingAgentListUpdates(
00154                 const LLUUID& sessioN_id,
00155                 const LLSD& updates);
00156         void clearPendingAgentListUpdates(const LLUUID& session_id);
00157 
00158 private:
00159         class LLIMSessionInvite;
00160 
00161         // create a panel and update internal representation for
00162         // consistency. Returns the pointer, caller (the class instance
00163         // since it is a private method) is not responsible for deleting
00164         // the pointer.
00165         LLFloaterIMPanel* createFloater(const LLUUID& session_id,
00166                                                                         const LLUUID& target_id,
00167                                                                         const std::string& name,
00168                                                                         EInstantMessage dialog,
00169                                                                         BOOL user_initiated = FALSE);
00170 
00171         LLFloaterIMPanel* createFloater(const LLUUID& session_id,
00172                                                                         const LLUUID& target_id,
00173                                                                         const std::string& name,
00174                                                                         const LLDynamicArray<LLUUID>& ids,
00175                                                                         EInstantMessage dialog,
00176                                                                         BOOL user_initiated = FALSE);
00177 
00178         // This simple method just iterates through all of the ids, and
00179         // prints a simple message if they are not online. Used to help
00180         // reduce 'hello' messages to the linden employees unlucky enough
00181         // to have their calling card in the default inventory.
00182         void noteOfflineUsers(LLFloaterIMPanel* panel, const LLDynamicArray<LLUUID>& ids);
00183 
00184         void processIMTypingCore(const LLIMInfo* im_info, BOOL typing);
00185 
00186         static void inviteUserResponse(S32 option, void* user_data);
00187         static void onInviteNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* userdata);
00188 
00189 private:
00190         std::set<LLViewHandle> mFloaters;
00191         LLFriendObserver* mFriendObserver;
00192 
00193         // An IM has been received that you haven't seen yet.
00194         BOOL mIMReceived;
00195 
00196         LLSD mPendingVoiceInvitations;
00197         LLSD mPendingAgentListUpdates;
00198 };
00199 
00200 
00201 class LLFloaterIM : public LLMultiFloater
00202 {
00203 public:
00204         LLFloaterIM();
00205         /*virtual*/ BOOL postBuild();
00206 };
00207 
00208 // Globals
00209 extern LLIMMgr *gIMMgr;
00210 
00211 #endif  // LL_LLIMView_H

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