mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Added methods getUsers / getUsersForCallsigns
This commit is contained in:
@@ -11,8 +11,9 @@
|
||||
#include "blackcore/coreruntime.h"
|
||||
#include "blackcore/context_network_interface.h"
|
||||
#include "blackmisc/avallclasses.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/nwuserlist.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
@@ -174,6 +175,16 @@ namespace BlackCore
|
||||
*/
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getSelectedVoiceRooms() const;
|
||||
|
||||
/*!
|
||||
* \brief Get all users
|
||||
*/
|
||||
virtual BlackMisc::Network::CUserList getUsers() const;
|
||||
|
||||
/*!
|
||||
* \brief All users with callsign, e.g. for voice room resolution
|
||||
*/
|
||||
virtual BlackMisc::Network::CUserList getUsersForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns) const;
|
||||
|
||||
private:
|
||||
BlackMisc::Aviation::CAtcStationList m_atcStationsOnline;
|
||||
BlackMisc::Aviation::CAtcStationList m_atcStationsBooked;
|
||||
|
||||
@@ -102,6 +102,43 @@ namespace BlackCore
|
||||
return rooms;
|
||||
}
|
||||
|
||||
/*
|
||||
* All users
|
||||
*/
|
||||
CUserList CContextNetwork::getUsers() const
|
||||
{
|
||||
CUserList users;
|
||||
foreach(CAtcStation station, this->m_atcStationsOnline)
|
||||
{
|
||||
users.push_back(station.getController());
|
||||
}
|
||||
foreach(CAircraft aircraft, this->m_aircraftsInRange)
|
||||
{
|
||||
users.push_back(aircraft.getPilot());
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
/*
|
||||
* Users with callsigns
|
||||
*/
|
||||
CUserList CContextNetwork::getUsersForCallsigns(const CCallsignList &callsigns) const
|
||||
{
|
||||
CUserList users;
|
||||
if (callsigns.isEmpty()) return users;
|
||||
foreach(CAtcStation station, this->m_atcStationsOnline)
|
||||
{
|
||||
if (callsigns.contains(station.getCallsign()))
|
||||
users.push_back(station.getController());
|
||||
}
|
||||
foreach(CAircraft aircraft, this->m_aircraftsInRange)
|
||||
{
|
||||
if (callsigns.contains(aircraft.getCallsign()))
|
||||
users.push_back(aircraft.getPilot());
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
/*
|
||||
* ATC Position update
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user