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,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;
|
||||||
|
|
Loading…
Reference in a new issue