source: view.c @ 1fd0b25

barnowl_perlaimdebianowlrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 1fd0b25 was 1aee7d9, checked in by Erik Nygren <nygren@mit.edu>, 22 years ago
* Added RCS Id strings to all files. * 'show keymaps' shows details of all keymaps after summary list.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1#include "owl.h"
2
3static const char fileIdent[] = "$Id$";
4
5void owl_view_create(owl_view *v, owl_filter *f) {
6  v->filter=f;
7  owl_messagelist_create(&(v->ml));
8  owl_view_recalculate(v);
9}
10
11void owl_view_consider_message(owl_view *v, owl_message *m) {
12  /* if the message matches the filter then add to view */
13  if (owl_filter_message_match(v->filter, m)) {
14    owl_messagelist_append_element(&(v->ml), m);
15  }
16}
17
18void owl_view_recalculate(owl_view *v) {
19  /* add all the global messages that match the filter */
20  int i, j;
21  owl_messagelist *gml;
22  owl_messagelist *ml;
23  owl_message *m;
24
25  gml=owl_global_get_msglist(&g);
26  ml=&(v->ml);
27
28  /* nuke the old list */
29  owl_list_free_simple((owl_list *) ml);
30  owl_messagelist_create(&(v->ml));
31
32  /* find all the messages we want */
33  j=owl_messagelist_get_size(gml);
34  for (i=0; i<j; i++) {
35    m=owl_messagelist_get_element(gml, i);
36    if (owl_filter_message_match(v->filter, m)) {
37      owl_messagelist_append_element(ml, m);
38    }
39  }
40}
41
42owl_message *owl_view_get_element(owl_view *v, int index) {
43  return(owl_messagelist_get_element(&(v->ml), index));
44}
45
46void owl_view_delete_element(owl_view *v, int index) {
47  owl_messagelist_delete_element(&(v->ml), index);
48}
49
50void owl_view_undelete_element(owl_view *v, int index) {
51  owl_messagelist_undelete_element(&(v->ml), index);
52}
53
54int owl_view_get_size(owl_view *v) {
55  return(owl_messagelist_get_size(&(v->ml)));
56}
57
58char *owl_view_get_filtname(owl_view *v) {
59  return(owl_filter_get_name(v->filter));
60}
61
62void owl_view_free(owl_view *v) {
63  owl_list_free_simple((owl_list *) &(v->ml));
64}
Note: See TracBrowser for help on using the repository browser.