- Timestamp:
- Aug 17, 2002, 1:21:17 PM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 67103d4
- Parents:
- 37c27cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
view.c
r1aee7d9 r59cf91c 56 56 } 57 57 58 /* Returns the position in the view with a message closest 59 * to the passed msgid. */ 60 int owl_view_get_nearest_to_msgid(owl_view *v, int targetid) { 61 int i, bestdist=-1, bestpos=0, curid, curdist; 62 63 for (i=0; i<owl_view_get_size(v); i++) { 64 curid = owl_message_get_id(owl_view_get_element(v, i)); 65 curdist = abs(targetid-curid); 66 if (bestdist<0 || curdist<bestdist) { 67 bestdist = curdist; 68 bestpos = i; 69 } 70 } 71 return bestpos; 72 } 73 74 int owl_view_get_nearest_to_saved(owl_view *v) { 75 int cachedid = owl_filter_get_cachedmsgid(v->filter); 76 if (cachedid<0) return(0); 77 return owl_view_get_nearest_to_msgid(v, cachedid); 78 } 79 80 /* saves the current message position in the filter so it can 81 * be restored later if we switch back to this filter. */ 82 void owl_view_save_curmsgid(owl_view *v, int curid) { 83 owl_filter_set_cachedmsgid(v->filter, curid); 84 } 85 58 86 char *owl_view_get_filtname(owl_view *v) { 59 87 return(owl_filter_get_name(v->filter));
Note: See TracChangeset
for help on using the changeset viewer.