Merge pull request #1560 from Dune-jr/feature-fixping

Highlighting is now also triggered by empty messages, and is disabled for the user's own messages. Fix #1559.
This commit is contained in:
oy 2018-10-27 09:21:32 +02:00 committed by GitHub
commit 76e83cb66e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -422,14 +422,20 @@ void CChat::AddLine(int ClientID, int Mode, const char *pLine)
m_aLines[m_CurrentLine].m_Mode = Mode; m_aLines[m_CurrentLine].m_Mode = Mode;
m_aLines[m_CurrentLine].m_NameColor = -2; m_aLines[m_CurrentLine].m_NameColor = -2;
// check for highlighted name if(ClientID != m_pClient->m_LocalClientID) // do not highlight our own messages
const char *pHL = str_find_nocase(pLine, m_pClient->m_aClients[m_pClient->m_LocalClientID].m_aName);
if(pHL)
{ {
int Length = str_length(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_aName); // check for highlighted name
if((pLine == pHL || pHL[-1] == ' ') && (pHL[Length] == 0 || pHL[Length] == ' ' || (pHL[Length] == ':' && pHL[Length+1] == ' '))) const char *pHL = str_find_nocase(pLine, m_pClient->m_aClients[m_pClient->m_LocalClientID].m_aName);
Highlighted = true; if(pHL)
m_CompletionFav = ClientID; {
int Length = str_length(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_aName);
if((pLine == pHL || pHL[-1] == ' ') // space or nothing before
&& ((pHL[Length] == 0 || pHL[Length] == ' ') || pHL[Length] == ':' && (pHL[Length+1] == 0) || pHL[Length+1] == ' ')) // space or nothing after, allowing a colon
{
Highlighted = true;
}
m_CompletionFav = ClientID;
}
} }
m_aLines[m_CurrentLine].m_Highlighted = Highlighted || Mode == CHAT_WHISPER; m_aLines[m_CurrentLine].m_Highlighted = Highlighted || Mode == CHAT_WHISPER;