I need less unstaged code

Here's pieces of the WIP offline->IM->online fix
This commit is contained in:
Lirusaito
2019-02-15 19:33:22 -05:00
parent 1c9fcbb387
commit 0269affb69
4 changed files with 24 additions and 13 deletions

View File

@@ -295,6 +295,7 @@ public:
llwchar getWChar(S32 pos) const { return mWText[pos]; }
LLWString getWSubString(S32 pos, S32 len) const { return mWText.substr(pos, len); }
const LLTextSegment* getLastSegment() const { return mSegments.empty() ? nullptr : mSegments.back(); }
const LLTextSegment* getCurrentSegment() const { return getSegmentAtOffset(mCursorPos); }
const LLTextSegment* getPreviousSegment() const;
void getSelectedSegments(std::vector<LLTextSegmentPtr>& segments) const;

View File

@@ -1227,7 +1227,7 @@ void deliver_message(const std::string& utf8_text,
if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
{
// User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice.
sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
// sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
}
if(!sent)

View File

@@ -1097,31 +1097,39 @@ bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id)
return mNotifiedNonFriendSessions.end() != mNotifiedNonFriendSessions.find(session_id);
}
std::string LLIMMgr::getOfflineMessage(const LLUUID& id)
{
std::string full_name;
if (LLAvatarNameCache::getNSName(id, full_name))
{
LLUIString offline = LLTrans::getString("offline_message");
offline.setArg("[NAME]", full_name);
return offline;
}
return LLStringUtil::null;
}
void LLIMMgr::noteOfflineUsers(
LLFloaterIMPanel* floater,
const std::vector<LLUUID>& ids)
{
S32 count = ids.size();
if(count == 0)
if(ids.empty())
{
const std::string& only_user = LLTrans::getString("only_user_message");
floater->addHistoryLine(only_user, gSavedSettings.getColor4("SystemChatColor"));
}
else
{
const LLRelationship* info = NULL;
const LLRelationship* info = nullptr;
LLAvatarTracker& at = LLAvatarTracker::instance();
for(S32 i = 0; i < count; ++i)
for(const auto& id : ids)
{
info = at.getBuddyInfo(ids.at(i));
std::string full_name;
if (info
&& !info->isOnline()
&& LLAvatarNameCache::getNSName(ids.at(i), full_name))
info = at.getBuddyInfo(id);
if (info && !info->isOnline())
{
LLUIString offline = LLTrans::getString("offline_message");
offline.setArg("[NAME]", full_name);
floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor"));
auto offline(getOfflineMessage(id));
if (!offline.empty())
floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor"));
}
}
}

View File

@@ -188,6 +188,8 @@ public:
bool isNonFriendSessionNotified(const LLUUID& session_id);
static std::string getOfflineMessage(const LLUUID& id);
private:
// create a panel and update internal representation for
// consistency. Returns the pointer, caller (the class instance