kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
feat: enforce waypoints locked_to
rodzic
a0935a695c
commit
1fc99b8bb4
|
@ -574,11 +574,6 @@ class MeshService : Service(), Logging {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rememberDataPacket(dataPacket: DataPacket) {
|
private fun rememberDataPacket(dataPacket: DataPacket) {
|
||||||
// Now that we use data packets for more things, we need to be choosier about what we keep. Since (currently - in the future less so)
|
|
||||||
// we only care about old text messages, we just store those...
|
|
||||||
if (dataPacket.dataType == Portnums.PortNum.WAYPOINT_APP_VALUE
|
|
||||||
|| dataPacket.dataType == Portnums.PortNum.TEXT_MESSAGE_APP_VALUE
|
|
||||||
) {
|
|
||||||
val fromLocal = dataPacket.from == DataPacket.ID_LOCAL
|
val fromLocal = dataPacket.from == DataPacket.ID_LOCAL
|
||||||
val toBroadcast = dataPacket.to == DataPacket.ID_BROADCAST
|
val toBroadcast = dataPacket.to == DataPacket.ID_BROADCAST
|
||||||
val contactId = if (fromLocal || toBroadcast) dataPacket.to else dataPacket.from
|
val contactId = if (fromLocal || toBroadcast) dataPacket.to else dataPacket.from
|
||||||
|
@ -595,7 +590,6 @@ class MeshService : Service(), Logging {
|
||||||
)
|
)
|
||||||
insertPacket(packetToSave)
|
insertPacket(packetToSave)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Update our model and resend as needed for a MeshPacket we just received from the radio
|
/// Update our model and resend as needed for a MeshPacket we just received from the radio
|
||||||
private fun handleReceivedData(packet: MeshPacket) {
|
private fun handleReceivedData(packet: MeshPacket) {
|
||||||
|
@ -613,7 +607,6 @@ class MeshService : Service(), Logging {
|
||||||
debug("Received data from $fromId, portnum=${data.portnum} ${bytes.size} bytes")
|
debug("Received data from $fromId, portnum=${data.portnum} ${bytes.size} bytes")
|
||||||
|
|
||||||
dataPacket.status = MessageStatus.RECEIVED
|
dataPacket.status = MessageStatus.RECEIVED
|
||||||
rememberDataPacket(dataPacket)
|
|
||||||
|
|
||||||
// if (p.hasUser()) handleReceivedUser(fromNum, p.user)
|
// if (p.hasUser()) handleReceivedUser(fromNum, p.user)
|
||||||
|
|
||||||
|
@ -624,9 +617,17 @@ class MeshService : Service(), Logging {
|
||||||
Portnums.PortNum.TEXT_MESSAGE_APP_VALUE ->
|
Portnums.PortNum.TEXT_MESSAGE_APP_VALUE ->
|
||||||
if (!fromUs) {
|
if (!fromUs) {
|
||||||
debug("Received CLEAR_TEXT from $fromId")
|
debug("Received CLEAR_TEXT from $fromId")
|
||||||
|
rememberDataPacket(dataPacket)
|
||||||
updateMessageNotification(dataPacket)
|
updateMessageNotification(dataPacket)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Portnums.PortNum.WAYPOINT_APP_VALUE -> {
|
||||||
|
val u = MeshProtos.Waypoint.parseFrom(data.payload)
|
||||||
|
// Validate locked Waypoints from the original sender
|
||||||
|
if (u.lockedTo != 0 && u.lockedTo != packet.from) return
|
||||||
|
rememberDataPacket(dataPacket)
|
||||||
|
}
|
||||||
|
|
||||||
// Handle new style position info
|
// Handle new style position info
|
||||||
Portnums.PortNum.POSITION_APP_VALUE -> {
|
Portnums.PortNum.POSITION_APP_VALUE -> {
|
||||||
var u = MeshProtos.Position.parseFrom(data.payload)
|
var u = MeshProtos.Position.parseFrom(data.payload)
|
||||||
|
|
Ładowanie…
Reference in New Issue