mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
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:
commit
76e83cb66e
|
@ -422,15 +422,21 @@ void CChat::AddLine(int ClientID, int Mode, const char *pLine)
|
|||
m_aLines[m_CurrentLine].m_Mode = Mode;
|
||||
m_aLines[m_CurrentLine].m_NameColor = -2;
|
||||
|
||||
if(ClientID != m_pClient->m_LocalClientID) // do not highlight our own messages
|
||||
{
|
||||
// check for highlighted name
|
||||
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);
|
||||
if((pLine == pHL || pHL[-1] == ' ') && (pHL[Length] == 0 || pHL[Length] == ' ' || (pHL[Length] == ':' && pHL[Length+1] == ' ')))
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue