/*
   Indicating capability: READER

   Syntax
     LISTGROUP [group [range]]

   Responses
     211 number low high group     Article numbers follow (multi-line)
     411                           No such newsgroup
     412                           No newsgroup selected [1]

   Parameters
     group     Name of newsgroup
     range     Range of articles to report
     number    Estimated number of articles in the group
     low       Reported low water mark
     high      Reported high water mark

   [1] The 412 response can only occur if no group has been specified.
*/
Indicating capability: READER

Syntax
LISTGROUP [group [range]]

Responses
211 number low high group     Article numbers follow (multi-line)
411                           No such newsgroup
412                           No newsgroup selected [1]

Parameters
group     Name of newsgroup
range     Range of articles to report
number    Estimated number of articles in the group
low       Reported low water mark
high      Reported high water mark

[1] The 412 response can only occur if no group has been specified.
/ * Indicating capability : READER Syntax LISTGROUP [ group [ range ]] Responses 211 number low high group Article numbers follow ( multi - line ) 411 No such newsgroup 412 No newsgroup selected [ 1 ] Parameters group Name of newsgroup range Range of articles to report number Estimated number of articles in the group low Reported low water mark high Reported high water mark [ 1 ] The 412 response can only occur if no group has been specified . * /
func handleListgroup(args []string, s *session, c *textproto.Conn) error {
	grp := s.group
	arg0 := ""
	arg1 := ""
	if len(args)>0 {arg0 = args[0]}
	if len(args)>1 {arg1 = args[1]}
	if arg0!="" {
		ok := false
		if grp!=nil { ok = grp.Name==arg0 }
		if grp==nil || !ok {
			var err error
			grp, err = s.backend.GetGroup(args[0])
			if err != nil {
				return err
			}
		}
	}
	if grp==nil { return ErrNoGroupSelected }
	from, to := parseRange(arg1)
	articles, err := s.backend.GetArticles(grp, from, to)
	if err != nil {
		return err
	}
	c.PrintfLine("211 %d %d %d %s",grp.Count,grp.Low,grp.High,grp.Name)
	dw := c.DotWriter()
	defer dw.Close()
	for a := range articles {
		fmt.Fprintf(dw, "%d\n", a.Num)
	}
	return nil
}
func handleListgroup ( args [ ] string , s * session , c * textproto . Conn ) error { grp := s . group arg0 := " " arg1 := " " if len ( args ) > 0 { arg0 = args [ 0 ] } if len ( args ) > 1 { arg1 = args [ 1 ] } if arg0 != " " { ok := false if grp != nil { ok = grp . Name == arg0 } if grp == nil || ! ok { var err error grp , err = s . backend . GetGroup ( args [ 0 ] ) if err != nil { return err } } } if grp == nil { return ErrNoGroupSelected } from , to := parseRange ( arg1 ) articles , err := s . backend . GetArticles ( grp , from , to ) if err != nil { return err } c . PrintfLine ( " " , grp . Count , grp . Low , grp . High , grp . Name ) dw := c . DotWriter ( ) defer dw . Close ( ) for a := range articles { fmt . Fprintf ( dw , " \n " , a . Num ) } return nil }
Indicating capability: READER
Indicating capability : READER