/*
   Indicating capability: POST

   This command MUST NOT be pipelined.

   Syntax
     POST

   Responses

   Initial responses
     340    Send article to be posted
     440    Posting not permitted

   Subsequent responses
     240    Article received OK
     441    Posting failed
*/
Indicating capability: POST

This command MUST NOT be pipelined.

Syntax
POST

Responses

Initial responses
340    Send article to be posted
440    Posting not permitted

Subsequent responses
240    Article received OK
441    Posting failed
/ * Indicating capability : POST This command MUST NOT be pipelined . Syntax POST Responses Initial responses 340 Send article to be posted 440 Posting not permitted Subsequent responses 240 Article received OK 441 Posting failed * /
func handlePost(args []string, s *session, c *textproto.Conn) error {
	if !s.backend.AllowPost() {
		return ErrPostingNotPermitted
	}
	c.PrintfLine("340 Go ahead")
	var err error
	var article nntp.Article
	article.Header, err = c.ReadMIMEHeader()
	if err != nil {
		return ErrPostingFailed
	}
	{
		msgID := article.Header.Get("Message-Id")
		if msgID=="" {
			article.Header.Set("Message-Id",s.idGenerator.GenID())
		}
	}
	article.Body = c.DotReader()
	err = s.backend.Post(&article)
	if err != nil {
		return err
	}
	c.PrintfLine("240 article received OK")
	return nil
}
func handlePost ( args [ ] string , s * session , c * textproto . Conn ) error { if ! s . backend . AllowPost ( ) { return ErrPostingNotPermitted } c . PrintfLine ( " " ) var err error var article nntp . Article article . Header , err = c . ReadMIMEHeader ( ) if err != nil { return ErrPostingFailed } { msgID := article . Header . Get ( " " ) if msgID == " " { article . Header . Set ( " " , s . idGenerator . GenID ( ) ) } } article . Body = c . DotReader ( ) err = s . backend . Post ( & article ) if err != nil { return err } c . PrintfLine ( " " ) return nil }
Indicating capability: POST
Indicating capability : POST