static char rcsid[] = "@(#)$Id: a_screen.c,v 1.20 2006/04/09 07:37:17 hurtta Exp $";
/******************************************************************************
* The Elm (ME+) Mail System - $Revision: 1.20 $ $State: Exp $
*
* Modified by: Kari Hurtta <hurtta+elm@posti.FMI.FI>
* (was hurtta+elm@ozone.FMI.FI)
******************************************************************************
* The Elm Mail System
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
*****************************************************************************/
/** alias screen display routines for ELM program
**/
#include "def_elm.h"
#include "s_aliases.h"
char *show_alias_status(entry)
struct alias_rec *entry;
{
/* Based on show_status() on src/screen.c */
/** This routine returns a pair of characters indicative of
the status of this message. The first character represents
the interim status of the message (e.g. the status within
the mail system):
E = Expired message
N = New message
O = Unread old message dsi mailx emulation addition
D = Deleted message
_ = (space) default
and the second represents the permanent attributes of the
message:
_ = (space) default
**/
static char mybuffer[3];
/** the first character, please **/
if (entry->status & DELETED) mybuffer[0] = 'D';
else if (entry->status & EXPIRED) mybuffer[0] = 'E';
else if (entry->status & NEW) mybuffer[0] = 'N';
else if (entry->status & UNREAD) mybuffer[0] = 'O';
else if (entry->status & REPLIED) mybuffer[0] = 'r';
else mybuffer[0] = ' ';
/** and the second... **/
mybuffer[1] = ' ';
mybuffer[2] = '\0';
return( (char *) mybuffer);
}
void alias_screen(aview, page)
struct AliasView *aview;
struct menu_context *page;
{
struct menu_common MENU;
set_mcommon_from_aliasview(&MENU,aview);
/* Stolen from showscreen() */
menu_ClearScreen(page);
/* Call refresh routines of children */
menu_redraw_children(page);
show_last_error();
/* define_softkeys(ALIAS); */
}
#if ANSI_C
subpage_simple_redraw sb_alias_menu;
#endif
int sb_alias_menu(ptr,list)
struct menu_context *ptr;
struct menu_param *list;
{
struct menu_common *mptr = mp_lookup_mcommon(list,elm_mp_menu);
int ul = give_dt_enumerate_as_int(&user_level);
menu_ClearScreen(ptr);
/** write alias menu... **/
/* Moved from alias.c */
if (ul == RANK_AMATEUR) { /* Give less options */
menu_print_format_center(ptr,0,
CATGETS(elm_msg_cat, AliasesSet,
AliasesRMenuLn1,
"You can use any of the following commands by pressing the first character;"));
menu_print_format_center(ptr,1,
CATGETS(elm_msg_cat, AliasesSet,
AliasesRMenuLn2,
"a)lias current message, n)ew alias, d)elete or u)ndelete an alias,"));
menu_print_format_center(ptr,2,
CATGETS(elm_msg_cat, AliasesSet,
AliasesRMenuLn3,
"m)ail to alias, or r)eturn to main menu. To view an alias, press <return>."));
menu_print_format_center(ptr,3,
CATGETS(elm_msg_cat, AliasesSet,
AliasesRMenuLn4,
"j = move down, k = move up, ? = help"));
} else {
menu_print_format_center(ptr,0,
CATGETS(elm_msg_cat, AliasesSet,
AliasesMenuLn1,
"Alias commands: ?=help, <n>=set current to n, /=search pattern"));
menu_print_format_center(ptr,1,
CATGETS(elm_msg_cat, AliasesSet,
AliasesMenuLn2,
"a)lias current message, c)hange, d)elete, e)dit aliases.text, f)ully expand,"));
menu_print_format_center(ptr,2,
CATGETS(elm_msg_cat, AliasesSet,
AliasesMenuLn3,
"l)imit display, m)ail, n)ew alias, r)eturn, t)ag, u)ndelete, or e(x)it"));
}
return 1;
}
struct string *build_alias_line(entry, message_number, highlight, page)
struct alias_rec *entry;
int message_number, highlight;
struct menu_context *page;
{
/** Build in buffer the alias header ... entry is the current
message entry, 'highlight' is either TRUE or FALSE,
and 'message_number' is the number of the message.
**/
struct string * buffer = NULL;
struct string * mybuffer = NULL;
struct string * ret = NULL;
int name_width;
int LINES, COLUMNS;
menu_get_sizes(page,&LINES,&COLUMNS);
buffer = format_string(FRM("%s%s%c%-3d "),
(highlight && arrow_cursor)? "->" : " ",
show_alias_status(entry),
(entry->status & TAGGED? '+' : ' '),
message_number);
/* Set the name display width. */
name_width = COLUMNS-40;
/* Put the name and associated comment
(or just the address if null) in local buffer */
if (strlen(entry->name)) {
if (strlen(entry->comment))
mybuffer = format_string(FRM("%.100s, %.100s"),
entry->name, entry->comment);
else
mybuffer = format_string(FRM("%.100s"),
entry->name);
} else
mybuffer = format_string(FRM("%.100s"),
entry->address);
/* complete line with name, type and alias. */
ret = format_string(FRM("%S%-*.*S %s %-20.20s"),
buffer,
/* give max and min width parameters for 'name' */
name_width, name_width, mybuffer,
alias_type(entry->type),
entry->alias);
free_string(&mybuffer);
free_string(&buffer);
return ret;
}
char *alias_type(type)
int type;
{
/** This routine returns a string showing the alias type,
'Person' or 'Group' aliases. Additionally, a '(S)'
is appended if this is a system alias.
**/
static char mybuffer[10];
extern char *a_group_name, *a_person_name, *a_system_flag;
if (type & GROUP) strfcpy(mybuffer, a_group_name, sizeof mybuffer);
else strfcpy(mybuffer, a_person_name, sizeof mybuffer);
if (type & SYSTEM) strfcat(mybuffer, a_system_flag, sizeof mybuffer);
else strfcat(mybuffer, " ", sizeof mybuffer);
return( (char *) mybuffer);
}
/*
* Local Variables:
* mode:c
* c-basic-offset:4
* buffer-file-coding-system: iso-8859-1
* End:
*/
syntax highlighted by Code2HTML, v. 0.9.1