mirror of
https://github.com/craigerl/aprsd.git
synced 2024-12-21 17:11:01 -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:
parent
f66b96288f
commit
d4ae72608b
@ -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(
|
||||
|
@ -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"]);
|
||||
|
Loading…
Reference in New Issue
Block a user