diff -rc pine4.63/pine/mailview.c pine4.63.composeurl/pine/mailview.c *** pine4.63/pine/mailview.c Wed Apr 27 11:55:02 2005 --- pine4.63.composeurl/pine/mailview.c Thu Apr 28 19:54:18 2005 *************** *** 152,157 **** --- 152,158 ---- #define SS_CUR 2 #define SS_FREE 3 + static ACTION_S *role_chosen = NULL; /* * Def's to help page reframing based on handles *************** *** 2691,2696 **** --- 2692,2699 ---- {0, 'a', "A", "editApp"}, {-1, 0, NULL, NULL}}; + if (role_chosen) + free_action(&role_chosen); if(handle->type == URL){ launch_opts[4].ch = 'u'; *************** *** 2801,2811 **** * sense if you just say View selected URL ... */ if(handle->type == URL && ! !struncmp(handle->h.url.path, "mailto:", 7)) ! sprintf(prompt, "Compose mail to \"%.*s%s\" ? ", ! min(max(0,sc - 25), sizeof(prompt)-50), handle->h.url.path+7, ! (strlen(handle->h.url.path+7) > max(0,sc-25)) ? "..." : ""); ! else sprintf(prompt, "View selected %s %s%.*s%s ? ", (handle->type == URL) ? "URL" : "Attachment", (handle->type == URL) ? "\"" : "", --- 2804,2844 ---- * sense if you just say View selected URL ... */ if(handle->type == URL && ! !struncmp(handle->h.url.path, "mailto:", 7)){ ! int rolenick = role_chosen ? strlen(role_chosen->nick) : 0; ! int offset = 25 + (role_chosen ? 20 : 0); ! int offset2 = max(0, sc - offset) - strlen(handle->h.url.path+7); ! int offset3 = sc - strlen(handle->h.url.path+7) - rolenick - offset; ! int laddress = min(max(0,sc - offset), sizeof(prompt)-50); ! int lrole = rolenick; ! ! if (offset3 < 0){ ! lrole = rolenick; ! laddress = sc - offset - lrole; ! offset3 = laddress - 20; /* redefine offset3 */ ! if (offset3 < 0){ ! laddress = 20; ! lrole = sc - offset - laddress; ! } ! } ! launch_opts[2].ch = 'r'; ! launch_opts[2].rval = 'r'; ! launch_opts[2].name = "R"; ! launch_opts[2].label = "Set Role"; ! sprintf(prompt, "Compose mail to \"%.*s%s\" %s%.*s%s%s? ", ! laddress, handle->h.url.path+7, ! offset2 < 0 ? "..." : "", ! role_chosen ? "using role \"" : "", ! role_chosen ? lrole : 0, ! role_chosen ? role_chosen->nick : "", ! role_chosen ? (rolenick > lrole ? "..." : "") : "", ! role_chosen ? "\" " : ""); ! } ! else{ ! launch_opts[2].ch = -2; ! launch_opts[2].rval = 0; ! launch_opts[2].name = NULL; ! launch_opts[2].label = NULL; sprintf(prompt, "View selected %s %s%.*s%s ? ", (handle->type == URL) ? "URL" : "Attachment", (handle->type == URL) ? "\"" : "", *************** *** 2814,2825 **** --- 2847,2881 ---- (handle->type == URL) ? ((strlen(handle->h.url.path) > max(0,sc-27)) ? "...\"" : "\"") : ""); + } switch(radio_buttons(prompt, -FOOTER_ROWS(ps_global), launch_opts, 'y', 'n', NO_HELP, RB_SEQ_SENSITIVE)){ case 'y' : return(1); + case 'r': + { + void (*prev_screen)() = ps_global->prev_screen, + (*redraw)() = ps_global->redrawer; + ps_global->redrawer = NULL; + ps_global->next_screen = SCREEN_FUN_NULL; + if(role_select_screen(ps_global, &role_chosen, 1) < 0){ + cmd_cancelled("Compose"); + ps_global->next_screen = prev_screen; + ps_global->redrawer = redraw; + if(ps_global->redrawer) + (*ps_global->redrawer)(); + return 0; + } + ps_global->next_screen = prev_screen; + ps_global->redrawer = redraw; + if(role_chosen) + role_chosen = combine_inherited_role(role_chosen); + if(ps_global->redrawer) + (*ps_global->redrawer)(); + } + case 'u' : strncpy(tmp, handle->h.url.path, sizeof(tmp)-1); tmp[sizeof(tmp)-1] = '\0'; *************** *** 5017,5023 **** fs_give((void **) &urlp); rflags = ROLE_COMPOSE; ! if(nonempty_patterns(rflags, &dummy)){ role = set_role_from_msg(ps_global, rflags, -1L, NULL); if(confirm_role(rflags, &role)) role = combine_inherited_role(role); --- 5073,5079 ---- fs_give((void **) &urlp); rflags = ROLE_COMPOSE; ! if(!(role = copy_action(role_chosen)) && nonempty_patterns(rflags, &dummy)){ role = set_role_from_msg(ps_global, rflags, -1L, NULL); if(confirm_role(rflags, &role)) role = combine_inherited_role(role); *************** *** 5093,5098 **** --- 5149,5155 ---- free_redraft_pos(&redraft_pos); free_action(&role); + free_action(&role_chosen); return(rv); }