mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T26, another callsign to airline resolution
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a7bd53aaee
commit
d15b6446e3
@@ -129,8 +129,15 @@ namespace BlackMisc
|
||||
QRegularExpressionMatch match = regExp.match(this->m_callsign);
|
||||
if (!match.hasMatch()) { return QString(); }
|
||||
const QString airline = match.captured(0);
|
||||
|
||||
// hard facts
|
||||
if (airline.length() == 3) { return airline; } // we allow 3 letters
|
||||
if (airline.length() == 4 && airline.startsWith('V')) { return airline; } // we allow virtual 4 letter codes, e.g. VDLD
|
||||
|
||||
// some people use callsigns like UPSE123
|
||||
const QString number = match.captured(1);
|
||||
if (number.length() >= 3 && airline.length() == 4) { return airline.left(3); }
|
||||
|
||||
return ""; // invalid
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user