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-2016 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 * Set this if the major revision number
73 * (the first after the dot) has changed.
75 ps
->phone_home
= (first_time_alpine_user
77 && isdigit((unsigned char) ps
->pine_pre_vers
[0])
78 && ps
->pine_pre_vers
[1] == '.'
79 && isdigit((unsigned char) ps
->pine_pre_vers
[2])
80 && isdigit((unsigned char) vers
[0])
82 && isdigit((unsigned char) vers
[2])
83 && strncmp(ps
->pine_pre_vers
, vers
, 3) < 0));
86 * At this point, shown_text is a charstarstar with html
87 * Turn it into a charstar with digested html
90 init_helper_getc(shown_text
);
91 init_handles(&handles
);
93 if((store
= so_get(CharStar
, NULL
, EDIT_ACCESS
)) != NULL
){
94 gf_set_so_writec(&pc
, store
);
97 gf_link_filter(gf_html2plain
,
98 gf_html2plain_opt("x-alpine-help:",
99 ps
->ttyo
->screen_cols
, non_messageview_margin(),
100 &handles
, NULL
, GFHP_LOCAL_HANDLES
));
102 error
= gf_pipe(helper_getc
, pc
);
104 gf_clear_so_writec(store
);
110 for(htmp
= handles
; htmp
; htmp
= htmp
->next
)
113 && (htmp
->h
.url
.path
[0] == 'x'
114 || htmp
->h
.url
.path
[0] == '#'))
115 htmp
->force_display
= 1;
117 /* This is mostly here to get the curses variables
118 * for line and column in sync with where the
119 * cursor is on the screen. This gets warped when
120 * the composer is called because it does it's own
125 memset(&sargs
, 0, sizeof(SCROLL_S
));
126 sargs
.text
.text
= so_text(store
);
127 sargs
.text
.src
= CharStar
;
128 sargs
.text
.desc
= "greeting text";
129 sargs
.text
.handles
= handles
;
130 sargs
.bar
.title
= "GREETING TEXT";
131 sargs
.bar
.style
= TextPercent
;
132 sargs
.proc
.tool
= nuov_processor
;
133 sargs
.help
.text
= main_menu_tx
;
134 sargs
.help
.title
= "MAIN PINE HELP";
135 sargs
.resize_exit
= 1;
136 sargs
.keys
.menu
= &km
;
139 memcpy(&keys
[0], nuov_keymenu
.keys
,
140 (nuov_keymenu
.how_many
* 12) * sizeof(struct key
));
141 setbitmap(sargs
.keys
.bitmap
);
144 km
.keys
[NUOV_EXIT
].label
= "Exit this greeting";
145 km
.keys
[NUOV_EXIT
].bind
.nch
= 1;
148 km
.keys
[NUOV_EXIT
].label
= "[Exit this greeting]";
149 km
.keys
[NUOV_EXIT
].bind
.nch
= 3;
150 clrbitn(NUOV_VIEW
, sargs
.keys
.bitmap
);
153 if(ps
->first_time_user
)
154 clrbitn(NUOV_RELNOTES
, sargs
.keys
.bitmap
);
156 cmd
= scrolltool(&sargs
);
160 if(F_ON(F_BLANK_KEYMENU
,ps_global
))
161 FOOTER_ROWS(ps_global
) = 1;
169 free_handles(&handles
);
171 while(cmd
== MC_RESIZE
);
176 nuov_processor(int cmd
, MSGNO_S
*msgmap
, SCROLL_S
*sparms
)
181 /*----------- Print all the help ------------*/
183 if(open_printer(sparms
->text
.desc
) == 0){
184 print_help(sparms
->proc
.data
.p
);
191 helper(h_news
, "ALPINE RELEASE NOTES", 0);
192 ps_global
->mangled_screen
= 1;
200 alpine_panic("Unhandled case");