Path: utzoo!attcan!uunet!lll-winken!brutus.cs.uiuc.edu!psuvax1!rutgers!soleil!slopoke.semi.harris-atd.com!thrush.semi.harris-atd.com!del From: del@thrush.semi.harris-atd.com (Don Lewis) Newsgroups: comp.mail.mush Subject: mushtool bugs and patches (long) Message-ID: <1989Nov21.055514.6990@semi.harris-atd.com> Date: 21 Nov 89 05:55:14 GMT Sender: news@semi.harris-atd.com Reply-To: del@thrush.semi.harris-atd.com (Don Lewis) Organization: Harris Semiconductor, Melbourne, FL Lines: 238 I've been using mush 7.0.0.0 for a week or so, primarily in tool mode under SunOS 4.0.1. I have found a few problems and thought I'd share my patches with you. The first problem is that the pop-up windows don't get destroyed when you are done with them causing mushtool to eventually to run out of file descriptors and core dump. The FRAME_NO_CONFIRM is optional, but I think it's less of a hassle to use this way. Maybe it should be a user settable option. *** ORIGmisc.c Thu Sep 7 11:26:16 1989 --- misc.c Mon Nov 13 20:58:07 1989 *************** *** 476,481 **** --- 476,483 ---- text_frame = window_create(tool, FRAME, FRAME_SHOW_LABEL, TRUE, FRAME_LABEL, more_prompt, + FRAME_DONE_PROC, window_destroy, + FRAME_NO_CONFIRM, TRUE, WIN_HEIGHT, l_height(curfont) * (crt_win? max(atoi(crt_win), 10) : 30), NULL); The second problem causes the "Next" button in the main panel to pop up a window to browse the message intermittently. BTW, is there any good reason that the buttons were implemented as choice items with display of the choices turned of versus button items with menus? *** ORIGdoproc.c Sat Sep 16 17:42:57 1989 --- doproc.c Mon Nov 13 21:53:50 1989 *************** *** 69,74 **** --- 69,76 ---- /* check "event" in case we were called from select.c * in which case event would be NULL */ + if (event && event_id(event) == MS_LEFT) + value = 0; if (event && event_id(event) == MS_RIGHT && item && (item == read_item && value > 1 || (item == sub_hdr_item[0] || item == sub_hdr_item[1]))) The third problem causes the "f" or "r" flags to be set on a piece of mail if you start to reply to or forward this piece of mail and then abort before actually sending the the mail. This patch is a bit ugly. It defers setting these flags until after the mail is send. Any ideas on better ways of doing this? *** ORIGmail.c Fri Sep 15 17:11:28 1989 --- mail.c Mon Nov 13 16:55:00 1989 *************** *** 36,41 **** --- 36,43 ---- static int send_it(); static long add_headers(); static jmp_buf cntrl_c_buf; + static int is_responding; + static int forwarded_message; FILE *ed_fp; char *edfile, *mktemp(); *************** *** 155,161 **** if (do_set(set_options, "autosign")) turnon(flgs, SIGN); *in_reply_to = *To = *Subject = *Cc = *Bcc = 0; ! if (lower(firstchar) == 'r') { char *old_fmt = hdr_format, *pcc = NULL; to = To, cc = Cc; /* --- 157,163 ---- if (do_set(set_options, "autosign")) turnon(flgs, SIGN); *in_reply_to = *To = *Subject = *Cc = *Bcc = 0; ! if (is_responding = (lower(firstchar) == 'r')) { char *old_fmt = hdr_format, *pcc = NULL; to = To, cc = Cc; /* *************** *** 390,396 **** set_msg_bit(fwd, i); if (start_file(fwd) < 0) return -1; ! turnon(msg[i].m_flags, FORWARD); clear_msg_list(fwd); } } else --- 392,401 ---- set_msg_bit(fwd, i); if (start_file(fwd) < 0) return -1; ! if (!istool) ! turnon(msg[i].m_flags, FORWARD); ! else ! forwarded_message=i; clear_msg_list(fwd); } } else *************** *** 1053,1058 **** --- 1058,1065 ---- /* forwarded mail has no additional personalized text */ if (ison(flags, FORWARD)) { (void) send_it(); + if (istool && isoff(flags, EDIT)) + turnon(msg[forwarded_message].m_flags, FORWARD); turnoff(glob_flags, IS_GETTING); return 1; } *************** *** 1102,1107 **** --- 1109,1116 ---- if (!send_it()) return 0; turnoff(glob_flags, IS_GETTING); + if (is_responding && istool) + set_reply_bits(); return 1; } *** ORIGcommands.c Fri Sep 15 15:56:51 1989 --- commands.c Mon Nov 13 16:38:56 1989 *************** *** 435,448 **** return 0; } respond(n, argv, list) register int n; /* no use for argc, so use its address space for a variable */ register char **argv, *list; { register char *cmd = *argv; ! char list1[MAXMSGS_BITS]; ! int cur_msg = current_msg, save_cnt = msg_cnt; if (*++argv && !strcmp(*argv, "-?")) return help(0, "respond", cmd_help); if ((n = get_msg_list(argv, list)) == -1) --- 435,468 ---- return 0; } + static char list1[MAXMSGS_BITS]; + static int save_cnt; + + set_reply_bits() + { + int n; + /* New mail may have arrived during do_mail(), which will change + * the msg_cnt. Use the old count when examining the list of bits + * to set the replied flag, or the wrong messages can be marked. + */ + for (n = 0; n < save_cnt; n++) + if (msg_bit(list1, n)) { + /* set_isread(n); */ + set_replied(n); /* only if mail got delivered */ + } + if (istool) + (void) do_hdrs(0, DUBL_NULL, NULL); + } + respond(n, argv, list) register int n; /* no use for argc, so use its address space for a variable */ register char **argv, *list; { register char *cmd = *argv; ! int cur_msg = current_msg; + save_cnt = msg_cnt; + if (*++argv && !strcmp(*argv, "-?")) return help(0, "respond", cmd_help); if ((n = get_msg_list(argv, list)) == -1) *************** *** 467,483 **** } if (do_mail(1 /* ignored */, argv, list) == -1) return -1; ! /* New mail may have arrived during do_mail(), which will change ! * the msg_cnt. Use the old count when examining the list of bits ! * to set the replied flag, or the wrong messages can be marked. ! */ ! for (n = 0; n < save_cnt; n++) ! if (msg_bit(list1, n)) { ! /* set_isread(n); */ ! set_replied(n); /* only if mail got delivered */ ! } ! if (istool) ! (void) do_hdrs(0, DUBL_NULL, NULL); /* copy the specified list back into msg_list */ bitput(list1, list, MAXMSGS, =); return 0; --- 487,496 ---- } if (do_mail(1 /* ignored */, argv, list) == -1) return -1; ! ! if (!istool) ! set_reply_bits(); ! /* copy the specified list back into msg_list */ bitput(list1, list, MAXMSGS, =); return 0; I have also noticed some problems with the function keys. The function keys only work in certain windows. The Sunview open/close and front/back keys also get interpreted as function keys. The fkey command doesn't seem to know about the built in key definitions. Some of the built in key bindings are sort of bogus in these modern times. What happened to the facility for setting the fkeys in tool mode (the pop up keyboard picture) that was in 6.5.6? Is anyone out there working on these? I have a few ideas, but if only I had the time.... -- Don "Truck" Lewis Harris Semiconductor Internet (if you're lucky): del@semi.harris-atd.com PO Box 883 MS 62A-028 Internet (if not): del%thrush@trantor.harris-atd.com Melbourne, FL 32901 UUCP (works): rutgers!soleil!thrush!del Phone: (407) 729-5205