/*

   Indicating capability: IHAVE

   This command MUST NOT be pipelined.

   Syntax
     IHAVE message-id

   Responses

   Initial responses
     335    Send article to be transferred
     435    Article not wanted
     436    Transfer not possible; try again later

   Subsequent responses
     235    Article transferred OK
     436    Transfer failed; try again later
     437    Transfer rejected; do not retry

   Parameters
     message-id    Article message-id

*/
Indicating capability: IHAVE

This command MUST NOT be pipelined.

Syntax
IHAVE message-id

Responses

Initial responses
335    Send article to be transferred
435    Article not wanted
436    Transfer not possible; try again later

Subsequent responses
235    Article transferred OK
436    Transfer failed; try again later
437    Transfer rejected; do not retry

Parameters
message-id    Article message-id
/ * Indicating capability : IHAVE This command MUST NOT be pipelined . Syntax IHAVE message - id Responses Initial responses 335 Send article to be transferred 435 Article not wanted 436 Transfer not possible ; try again later Subsequent responses 235 Article transferred OK 436 Transfer failed ; try again later 437 Transfer rejected ; do not retry Parameters message - id Article message - id * /
func handleIHave(args []string, s *session, c *textproto.Conn) error {
	if len(args)<1 {
		return ErrSyntax
	}
	if !s.backend.AllowPost() {
		return ErrNotWanted
	}
	var article *nntp.Article
	var err error
	if s.beIhave!=nil { goto way_use_beIhave }
	article, err = s.backend.GetArticleWithNoGroup(args[0])
	if article != nil {
		return ErrNotWanted
	}
	c.PrintfLine("335 send it")
	article = &nntp.Article{}
	article.Header, err = c.ReadMIMEHeader()
	if err != nil {
		return ErrIHaveFailed
	}
	article.Body = c.DotReader()
	err = s.backend.Post(article)
	if err != nil {
		if err==ErrPostingFailed { err = ErrIHaveFailed }
		return err
	}
	return c.PrintfLine("235 article received OK")
	way_use_beIhave:
	err = s.beIhave.IHaveWantArticle(args[0])
	if err != nil {
		return err
	}
	c.PrintfLine("335 send it")
	article = &nntp.Article{}
	article.Header, err = c.ReadMIMEHeader()
	if err != nil {
		return ErrIHaveFailed
	}
	article.Body = c.DotReader()
	err = s.beIhave.IHave(args[0],article)
	if err != nil {
		return err
	}
	return c.PrintfLine("235 article received OK")
}
func handleIHave ( args [ ] string , s * session , c * textproto . Conn ) error { if len ( args ) < 1 { return ErrSyntax } if ! s . backend . AllowPost ( ) { return ErrNotWanted } var article * nntp . Article var err error if s . beIhave != nil { goto way_use_beIhave } article , err = s . backend . GetArticleWithNoGroup ( args [ 0 ] ) if article != nil { return ErrNotWanted } c . PrintfLine ( " " ) article = & nntp . Article { } article . Header , err = c . ReadMIMEHeader ( ) if err != nil { return ErrIHaveFailed } article . Body = c . DotReader ( ) err = s . backend . Post ( article ) if err != nil { if err == ErrPostingFailed { err = ErrIHaveFailed } return err } return c . PrintfLine ( " " ) way_use_beIhave : err = s . beIhave . IHaveWantArticle ( args [ 0 ] ) if err != nil { return err } c . PrintfLine ( " " ) article = & nntp . Article { } article . Header , err = c . ReadMIMEHeader ( ) if err != nil { return ErrIHaveFailed } article . Body = c . DotReader ( ) err = s . beIhave . IHave ( args [ 0 ] , article ) if err != nil { return err } return c . PrintfLine ( " " ) }
Indicating capability: IHAVE
Indicating capability : IHAVE
// See if we have it. // See if we have it.