(* @ /// 0000000601 *) (* @ /// procedure t_nntp.GetArticleNr (index: integer); // ARTICLE *) procedure t_nntp.GetArticleNr (index: integer); begin if not f_logged_in then login; self.SendCommand ('Article' INTOSTR (INDEX); self.response; f_news.clear; getArticleinternalNally; End; (* @ @ @ /// procedure t_nntp.setcurrentAnticle (index: integer); // Stat *) procedure t_nntp.setcurrentArticle (index: integer); begin if not f_logged_in life; self.sendcommand ('stat' INTTOSTR (INDEX)); self.response; end; (* @ @ @ @ @ @ @ @ @ @ 00 00 00 00 00;; * @ /// procedure t_nntp.GetCurrentArticle; // HEAD and BODY *) procedure t_nntp.GetCurrentArticle; begin if not f_logged_in then login; f_news.clear; self.SendCommand ( 'HEAD'); GetArticleInternally; f_news.add ( '' ); Self.sendcommand ('body'); getArticleinternal, End; (* @ /// 0000000401 *) (* @ /// procedure t_nntp.getnextArticle; // next *) procedure t_nntp.getNextArticle; begin if not f_logged_in then login; self.SendCommand ( 'NEXT'); self.response; GetCurrentArticle; end; (* @ /// 0000000401 *) (* @ /// procedure t_nntp.GetPreviousArticle; // LAST *) procedure T_nntp.getpreviousArticle; begin if not f_logged_in life; self.sendcommand ('last'); self.response; getCurrentArticle; end; (* @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 0000000401 *)
(* @ /// procedure t_nntp.response; *) procedure t_nntp.response; var s: string; begin s: = self.read_line (f_socket); if assigned (f_tracer) then f_tracer (s, tt_proto_get); try f_status_nr: = StrtOINT (COPY (S, 1, 3)); except f_status_nr: = 999; end; f_status_txt: = COPY (S, 5, Length (s)); if f_status_nr> = 400 Then Raise EPROTOCOLERROR.CREATE ('NNTP' , f_status_txt, f_status_nr); end; (* @ /// 0000000D01 *) (* @ /// procedure t_nntp.GetArticle (group: string; index: integer); *) procedure t_nntp.GetArticle (const group: string; index : integer; begin self.sendcommand ('Group' group); self.response; getArticlenr (index); end; (* @ /// 0000000301 *) (* @ /// procedure t_nntp.getArticleinternal "; *) Procedure T_nntp.getArticleinternalLinternal, Var S: String; Begin While True Do Begin S: = Read_Line (f_socket); if S <> '.' Ten f_news.add (s) else break; end; end; (* @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ // 0000000611 *) (* @ @ @ @ @ @ @ @ /// Class T_mailnews (tComponent) *) (* @ /// constructor t_mailnews.create Aowner: TComponent); *) constructor t_mailnews.Create (Aowner: TComponent); begin inherited create (AOwner); f_body: = TStringList.Create; f_add_header: = TStringList.Create; f_message: = TStringList.Create; end; (* @ /// 0000000603 *) (* @ /// destructor t_mailnews.Destroy; *) destructor t_mailnews.Destroy; begin f_body.Free; f_add_header.Free; f_message.Free; inherited destroy; end; (* @ /// 0000000503 * )
(* @ /// procedure t_mailnews.SetBody (Value: TStringList); *) procedure t_mailnews.SetBody (Value: TStringList); begin if value = NIL then f_body.clear else f_body.assign (value); end; (* @ /// 0000000603 *) (* @ /// procedure t_mailnews.SetHeader (value: TStringList); *) procedure t_mailnews.SetHeader (value: TStringList); begin if value = NIL then f_add_header.clear else f_add_header.assign (value) ; End; (* @ @ @ @)
(* @ /// procedure t_mailnews.action; *) procedure t_mailnews.Action; begin f_message.insert (0, 'from:' f_from); (* Normally the first *) if f_sender <> '' Ten f_MESSAGE.ADD ('Sender:' f_sender); f_message.insert (1, 'Message-ID: <' INTTOSTR (Round (NOW-ENCODEDATE (1970, 1, 1)) * 86400)) '@' my_hostname ' > '); F_message.insert (2,' date: ' internet_date (now)); f_message.insert (3,' Subject: ' f_subject); if f_reference <"' 'THEN F_MESSAGE.ADD (' References: ' f_references); if f_replyto <> '' then f_message.add ( 'Reply-to:' f_replyto); f_message.addstrings (f_add_header); f_message.add ( ''); (* An empty line to separate header from body *) F_Message.Addstrings (f_body); end; (* @ @ @ @ @ @ @ @ @ c c ts _ * * (@ @ @ @ @ @ / c tyctor t_mail .Create (Aowner: TComponent); *) constructor t_mail.Create (Aowner: TComponent); begin inherited create (AOwner); f_smtp: = NIL; f_receipts: = TStringList.Create; f_cc: = TStringList.Create; f_bcc: = TStringList .CREATE; END; @ @ @ @// deStructor t_mail.destroy; *) deStructor T_mail.destroy; begin f_receipts.destroy; begin f_receipts.free; f_cc.free; f_bcc.free; inherited destroy; end; *)
(* @ /// procedure t_mail.SetRecipients (Value: TStringList); *) procedure t_mail.SetRecipients (Value: TStringList); begin if value = NIL then f_receipts.clear else f_receipts.assign (value); end; (* @ /// 0000000603 *) (* @ /// procedure t_mail.setcc (value: tstringlist); *) procedure t_mail.setcc (value: tstringlist); begin if value = nil dam.ssign (value) (Value) End; (* @ @ @ @ @ @ @ /// procedure t_mail.setbcc (value: tstringlist); *) Procedure t_mail.setbcc (value: tstringlist); begin if value = nil dam = nil dam = nil dam F_bcc.assign (value); end; (* @ @ @ /// processure t_mail.action; *) procedure t_mail.action; var i: integer; clear_sender: boolean; begin if (f_smtp = NIL) or (f_receipts = nil) or (f_FROM = ') THEN EXIT; CLEAR_SENDER: = (f_smtp.sender ='); if clear_sender the begin if f_sender <> '' Then f_smtp . Site: = f_sender else f_smtp.sender: = f_from;
if f_disclose_receipts then f_message.add ( 'To: disclosed recipients list') else for i: = 0 to f_receipts.count-1 do begin f_message.add ( 'To:' f_receipts.strings [i]); end; f_smtp. Recipients: = f_receipts; for i: = 0 to f_cc.count-1 do begin f_Message.Add ('cc:' f_cc.strings [i]); f_smtp.recipients.add (f_cc.strings [i]); END ; For i: = 0 to f_bcc.count-1 do begin f_smtp.recipients.add (f_bcc.strings [i]);
Inherited action; f_smtp.Message: = f_Message; f_smtp.action; f_message.clear; if clear_sender life f_smtp.sender: = '; END;