diff options
Diffstat (limited to 'indra/newview/llimview.h')
-rw-r--r-- | indra/newview/llimview.h | 106 |
1 files changed, 72 insertions, 34 deletions
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 68beb29034..f986d9dcdb 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -34,12 +34,13 @@ #define LL_LLIMVIEW_H #include "lldarray.h" -#include "llfloateractivespeakers.h" //for LLIMSpeakerMgr +#include "llspeakers.h" //for LLIMSpeakerMgr #include "llimpanel.h" //for voice channels #include "llmodaldialog.h" #include "llinstantmessage.h" #include "lluuid.h" #include "llmultifloater.h" +#include "lllogchat.h" class LLFloaterChatterBox; class LLUUID; @@ -57,6 +58,8 @@ public: virtual ~LLIMSession(); void sessionInitReplyReceived(const LLUUID& new_session_id); + void addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time); + static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata); LLUUID mSessionID; std::string mName; @@ -70,6 +73,13 @@ public: LLIMSpeakerMgr* mSpeakers; bool mSessionInitialized; + + //true if calling back the session URI after the session has closed is possible. + //Currently this will be false only for PSTN P2P calls. + bool mCallBackEnabled; + + bool mTextIMPossible; + bool mOtherParticipantIsAvatar; }; @@ -82,8 +92,8 @@ public: void resetActiveSessionID() { mActiveSessionID.setNull(); } LLUUID getActiveSessionID() { return mActiveSessionID; } - //*TODO make it non-static as LLIMMOdel is a singleton (IB) - static std::map<LLUUID, LLIMSession*> sSessionsMap; //mapping session_id to session + /** Session id to session object */ + std::map<LLUUID, LLIMSession*> mId2SessionMap; typedef boost::signals2::signal<void(const LLSD&)> session_signal_t; typedef boost::function<void(const LLSD&)> session_callback_t; @@ -99,23 +109,45 @@ public: /** * Rebind session data to a new session id. */ - void updateSessionID(const LLUUID& old_session_id, const LLUUID& new_session_id); + void processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id); boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); } boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); } - bool newSession(LLUUID session_id, std::string name, EInstantMessage type, LLUUID other_participant_id, + /** + * Create new session object in a model + */ + bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids = std::vector<LLUUID>()); - bool clearSession(LLUUID session_id); - std::list<LLSD> getMessages(LLUUID session_id, int start_index = 0); - bool addMessage(LLUUID session_id, std::string from, LLUUID other_participant_id, std::string utf8_text, bool log2file = true); - bool addToHistory(LLUUID session_id, std::string from, LLUUID from_id, std::string utf8_text); + /** + * Remove all session data associated with a session specified by session_id + */ + bool clearSession(const LLUUID& session_id); + + /** + * Populate supplied std::list with messages starting from index specified by start_index + */ + void getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0); + + /** + * Add a message to an IM Model - the message is saved in a message store associated with a session specified by session_id + * and also saved into a file if log2file is specified. + * It sends new message signal for each added message. + */ + bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true); - bool logToFile(const LLUUID& session_id, const std::string& from, const std::string& utf8_text); + /** + * Add a system message to an IM Model + */ + bool proccessOnlineOfflineNotification(const LLUUID& session_id, const std::string& utf8_text); - //used to get the name of the session, for use as the title - //currently just the other avatar name + /** + * Get a session's name. + * For a P2P chat - it's an avatar's name, + * For a group chat - it's a group's name + * For an ad-hoc chat - is received from the server and is in a from of "<Avatar's name> conference" + */ const std::string& getName(const LLUUID& session_id) const; /** @@ -150,7 +182,7 @@ public: */ LLIMSpeakerMgr* getSpeakerManager(const LLUUID& session_id) const; - static void sendLeaveSession(LLUUID session_id, LLUUID other_participant_id); + static void sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id); static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, EInstantMessage dialog); static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing); @@ -158,6 +190,18 @@ public: const LLUUID& other_participant_id, EInstantMessage dialog); void testMessages(); + +private: + + /** + * Add message to a list of message associated with session specified by session_id + */ + bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text); + + /** + * Save an IM message into a file + */ + bool logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text); }; class LLIMSessionObserver @@ -183,7 +227,7 @@ public: }; LLIMMgr(); - virtual ~LLIMMgr(); + virtual ~LLIMMgr() {}; // Add a message to a session. The session can keyed to sesion id // or agent id. @@ -200,11 +244,6 @@ public: void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args); - // This method returns TRUE if the local viewer has a session - // currently open keyed to the uuid. The uuid can be keyed by - // either session id or agent id. - BOOL isIMSessionOpen(const LLUUID& uuid); - // This adds a session to the talk view. The name is the local // name of the session, dialog specifies the type of // session. Since sessions can be keyed off of first recipient or @@ -250,9 +289,6 @@ public: void processIMTypingStart(const LLIMInfo* im_info); void processIMTypingStop(const LLIMInfo* im_info); - // Rebuild stuff - void refresh(); - void notifyNewIM(); void clearNewIMNotification(); @@ -268,10 +304,6 @@ public: // good connection. void disconnectAllSessions(); - // This is a helper function to determine what kind of im session - // should be used for the given agent. - static EInstantMessage defaultIMTypeForAgent(const LLUUID& agent_id); - BOOL hasSession(const LLUUID& session_id); // This method returns the im panel corresponding to the uuid @@ -290,11 +322,18 @@ public: void clearPendingAgentListUpdates(const LLUUID& session_id); //HACK: need a better way of enumerating existing session, or listening to session create/destroy events + //@deprecated, is used only by LLToolBox, which is not used anywhere, right? (IB) const std::set<LLHandle<LLFloater> >& getIMFloaterHandles() { return mFloaters; } void addSessionObserver(LLIMSessionObserver *); void removeSessionObserver(LLIMSessionObserver *); + //show error statuses to the user + void showSessionStartError(const std::string& error_string, const LLUUID session_id); + void showSessionEventError(const std::string& event_string, const std::string& error_string, const LLUUID session_id); + void showSessionForceClose(const std::string& reason, const LLUUID session_id); + static bool onConfirmForceCloseError(const LLSD& notification, const LLSD& response); + /** * Start call in a session * @return false if voice channel doesn't exist @@ -308,10 +347,11 @@ public: bool endCall(const LLUUID& session_id); private: - // This removes the panel referenced by the uuid, and then - // restores internal consistency. The internal pointer is not - // deleted. - void removeSession(LLUUID session_id); + + /** + * Remove data associated with a particular session specified by session_id + */ + void removeSession(const LLUUID& session_id); // create a panel and update internal representation for // consistency. Returns the pointer, caller (the class instance @@ -340,8 +380,9 @@ private: void notifyObserverSessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); private: + + //*TODO should be deleted when Communicate Floater is being deleted std::set<LLHandle<LLFloater> > mFloaters; - LLFriendObserver* mFriendObserver; typedef std::list <LLIMSessionObserver *> session_observers_list_t; session_observers_list_t mSessionObservers; @@ -351,9 +392,6 @@ private: LLSD mPendingInvitations; LLSD mPendingAgentListUpdates; - // ID of a session that is being removed: observers are already told - // that this session is being removed, but it is still present in the sessions' map - LLUUID mBeingRemovedSessionID; }; class LLIncomingCallDialog : public LLModalDialog |