2 * ========================================================================
3 * Copyright 2013-2022 Eduardo Chappa
4 * Copyright 2006-2008 University of Washington
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
21 #include "osdep/print.h"
22 #include "../pith/state.h"
23 #include "../pith/conf.h"
24 #include "../pith/msgno.h"
25 #include "../pith/filter.h"
26 #include "../pith/init.h"
27 #include "../pith/margin.h"
33 int nuov_processor(int, MSGNO_S
*, SCROLL_S
*);
37 * Display a new user or new version message.
40 new_user_or_version(struct pine
*ps
)
44 int first_time_alpine_user
= 0;
49 HANDLE_S
*handles
= NULL
, *htmp
;
51 char *vers
= ps
->vers_internal
;
53 first_time_alpine_user
= (ps
->first_time_user
55 && isdigit((unsigned char) ps
->pine_pre_vers
[0])
56 && ps
->pine_pre_vers
[1] == '.'
57 && isdigit((unsigned char) vers
[0])
59 && ps
->pine_pre_vers
[0] < '5' /* it was Pine */
60 && vers
[0] >= '5')); /* Alpine */
62 text
= ps
->first_time_user
? new_user_greeting
:
63 first_time_alpine_user
? new_alpine_user_greeting
: new_version_greeting
;
68 * At this point, shown_text is a charstarstar with html
69 * Turn it into a charstar with digested html
72 init_helper_getc(shown_text
);
73 init_handles(&handles
);
75 if((store
= so_get(CharStar
, NULL
, EDIT_ACCESS
)) != NULL
){
76 gf_set_so_writec(&pc
, store
);
79 gf_link_filter(gf_html2plain
,
80 gf_html2plain_opt("x-alpine-help:",
81 ps
->ttyo
->screen_cols
, non_messageview_margin(),
82 &handles
, NULL
, GFHP_LOCAL_HANDLES
));
84 error
= gf_pipe(helper_getc
, pc
);
86 gf_clear_so_writec(store
);
92 for(htmp
= handles
; htmp
; htmp
= htmp
->next
)
95 && (htmp
->h
.url
.path
[0] == 'x'
96 || htmp
->h
.url
.path
[0] == '#'))
97 htmp
->force_display
= 1;
99 /* This is mostly here to get the curses variables
100 * for line and column in sync with where the
101 * cursor is on the screen. This gets warped when
102 * the composer is called because it does it's own
107 memset(&sargs
, 0, sizeof(SCROLL_S
));
108 sargs
.text
.text
= so_text(store
);
109 sargs
.text
.src
= CharStar
;
110 sargs
.text
.desc
= "greeting text";
111 sargs
.text
.handles
= handles
;
112 sargs
.bar
.title
= "GREETING TEXT";
113 sargs
.bar
.style
= TextPercent
;
114 sargs
.proc
.tool
= nuov_processor
;
115 sargs
.help
.text
= main_menu_tx
;
116 sargs
.help
.title
= "MAIN PINE HELP";
117 sargs
.resize_exit
= 1;
118 sargs
.keys
.menu
= &km
;
121 memcpy(&keys
[0], nuov_keymenu
.keys
,
122 (nuov_keymenu
.how_many
* 12) * sizeof(struct key
));
123 setbitmap(sargs
.keys
.bitmap
);
125 km
.keys
[NUOV_EXIT
].label
= "Exit this greeting";
127 if(ps
->first_time_user
)
128 clrbitn(NUOV_RELNOTES
, sargs
.keys
.bitmap
);
130 cmd
= scrolltool(&sargs
);
134 if(F_ON(F_BLANK_KEYMENU
,ps_global
))
135 FOOTER_ROWS(ps_global
) = 1;
143 free_handles(&handles
);
145 while(cmd
== MC_RESIZE
);
150 nuov_processor(int cmd
, MSGNO_S
*msgmap
, SCROLL_S
*sparms
)
155 /*----------- Print all the help ------------*/
157 if(open_printer(sparms
->text
.desc
) == 0){
158 print_help(sparms
->proc
.data
.p
);
165 helper(h_news
, "ALPINE RELEASE NOTES", 0);
166 ps_global
->mangled_screen
= 1;
174 alpine_panic("Unhandled case");