/*********************************************************** * ANNOUNCE * 取得近站公告 ************************************************************/ DoAnnounce() { if (!isfile(WELCOME)) RespondProtocol(NO_ANNOUNCE); else SendArticle(WELCOME, TRUE); }
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; }