Does anyone have a good understanding of what happens in this function and a 
minute to explain why things are done the way they are? I'm not trying to 
criticize anything in imapcommands.c, just trying to understand it more and 
hope someone who perhaps understands it well could shed some light on things a 
bit :D

My questions are in the portion of _ic_fetch that read:

/* if there is no parsing at all, this loop is not needed */
for (i=fetch_start; i<=fetch_end && !no_parsing_at_all; i++)
{
  thisnum = (imapcommands_use_uid ? i : ud->mailbox.seq_list[i]);
  insert_rfcsize = 0;
                                                                                
                      
  if (imapcommands_use_uid)
    {
      if (i > ud->mailbox.msguidnext-1)
        {
          /* passed the last one */
          fprintf(ci->tx,"%s OK FETCH completed\r\n",tag);
          list_freelist(&fetch_list.start);
          return 0;
        }
                                                                                
                      
      /* check if the message with this UID belongs to this mailbox */
      if (binary_search(ud->mailbox.seq_list, ud->mailbox.exists,
                        i, &fn) == -1) {
           continue;
      }

>From what I've been reading in the code, the seq_list array of mailbox is 
>built from db_getmailbox() in db.c and the SQL behind that only fetches 
>messages that have the mailbox_idnr of the mailbox to which ud->mailbox refers.
Status: O

Why the need to do binary_search() on the ud->mailbox.seq_list if we already 
know that all those messages belong to that mailbox and couldn't be otherwise? 
Unless I'm missing something?

Another thing I'm wondering is why the sequential looping 

for (i=fetch_start; i<=fetch_end && !no_parsing_at_all; i++)

If we already have ud->mailbox.seq_list which is the entire list of 
message_idnr's for the mailbox; why not lop through ud->mailbox.seq_list after 
finding what index fetch_start would be in ud->mailbox.seq_list and what index 
fetch_end would be.

Thanks for any help, it is MUCH appreciated :D

Blessings in Jesus,
Paul F. De La Cruz

Reply via email to