Changeset fe7ece2 for messagelist.c


Ignore:
Timestamp:
Jul 9, 2011, 4:10:45 PM (13 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
786a410 (diff), caac19d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge caac19d40ffaea75410ce13da172590b04dae2b1 into 786a4108f9184d7c73170d373bc2cf80347b6456
File:
1 edited

Legend:

Unmodified
Added
Removed
  • messagelist.c

    r901cee9 rfe7ece2  
    3030}
    3131
    32 owl_message *owl_messagelist_get_by_id(const owl_messagelist *ml, int target_id)
     32int owl_messagelist_get_index_by_id(const owl_messagelist *ml, int target_id)
    3333{
    34   /* return the message with id == 'id'.  If it doesn't exist return NULL. */
     34  /* return the message index with id == 'id'.  If it doesn't exist return -1. */
    3535  int first, last, mid, msg_id;
    3636  owl_message *m;
     
    4343    msg_id = owl_message_get_id(m);
    4444    if (msg_id == target_id) {
    45       return(m);
     45      return mid;
    4646    } else if (msg_id < target_id) {
    4747      first = mid + 1;
     
    5050    }
    5151  }
    52   return(NULL);
     52  return -1;
     53}
     54
     55owl_message *owl_messagelist_get_by_id(const owl_messagelist *ml, int target_id)
     56{
     57  /* return the message with id == 'id'.  If it doesn't exist return NULL. */
     58  int n = owl_messagelist_get_index_by_id(ml, target_id);
     59  if (n < 0) return NULL;
     60  return ml->list->pdata[n];
    5361}
    5462
     
    7179  owl_message_unmark_delete(ml->list->pdata[n]);
    7280  return(0);
     81}
     82
     83void owl_messagelist_delete_and_expunge_element(owl_messagelist *ml, int n)
     84{
     85  owl_message_delete(g_ptr_array_remove_index(ml->list, n));
    7386}
    7487
Note: See TracChangeset for help on using the changeset viewer.