Rename Entry to QEntry in parser.go
This commit is contained in:
parent
40c3044c84
commit
063fb5756d
@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Entry struct {
|
||||
type QEntry struct {
|
||||
id string
|
||||
status string
|
||||
date time.Time
|
||||
@ -20,11 +20,11 @@ type Entry struct {
|
||||
reason string
|
||||
}
|
||||
|
||||
func (m Entry) String() string {
|
||||
func (m QEntry) String() string {
|
||||
return fmt.Sprintf("ID: %s, Status: %s, Size: %d bytes, Sender: %s, Recipients: %d", m.id, m.status, m.size, m.sender, len(m.recipients))
|
||||
}
|
||||
|
||||
func ParseMailQ(scanner *bufio.Scanner) ([]Entry, error) {
|
||||
func ParseMailQ(scanner *bufio.Scanner) ([]QEntry, error) {
|
||||
const dateFormat = "2006 Mon Jan _2 15:04:05"
|
||||
var messageIdStart = regexp.MustCompile("^[0-9A-Za-z]+[*!]? ")
|
||||
scanner.Scan()
|
||||
@ -36,8 +36,8 @@ func ParseMailQ(scanner *bufio.Scanner) ([]Entry, error) {
|
||||
// Abort if input does not look like output from mailq(1)
|
||||
return nil, errors.New("Sorry, this does not look like output from mailq(1).")
|
||||
}
|
||||
var currentMail Entry
|
||||
var queueEntries []Entry
|
||||
var currentMail QEntry
|
||||
var queueEntries []QEntry
|
||||
|
||||
for scanner.Scan() {
|
||||
// Read input line by line
|
||||
@ -75,7 +75,7 @@ func ParseMailQ(scanner *bufio.Scanner) ([]Entry, error) {
|
||||
// If the next line is empty, make sure to push current mail to list
|
||||
// and create a new struct for the next mail to process
|
||||
queueEntries = append(queueEntries, currentMail)
|
||||
currentMail = Entry{}
|
||||
currentMail = QEntry{}
|
||||
}
|
||||
}
|
||||
if scanner.Err() != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user