/* * UserMailReply: Set up a reply to the given message. If reply_all is True, reply to * all recipients of given message number; otherwise reply just to sender. */ void UserMailReply(int msg_num, Bool reply_all) { MailInfo *reply; reply = (MailInfo *) SafeMalloc(sizeof(MailInfo)); // Freed when reply dialog ends MailParseMessage(msg_num, reply); if (reply_all) { if (reply->num_recipients >= MAX_RECIPIENTS) { // If user wants to go ahead anyway, just truncate recipients if (!AreYouSure(hInst, hReadMailDlg, NO_BUTTON, IDS_TOOMANYRECIPIENTS, MAX_RECIPIENTS)) return; reply->num_recipients--; // Add sender below } strcpy(reply->recipients[reply->num_recipients], reply->sender); reply->num_recipients++; } else { reply->num_recipients = 1; strcpy(reply->recipients[0], reply->sender); } MakeReplySubject(reply->subject, MAX_SUBJECT); MailSendReply(hReadMailDlg, reply); }
BOOL CALLBACK PostNewsDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { static HWND hEdit, hSubject; static PostNewsDialogStruct *info; char *buf, subject[MAX_SUBJECT]; int len; MINMAXINFO *lpmmi; switch (message) { case WM_INITDIALOG: CenterWindow(hDlg, cinfo->hMain); info = (PostNewsDialogStruct *) lParam; hEdit = GetDlgItem(hDlg, IDC_NEWSEDIT); hSubject = GetDlgItem(hDlg, IDC_SUBJECT); Edit_LimitText(hEdit, MAXARTICLE); SetWindowFont(hEdit, GetFont(FONT_MAIL), TRUE); Edit_LimitText(hSubject, MAX_SUBJECT - 1); SetWindowFont(hSubject, GetFont(FONT_MAIL), TRUE); /* Store dialog rectangle in case of resize */ GetWindowRect(hDlg, &dlg_rect); /* Set default subject if appropriate */ if (info->subject != NULL) { MakeReplySubject(info->subject, MAX_SUBJECT); Edit_SetText(hSubject, info->subject); SetFocus(hEdit); } else SetFocus(hSubject); /* Display group name */ SetWindowText(GetDlgItem(hDlg, IDC_GROUPNAME), LookupNameRsc(info->group_name_rsc)); EnableWindow(GetDlgItem(hDlg, IDOK), FALSE); hPostNewsDialog = hDlg; return FALSE; HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, MailCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, MailCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, MailCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORDLG, MailCtlColor); case WM_SIZE: ResizeDialog(hDlg, &dlg_rect, newssend_controls); return TRUE; case WM_GETMINMAXINFO: lpmmi = (MINMAXINFO *) lParam; lpmmi->ptMinTrackSize.x = 200; lpmmi->ptMinTrackSize.y = 300; return 0; case WM_DESTROY: hPostNewsDialog = NULL; if (exiting) PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID); return TRUE; case WM_COMMAND: UserDidSomething(); switch(GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_NEWSEDIT: if (GET_WM_COMMAND_CMD(wParam, lParam) != EN_CHANGE) return TRUE; /* Only allow user to post when article is nonempty */ if (Edit_GetTextLength(hEdit) > 0) EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); else EnableWindow(GetDlgItem(hDlg, IDOK), FALSE); return TRUE; case IDOK: /* Get title and article; post article */ Edit_GetText(hSubject, subject, MAX_SUBJECT); len = Edit_GetTextLength(hEdit); buf = (char *) SafeMalloc(len + 1); Edit_GetText(hEdit, buf, len + 1); SendArticle(info->newsgroup, subject, buf); SafeFree(buf); EndDialog(hDlg, IDOK); return TRUE; case IDCANCEL: EndDialog(hDlg, IDCANCEL); return TRUE; } } return FALSE; }