From 3966d4b64c6d15efb15ca336cc2ef572dcf159ea Mon Sep 17 00:00:00 2001 From: jq-rs Date: Wed, 9 Sep 2020 18:16:58 +0300 Subject: [PATCH] Fix Find and Match properly. --- js/mlestalk.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/js/mlestalk.js b/js/mlestalk.js index bc37de4..e5e886d 100644 --- a/js/mlestalk.js +++ b/js/mlestalk.js @@ -166,7 +166,8 @@ function queueSweepAndSend(uid, channel) { let q = uidQueueGet(uid, channel); let cnt = 0; if (q) { - for (let i = 0; i < q.getLength(); i++) { + let len = q.getLength(); + for (let i = 0; i < len; i++) { let obj = q.get(i); let tmp = obj[1]; if (tmp[2] == uid) { @@ -179,6 +180,7 @@ function queueSweepAndSend(uid, channel) { if(fs) { q.remove(i); i -= 1; + len -= 1; } } } @@ -930,17 +932,7 @@ async function reconnect(uid, channel) { gIsReconnect = true; await sleep(gReconnTimeout); gReconnTimeout *= 2; - gWebWorker.postMessage(["reconnect", null, uid, channel, gIsTokenChannel]); -} - -function syncReconnect() { - if (gIsReconnect) - return; - - if ('' != gMyName && '' != gMyChannel) { - gWebWorker.postMessage(["reconnect", null, gMyName, gMyChannel, gIsTokenChannel, gPrevBdKey]); - sendInitJoin(); - } + gWebWorker.postMessage(["reconnect", null, uid, channel, gIsTokenChannel, gPrevBdKey]); } function scrollToBottom() { @@ -987,7 +979,7 @@ function sendData(cmd, uid, channel, data, msgtype) { gWebWorker.postMessage(arr); } if (gSipKeyIsOk && msgtype & MSGISFULL && data.length > 0) { - queuePostMsg(uid, channel, [date, arr, mHash, msgtype & MSGISIMAGE ? true : false, gForwardSecrecy]); + queuePostMsg(uid, channel, [msgDate.valueOf(), arr, mHash, msgtype & MSGISIMAGE ? true : false, gForwardSecrecy]); } } }