Changeset fa86732
- Timestamp:
- Jan 16, 2007, 5:43:26 PM (18 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 32fa306
- Parents:
- 855dc8d
- git-author:
- Nelson Elhage <nelhage@mit.edu> (01/16/07 17:43:23)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (01/16/07 17:43:26)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.c
r8203afd rfa86732 250 250 251 251 f=owl_malloc(sizeof(owl_filter)); 252 owl_filter_init_fromstring(f, "wordwrap", "not ( type ^admin$ or type ^zephyr$ ) "); 253 owl_list_append_element(owl_global_get_filterlist(&g), f); 254 255 f=owl_malloc(sizeof(owl_filter)); 252 256 owl_filter_init_fromstring(f, "trash", "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )"); 253 257 owl_list_append_element(owl_global_get_filterlist(&g), f); -
stylefunc.c
rbc9436f rfa86732 9 9 void owl_style_basic_format_body(owl_fmtext *fm, owl_message *m) { 10 10 char *indent, *body; 11 owl_filter *f; 12 int wrap = 0; 11 13 12 14 /* get the body */ 13 15 body=owl_strdup(owl_message_get_body(m)); 14 body=realloc(body, strlen(body)+30); 15 16 /* add a newline if we need to */ 17 if (body[0]!='\0' && body[strlen(body)-1]!='\n') { 18 strcat(body, "\n"); 16 17 f = owl_global_get_filter(&g, "wordwrap"); 18 if(f && owl_filter_message_match(f, m)) 19 wrap = 1; 20 21 if(wrap) { 22 int cols, i, width, word; 23 char *tab, *tok, *ws = " \t\n\r"; 24 cols = owl_global_get_cols(&g) - OWL_MSGTAB - 1; 25 26 tab = owl_malloc(OWL_MSGTAB+1); 27 for(i = 0; i < OWL_MSGTAB; i++) { 28 tab[i] = ' '; 29 } 30 tab[OWL_MSGTAB] = 0; 31 32 tok = strtok(body, ws); 33 tab[OWL_MSGTAB-1] = 0; 34 owl_fmtext_append_normal(fm, tab); 35 tab[OWL_MSGTAB-1] = ' '; 36 width = 0; 37 38 while(tok) { 39 word = strlen(tok); 40 if(word + width + 1 < cols) { 41 owl_fmtext_append_normal(fm, " "); 42 owl_fmtext_append_normal(fm, tok); 43 width += word + 1; 44 } else { 45 owl_fmtext_append_normal(fm, "\n"); 46 owl_fmtext_append_normal(fm, tab); 47 owl_fmtext_append_normal(fm, tok); 48 width = word; 49 } 50 tok = strtok(NULL, ws); 51 } 52 owl_fmtext_append_normal(fm, "\n"); 53 54 owl_free(tab); 55 } else { 56 /* do the indenting into indent */ 57 indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10); 58 owl_text_indent(indent, body, OWL_MSGTAB); 59 owl_fmtext_append_ztext(fm, indent); 60 if(body[strlen(body)-1] != '\n') 61 owl_fmtext_append_ztext(fm, "\n"); 62 owl_free(indent); 19 63 } 20 64 21 /* do the indenting into indent */22 indent=owl_malloc(strlen(body)+owl_text_num_lines(body)*OWL_MSGTAB+10);23 owl_text_indent(indent, body, OWL_MSGTAB);24 owl_fmtext_append_ztext(fm, indent);25 26 owl_free(indent);27 65 owl_free(body); 28 66 }
Note: See TracChangeset
for help on using the changeset viewer.