From 297e2d60abfa96b3b570d25c66608edc2ff78e95 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Wed, 8 Dec 2004 23:02:58 +0000
Subject: [PATCH] Loop through the index looking for matches, not the headers.

---
 web/lib/msgslib.ssjs | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/web/lib/msgslib.ssjs b/web/lib/msgslib.ssjs
index ca752db203..96ffe9c948 100644
--- a/web/lib/msgslib.ssjs
+++ b/web/lib/msgslib.ssjs
@@ -33,11 +33,13 @@ function get_my_message_offsets()
 	var idx;
 	var hdr;
 
-	for(last_offset=0; (hdr=msgbase.get_msg_header(true,last_offset)) != null;last_offset++) {
-		if(hdr.attr&MSG_DELETE)
+	for(last_offset=0; (idx=msgbase.get_msg_index(true,last_offset)) != null;last_offset++) {
+		if(idx.attr&MSG_DELETE)
 			continue;
-		if((idx=msgbase.get_msg_index(true,last_offset))==null || idx.to!=user.number)
+		if(idx.to!=user.number)
 			continue;
+		if((hdr=msgbase.get_msg_header(true,last_offset))==null)
+			continuel
 		msg=new Array;
 		msg["hdr"]=hdr;
 		msg.idx=idx;
@@ -53,10 +55,10 @@ function get_all_message_offsets()
 	var last_offset;
 	var hdr;
 
-	for(last_offset=0; (hdr=msgbase.get_msg_header(true,last_offset)) != null;last_offset++) {
-		if(hdr.attr&MSG_DELETE)
+	for(last_offset=0; (idx=msgbase.get_msg_index(true,last_offset)) != null;last_offset++) {
+		if(idx.attr&MSG_DELETE)
 			continue;
-		idx=msgbase.get_msg_index(true,last_offset);
+		hdr=msgbase.get_msg_header(true,last_offset);
 		msg=new Object;
 		msg.hdr=hdr;
 		msg.idx=idx;
-- 
GitLab