int inbox_path_text_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) { char **apval; int rv = 0; char new_inbox_path[2*MAXFOLDER+1]; char *def = NULL; CONTEXT_S *cntxt; if(cmd != MC_EXIT && fixed_var((*cl)->var, NULL, NULL)) return(rv); apval = APVAL((*cl)->var, ew); switch(cmd){ case MC_ADD: case MC_EDIT: cntxt = ps->context_list; if(cmd == MC_EDIT && (*cl)->var){ if(ew == Post && (*cl)->var->post_user_val.p) def = (*cl)->var->post_user_val.p; else if(ew == Main && (*cl)->var->main_user_val.p) def = (*cl)->var->main_user_val.p; else if((*cl)->var->current_val.p) def = (*cl)->var->current_val.p; } rv = add_new_folder(cntxt, ew, V_INBOX_PATH, new_inbox_path, sizeof(new_inbox_path), NULL, def); rv = rv ? 1 : 0; ps->mangled_screen = 1; break; default: rv = text_tool(ps, cmd, cl, flags); break; } /* * This is just like the end of text_tool. */ if(rv == 1){ /* * Now go and set the current_val based on user_val changes * above. Turn off command line settings... */ set_current_val((*cl)->var, TRUE, FALSE); fix_side_effects(ps, (*cl)->var, 0); if((*cl)->value) fs_give((void **) &(*cl)->value); (*cl)->value = pretty_value(ps, *cl); exception_override_warning((*cl)->var); } return(rv); }
int context_config_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) { int retval = 0; switch(cmd){ case MC_DELETE : if(!fixed_var((*cl)->var, "delete", "collection")) retval = context_config_delete(ps, cl); break; case MC_EDIT : if(!fixed_var((*cl)->var, "change", "collection")) retval = context_config_edit(ps, cl); break; case MC_ADD : if(!fixed_var((*cl)->var, "add to", "collection")) retval = context_config_add(ps, cl); break; case MC_SHUFFLE : if(!fixed_var((*cl)->var, "shuffle", "collection")) retval = context_config_shuffle(ps, cl); break; case MC_EXIT : retval = simple_exit_cmd(flags); break; default: retval = -1; break; } if(retval > 0) ps->mangled_body = 1; return(retval); }
int to_charsets_text_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) { int rv = 0; char **newval = NULL; void (*prev_screen)(struct pine *) = ps->prev_screen, (*redraw)(void) = ps->redrawer; OPT_SCREEN_S *saved_screen = NULL; char **apval; char *charset = NULL; switch(cmd){ case MC_CHOICE: if(fixed_var((*cl)->var, NULL, NULL)) break; apval = APVAL((*cl)->var, ew); if(apval){ int cac_flags = CAC_ALL; ps->redrawer = NULL; ps->next_screen = SCREEN_FUN_NULL; saved_screen = opt_screen; if((*cl)->var == &ps->vars[V_POST_CHAR_SET]) cac_flags = CAC_POSTING; #ifndef _WINDOWS else if((*cl)->var == &ps->vars[V_CHAR_SET] || (*cl)->var == &ps->vars[V_KEY_CHAR_SET]) cac_flags = CAC_DISPLAY; #endif /* !_WINDOWS */ charset = choose_a_charset(cac_flags); removing_leading_and_trailing_white_space(charset); if(charset && *charset){ rv = 1; if(apval && *apval) fs_give((void **) apval); *apval = charset; charset = NULL; newval = &(*cl)->value; /* this stuff is from bottom of text_toolit() */ /* * At this point, if changes occurred, var->user_val.X is set. * So, fix the current_val, and handle special cases... * * NOTE: we don't worry about the "fixed variable" case here, because * editing such vars should have been prevented above... */ /* * Now go and set the current_val based on user_val changes * above. Turn off command line settings... */ set_current_val((*cl)->var, TRUE, FALSE); fix_side_effects(ps, (*cl)->var, 0); if(newval){ if(*newval) fs_give((void **) newval); *newval = pretty_value(ps, *cl); } exception_override_warning((*cl)->var); } else{ ps->next_screen = prev_screen; ps->redrawer = redraw; rv = 0; } if(charset) fs_give((void **) &charset); opt_screen = saved_screen; ps->mangled_screen = 1; } break; default: rv = text_tool(ps, cmd, cl, flags); break; } return(rv); }
int stayopen_list_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) { int rv = 0; char **newval = NULL; char **ltmp = NULL; char *folder = NULL; void (*prev_screen)(struct pine *) = ps->prev_screen, (*redraw)(void) = ps->redrawer; OPT_SCREEN_S *saved_screen = NULL; switch(cmd){ case MC_CHOICE: if(fixed_var((*cl)->var, NULL, NULL)) break; ps->redrawer = NULL; ps->next_screen = SCREEN_FUN_NULL; saved_screen = opt_screen; folder = folder_for_config(FOR_OPTIONSCREEN); removing_leading_and_trailing_white_space(folder); if(folder && *folder){ ltmp = (char **) fs_get(2 * sizeof(char *)); ltmp[0] = cpystr(folder); ltmp[1] = NULL; config_add_list(ps, cl, ltmp, &newval, 0); if(ltmp) fs_give((void **) <mp); rv = 1; /* this stuff is from bottom of text_toolit() */ /* * At this point, if changes occurred, var->user_val.X is set. * So, fix the current_val, and handle special cases... * * NOTE: we don't worry about the "fixed variable" case here, because * editing such vars should have been prevented above... */ /* * Now go and set the current_val based on user_val changes * above. Turn off command line settings... */ set_current_val((*cl)->var, TRUE, FALSE); fix_side_effects(ps, (*cl)->var, 0); /* * Delay setting the displayed value until "var.current_val" is set * in case current val get's changed due to a special case above. */ if(newval){ if(*newval) fs_give((void **) newval); *newval = pretty_value(ps, *cl); } exception_override_warning((*cl)->var); if(folder) fs_give((void **) &folder); } else{ ps->next_screen = prev_screen; ps->redrawer = redraw; rv = 0; } opt_screen = saved_screen; ps->mangled_screen = 1; break; default: rv = text_tool(ps, cmd, cl, flags); break; } return(rv); }
int incoming_monitoring_list_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) { int rv = 0; CONTEXT_S *cntxt; char **the_list; CONF_S *ctmp; char ***alval; OPT_SCREEN_S *saved_screen; if(cmd != MC_EXIT && fixed_var((*cl)->var, NULL, NULL)) return(rv); switch(cmd){ case MC_ADD: case MC_EDIT: cntxt = ps->context_list; if(!(cntxt && cntxt->use & CNTXT_INCMNG)){ q_status_message1(SM_ORDER, 3, 3, _("Turn on incoming folders with Config feature \"%s\""), pretty_feature_name(feature_list_name(F_ENABLE_INCOMING), -1)); return(rv); } saved_screen = opt_screen; the_list = adjust_list_of_monitored_incoming(cntxt, ew, V_INCCHECKLIST); /* adjust top if it might be necessary */ for(ctmp = (*cl)->varnamep; ctmp && ctmp->varnamep == (*cl)->varnamep; ctmp = next_confline(ctmp)) if(ctmp == opt_screen->top_line) opt_screen->top_line = (*cl)->varnamep; if(the_list){ alval = ALVAL((*cl)->var, ew); free_list_array(alval); if(!*the_list){ q_status_message(SM_ORDER, 0, 3, _("Using default, monitor all incoming folders")); if(alval){ /* * Remove config lines except for first one. */ *cl = (*cl)->varnamep; while((*cl)->next && (*cl)->next->varnamep == (*cl)->varnamep) snip_confline(&(*cl)->next); } } else config_add_list(ps, cl, the_list, NULL, 0); /* only have to free the top-level pointer */ fs_give((void **) &the_list); rv = 1; } else{ if(LVAL((*cl)->var, ew)) q_status_message(SM_ORDER, 0, 3, _("List is unchanged")); else q_status_message(SM_ORDER, 0, 3, _("Using default, monitor all incoming folders")); } opt_screen = saved_screen; ps->mangled_screen = 1; break; default: rv = text_tool(ps, cmd, cl, flags); /* if we deleted last one, reverts to default */ if(cmd == MC_DELETE && rv == 1 && (*cl)->varmem == 0 && (!(*cl)->next || (*cl)->next->varnamep != (*cl))) q_status_message(SM_ORDER, 0, 3, _("Using default, monitor all incoming folders")); break; } /* * This is just like the end of text_tool. */ if(rv == 1){ /* * Now go and set the current_val based on user_val changes * above. Turn off command line settings... */ set_current_val((*cl)->var, TRUE, FALSE); fix_side_effects(ps, (*cl)->var, 0); if((*cl)->value) fs_give((void **) &(*cl)->value); (*cl)->value = pretty_value(ps, *cl); exception_override_warning((*cl)->var); } return(rv); }
int litsig_text_tool(struct pine *ps, int cmd, CONF_S **cl, unsigned int flags) { char **apval; int rv = 0; if(cmd != MC_EXIT && fixed_var((*cl)->var, NULL, NULL)) return(rv); apval = APVAL((*cl)->var, ew); switch(cmd){ case MC_ADD: case MC_EDIT : if(apval){ char *input = NULL, *result = NULL, *err = NULL, *cstring_version; char *olddefval = NULL, *start_with; size_t len; if(!*apval && (*cl)->var->current_val.p && (*cl)->var->current_val.p[0]){ if(!strncmp((*cl)->var->current_val.p, DSTRING, (len=strlen(DSTRING)))){ /* strip DSTRING and trailing paren */ olddefval = (char *)fs_get(strlen((*cl)->var->current_val.p)+1); strncpy(olddefval, (*cl)->var->current_val.p+len, strlen((*cl)->var->current_val.p)-len-1); olddefval[strlen((*cl)->var->current_val.p)-len-1] = '\0'; start_with = olddefval; } else{ olddefval = cpystr((*cl)->var->current_val.p); start_with = olddefval; } } else start_with = (*apval) ? *apval : ""; input = (char *)fs_get((strlen(start_with)+1) * sizeof(char)); input[0] = '\0'; cstring_to_string(start_with, input); err = signature_edit_lit(input, &result, ((*cl)->var == role_comment_ptr) ? "COMMENT EDITOR" : "SIGNATURE EDITOR", ((*cl)->var == role_comment_ptr) ? h_composer_commentedit : h_composer_sigedit); if(!err){ if(olddefval && !strcmp(input, result) && want_to(_("Leave unset and use default "), 'y', 'y', NO_HELP, WT_FLUSH_IN) == 'y'){ rv = 0; } else{ cstring_version = string_to_cstring(result); if(apval && *apval) fs_give((void **)apval); if(apval){ *apval = cstring_version; cstring_version = NULL; } if(cstring_version) fs_give((void **)&cstring_version); rv = 1; } } else rv = 0; if(err){ q_status_message1(SM_ORDER, 3, 5, "%s", err); fs_give((void **)&err); } if(result) fs_give((void **)&result); if(olddefval) fs_give((void **)&olddefval); if(input) fs_give((void **)&input); } ps->mangled_screen = 1; break; default: rv = text_tool(ps, cmd, cl, flags); break; } /* * At this point, if changes occurred, var->user_val.X is set. * So, fix the current_val, and handle special cases... * * NOTE: we don't worry about the "fixed variable" case here, because * editing such vars should have been prevented above... */ if(rv == 1){ /* * Now go and set the current_val based on user_val changes * above. Turn off command line settings... */ set_current_val((*cl)->var, TRUE, FALSE); if((*cl)->value) fs_give((void **)&(*cl)->value); (*cl)->value = pretty_value(ps, *cl); exception_override_warning((*cl)->var); /* * The value of literal sig can affect whether signature file is * used or not. So it affects what we display for sig file variable. */ if((*cl)->next && (*cl)->next->var == &ps->vars[V_SIGNATURE_FILE]){ if((*cl)->next->value) fs_give((void **)&(*cl)->next->value); (*cl)->next->value = pretty_value(ps, (*cl)->next); } } return(rv); }
/*---------------------------------------------------------------------- The printer selection screen Draws the screen and prompts for the printer number and the custom command if so selected. ----*/ void select_printer(struct pine *ps, int edit_exceptions) { struct variable *vtmp; CONF_S *ctmpa = NULL, *ctmpb = NULL, *heading = NULL, *start_line = NULL; PINERC_S *prc = NULL; int i, saved_printer_cat, readonly_warning = 0, no_ex; SAVED_CONFIG_S *vsave; char *saved_printer, **lval; OPT_SCREEN_S screen; size_t l; if(edit_exceptions){ q_status_message(SM_ORDER, 3, 7, _("Exception Setup not implemented for printer")); return; } if(fixed_var(&ps_global->vars[V_PRINTER], "change", "printer")) return; ew = edit_exceptions ? ps_global->ew_for_except_vars : Main; no_ex = (ps_global->ew_for_except_vars == Main); if(ps->restricted) readonly_warning = 1; else{ switch(ew){ case Main: prc = ps->prc; break; case Post: prc = ps->post_prc; break; default: break; } readonly_warning = prc ? prc->readonly : 1; if(prc && prc->quit_to_edit){ quit_to_edit_msg(prc); return; } } saved_printer = cpystr(ps->VAR_PRINTER); saved_printer_cat = ps->printer_category; new_confline(&ctmpa); ctmpa->valoffset = 2; ctmpa->keymenu = &printer_select_keymenu; ctmpa->help = NO_HELP; ctmpa->tool = print_select_tool; ctmpa->flags |= CF_NOSELECT; ctmpa->value #ifdef OS2 = cpystr("\"Select\" a port or |pipe-command as your default printer."); #else = cpystr(_("You may \"Select\" a print command as your default printer."));