1 /* 2 * $Id: mailview.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $ 3 * 4 * ======================================================================== 5 * Copyright 2006-2008 University of Washington 6 * Copyright 2013-2021 Eduardo Chappa 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * ======================================================================== 15 */ 16 17 #ifndef PINE_MAILVIEW_INCLUDED 18 #define PINE_MAILVIEW_INCLUDED 19 20 21 #include <general.h> 22 #include "../pith/mailview.h" 23 #include "titlebar.h" 24 #include "keymenu.h" 25 #include "../pith/handle.h" 26 #include "../pith/store.h" 27 #include "../pith/bitmap.h" 28 29 30 /* 31 * display_output_file mode flags 32 */ 33 #define DOF_NONE 0 34 #define DOF_EMPTY 1 35 #define DOF_BRIEF 2 36 37 38 #define STYLE_NAME(s) ((s)->text.desc ? (s)->text.desc : "text") 39 40 41 /* 42 * Struct defining scrolltool operating parameters. 43 */ 44 typedef struct scrolltool_s { 45 struct { /* Data and its attributes to scroll */ 46 void *text; /* what to scroll */ 47 SourceType src; /* it's form (char **,char *,FILE *) */ 48 char *desc; /* Description of "type" of data shown */ 49 HANDLE_S *handles; /* embedded data descriptions */ 50 } text; 51 struct { /* titlebar state */ 52 char *title; /* screen's title */ 53 TitleBarType style; /* it's type */ 54 COLOR_PAIR *color; 55 } bar; 56 struct { /* screen's keymenu/command bindings */ 57 struct key_menu *menu; 58 bitmap_t bitmap; 59 OtherMenu what; 60 void (*each_cmd)(struct scrolltool_s *, int); 61 } keys; 62 struct { /* help for this attachment */ 63 HelpType text; /* help text */ 64 char *title; /* title for help screen */ 65 } help; 66 UCS (*decode_aux_rv_value)(void *, void *); /* transforms a reply to a command */ 67 int (*aux_condition)(void *); /* has the condition been met to execute aux_function, 0 = success */ 68 void (*aux_function)(void *, void *); /* auxiliary function to help us decide what to do */ 69 void *aux_value; /* argument of aux_function */ 70 void *aux_rv_value; /* the return value of aux_function in (void *) */ 71 struct { 72 int (*click)(struct scrolltool_s *); 73 int (*clickclick)(struct scrolltool_s *); 74 #ifdef _WINDOWS 75 /* 76 * For systems that support it, allow caller to do popup menu 77 */ 78 int (*popup)(struct scrolltool_s *, int); 79 #endif 80 } mouse; 81 struct { /* where to start paging from */ 82 enum {FirstPage = 0, LastPage, Fragment, Offset, Handle} on; 83 union { 84 char *frag; /* fragment in html text to start on */ 85 long offset; 86 } loc; 87 } start; 88 struct { /* Non-default Command Processor */ 89 int (*tool)(int, MSGNO_S *, struct scrolltool_s *); 90 /* The union below is opaque as far as scrolltool itself is 91 * concerned, but is provided as a container to pass data 92 * between the scrolltool caller and the given "handler" 93 * callback (or any other callback that takes a scrolltool_s *). 94 */ 95 union { 96 void *p; 97 int i; 98 } data; 99 } proc; 100 /* End of page processing */ 101 int (*end_scroll)(struct scrolltool_s *); 102 /* Handler for invalid command input */ 103 int (*bogus_input)(UCS); 104 unsigned resize_exit:1; /* Return from scrolltool if resized */ 105 unsigned body_valid:1; /* Screen's body already displayed */ 106 unsigned no_stat_msg:1; /* Don't display status messages */ 107 unsigned vert_handle:1; /* hunt up and down on arrows/ctrl-[np] */ 108 unsigned srch_handle:1; /* search to next handle */ 109 unsigned quell_help:1; /* Don't show handle nav help message */ 110 unsigned quell_newmail:1; /* Don't check for new mail */ 111 unsigned quell_first_view:1; /* Don't act special first time through */ 112 unsigned jump_is_debug:1; 113 unsigned use_indexline_color:1; 114 } SCROLL_S; 115 116 117 /* exported prototypes */ 118 char *get_url_external_handler(char *, int); 119 int do_url_launch(char *, char *); 120 void mail_view_screen(struct pine *); 121 url_tool_t url_local_handler(char *); 122 int url_local_mailto(char *); 123 int url_local_mailto_and_atts(char *, PATMT *); 124 int url_local_fragment(char *); 125 int scrolltool(SCROLL_S *); 126 int ng_scroll_edit(CONTEXT_S *, int); 127 int folder_select_update(CONTEXT_S *, int); 128 int scroll_add_listmode(CONTEXT_S *, int); 129 void display_output_file(char *, char *, char *, int); 130 int rfc2369_editorial(long, HANDLE_S **, int, int, gf_io_t); 131 void view_writec_init(STORE_S *, HANDLE_S **, int, int); 132 void view_writec_destroy(void); 133 int view_writec(int); 134 135 136 #endif /* PINE_MAILVIEW_INCLUDED */ 137