1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-12-21 09:01:23 -05:00

Fixed webchat packets without msgNo

This patch makes a fix in the webchat UI for packets that
don't have a msgNo in the RX'd packets.  Previously the packets
would just show up as a dupe of the previous RX'd packet from
the same callsign.  Webchat UI will now properly show the message
by creating a fake msgNo value based on the contents of the RX'd packet
from_call+addressee+message_text
This commit is contained in:
Hemna 2024-11-26 19:48:50 -05:00
parent f66b96288f
commit d4ae72608b
2 changed files with 20 additions and 1 deletions

View File

@ -500,8 +500,8 @@ class SendMessageNamespace(Namespace):
pkt.prepare()
self.msg = pkt
msgs = SentMessages()
msgs.add(pkt)
tx.send(pkt)
msgs.add(pkt)
msgs.set_status(pkt.msgNo, "Sending")
obj = msgs.get(pkt.msgNo)
socketio.emit(

View File

@ -510,11 +510,30 @@ function sent_msg(msg) {
reload_popovers();
}
function str_to_int(my_string) {
total = 0
for (let i = 0; i < my_string.length; i++) {
total += my_string.charCodeAt(i);
}
return total
}
function from_msg(msg) {
if (!from_msg_list.hasOwnProperty(msg["from_call"])) {
from_msg_list[msg["from_call"]] = new Array();
}
// Try to account for messages that have no msgNo
console.log(msg)
if (msg["msgNo"] == null) {
console.log("Need to add msgNO!!")
// create an artificial msgNo
total = str_to_int(msg["from_call"])
total += str_to_int(msg["addresse"])
total += str_to_int(msg["message_text"])
msg["msgNo"] = total
}
if (msg["msgNo"] in from_msg_list[msg["from_call"]]) {
// We already have this message
//console.log("We already have this message msgNo=" + msg["msgNo"]);