1 #if !defined(lint) && !defined(DOS)
2 static char rcsid
[] = "$Id: newuser.c 1266 2009-07-14 18:39:12Z hubert@u.washington.edu $";
6 * ========================================================================
7 * Copyright 2013-2020 Eduardo Chappa
8 * Copyright 2006-2008 University of Washington
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
25 #include "osdep/print.h"
26 #include "../pith/state.h"
27 #include "../pith/conf.h"
28 #include "../pith/msgno.h"
29 #include "../pith/filter.h"
30 #include "../pith/init.h"
31 #include "../pith/margin.h"
37 int nuov_processor(int, MSGNO_S
*, SCROLL_S
*);
41 * Display a new user or new version message.
44 new_user_or_version(struct pine
*ps
)
48 int first_time_alpine_user
= 0;
53 HANDLE_S
*handles
= NULL
, *htmp
;
55 char *vers
= ps
->vers_internal
;
57 first_time_alpine_user
= (ps
->first_time_user
59 && isdigit((unsigned char) ps
->pine_pre_vers
[0])
60 && ps
->pine_pre_vers
[1] == '.'
61 && isdigit((unsigned char) vers
[0])
63 && ps
->pine_pre_vers
[0] < '5' /* it was Pine */
64 && vers
[0] >= '5')); /* Alpine */
66 text
= ps
->first_time_user
? new_user_greeting
:
67 first_time_alpine_user
? new_alpine_user_greeting
: new_version_greeting
;
72 * At this point, shown_text is a charstarstar with html
73 * Turn it into a charstar with digested html
76 init_helper_getc(shown_text
);
77 init_handles(&handles
);
79 if((store
= so_get(CharStar
, NULL
, EDIT_ACCESS
)) != NULL
){
80 gf_set_so_writec(&pc
, store
);
83 gf_link_filter(gf_html2plain
,
84 gf_html2plain_opt("x-alpine-help:",
85 ps
->ttyo
->screen_cols
, non_messageview_margin(),
86 &handles
, NULL
, GFHP_LOCAL_HANDLES
));
88 error
= gf_pipe(helper_getc
, pc
);
90 gf_clear_so_writec(store
);
96 for(htmp
= handles
; htmp
; htmp
= htmp
->next
)
99 && (htmp
->h
.url
.path
[0] == 'x'
100 || htmp
->h
.url
.path
[0] == '#'))
101 htmp
->force_display
= 1;
103 /* This is mostly here to get the curses variables
104 * for line and column in sync with where the
105 * cursor is on the screen. This gets warped when
106 * the composer is called because it does it's own
111 memset(&sargs
, 0, sizeof(SCROLL_S
));
112 sargs
.text
.text
= so_text(store
);
113 sargs
.text
.src
= CharStar
;
114 sargs
.text
.desc
= "greeting text";
115 sargs
.text
.handles
= handles
;
116 sargs
.bar
.title
= "GREETING TEXT";
117 sargs
.bar
.style
= TextPercent
;
118 sargs
.proc
.tool
= nuov_processor
;
119 sargs
.help
.text
= main_menu_tx
;
120 sargs
.help
.title
= "MAIN PINE HELP";
121 sargs
.resize_exit
= 1;
122 sargs
.keys
.menu
= &km
;
125 memcpy(&keys
[0], nuov_keymenu
.keys
,
126 (nuov_keymenu
.how_many
* 12) * sizeof(struct key
));
127 setbitmap(sargs
.keys
.bitmap
);
129 km
.keys
[NUOV_EXIT
].label
= "Exit this greeting";
131 if(ps
->first_time_user
)
132 clrbitn(NUOV_RELNOTES
, sargs
.keys
.bitmap
);
134 cmd
= scrolltool(&sargs
);
138 if(F_ON(F_BLANK_KEYMENU
,ps_global
))
139 FOOTER_ROWS(ps_global
) = 1;
147 free_handles(&handles
);
149 while(cmd
== MC_RESIZE
);
154 nuov_processor(int cmd
, MSGNO_S
*msgmap
, SCROLL_S
*sparms
)
159 /*----------- Print all the help ------------*/
161 if(open_printer(sparms
->text
.desc
) == 0){
162 print_help(sparms
->proc
.data
.p
);
169 helper(h_news
, "ALPINE RELEASE NOTES", 0);
170 ps_global
->mangled_screen
= 1;
178 alpine_panic("Unhandled case");