Ref T494, detect callsign in text message

This commit is contained in:
Klaus Basan
2018-12-31 06:45:14 +01:00
committed by Mat Sutcliffe
parent f8c17e10e8
commit 3137af30bb
2 changed files with 10 additions and 0 deletions

View File

@@ -118,6 +118,13 @@ namespace BlackMisc
return CComSystem::isValidCivilAviationFrequency(m_frequency);
}
bool CTextMessage::mentionsCallsign(const CCallsign &callsign) const
{
if (callsign.isEmpty()) { return false; }
if (m_message.length() < callsign.asString().length()) { return false; }
return m_message.contains(callsign.asString(), Qt::CaseInsensitive);
}
QString CTextMessage::getAsciiOnlyMessage() const
{
if (m_message.isEmpty()) { return {}; }

View File

@@ -85,6 +85,9 @@ namespace BlackMisc
//! Get message
const QString &getMessage() const { return m_message; }
//! Is the callsign given mentioned in that message
bool mentionsCallsign(const Aviation::CCallsign &callsign) const;
//! Get ASCII only message
QString getAsciiOnlyMessage() const;