mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
refs #816, set timestamp in text message
This commit is contained in:
@@ -759,7 +759,9 @@ namespace BlackCore
|
||||
|
||||
void CNetworkVatlib::onTextMessageReceived(VatSessionID, const char *from, const char *to, const char *msg, void *cbvar)
|
||||
{
|
||||
BlackMisc::Network::CTextMessageList messages(cbvar_cast(cbvar)->fromFSD(msg), CCallsign(cbvar_cast(cbvar)->fromFSD(from)), CCallsign(cbvar_cast(cbvar)->fromFSD(to)));
|
||||
CTextMessage tm(cbvar_cast(cbvar)->fromFSD(msg), CCallsign(cbvar_cast(cbvar)->fromFSD(from)), CCallsign(cbvar_cast(cbvar)->fromFSD(to)));
|
||||
tm.setCurrentUtcTime();
|
||||
CTextMessageList messages(tm);
|
||||
emit cbvar_cast(cbvar)->textMessagesReceived(messages);
|
||||
}
|
||||
|
||||
@@ -777,6 +779,7 @@ namespace BlackCore
|
||||
}
|
||||
if (frequencies.isEmpty()) { return; }
|
||||
BlackMisc::Network::CTextMessageList messages(cbvar_cast(cbvar)->fromFSD(msg), frequencies, CCallsign(cbvar_cast(cbvar)->fromFSD(from)));
|
||||
messages.setCurrentUtcTime();
|
||||
emit cbvar_cast(cbvar)->textMessagesReceived(messages);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,25 @@ namespace BlackMisc
|
||||
return this->container().contains(&OBJ::hasValidTimestamp, false);
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
void ITimestampObjectList<OBJ, CONTAINER>::setCurrentUtcTime()
|
||||
{
|
||||
for (ITimestampBased &tsObj : this->container())
|
||||
{
|
||||
tsObj.setCurrentUtcTime();
|
||||
}
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
void ITimestampObjectList<OBJ, CONTAINER>::setInvalidTimestampsToCurrentUtcTime()
|
||||
{
|
||||
for (ITimestampBased &tsObj : this->container())
|
||||
{
|
||||
if (tsObj.hasValidTimestamp()) { continue; }
|
||||
tsObj.setCurrentUtcTime();
|
||||
}
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
QDateTime ITimestampObjectList<OBJ, CONTAINER>::latestTimestamp() const
|
||||
{
|
||||
|
||||
@@ -50,6 +50,12 @@ namespace BlackMisc
|
||||
//! Has invalid timestamp
|
||||
bool hasInvalidTimestamps() const;
|
||||
|
||||
//! Set all timestamps to now
|
||||
void setCurrentUtcTime();
|
||||
|
||||
//! Set invalid timestamps to now
|
||||
void setInvalidTimestampsToCurrentUtcTime();
|
||||
|
||||
//! Latest timestamp
|
||||
QDateTime latestTimestamp() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user