Change how mail queue entries can be displayed
This commit is contained in:
parent
1e33d3669c
commit
24afa08970
6
main.go
6
main.go
@ -36,14 +36,12 @@ func main() {
|
||||
flag.PrintDefaults()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Error reading: %s\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
for _, line := range entries {
|
||||
fmt.Printf("Read: %s", line)
|
||||
for _, entry := range entries {
|
||||
fmt.Printf("%s\n", entry.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,18 @@ type QEntry struct {
|
||||
reason string
|
||||
}
|
||||
|
||||
const sortableDateFormat = "2006-01-02 15:04:05"
|
||||
|
||||
func (m QEntry) ShortString() string {
|
||||
return fmt.Sprintf("[%s] %s <%s> -> %d recipients (%d bytes)", m.date.Format(sortableDateFormat), m.id, m.sender, len(m.recipients), m.size)
|
||||
}
|
||||
|
||||
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))
|
||||
return fmt.Sprintf("[%s] %s <%s> -> %d recipients (%s, %d bytes)", m.date.Format(sortableDateFormat), m.id, m.sender, len(m.recipients), m.status, m.size)
|
||||
}
|
||||
|
||||
func (m QEntry) DetailedString() string {
|
||||
return fmt.Sprintf("Id: %s\nDate: %s\nStatus: %s\nReason: %s\nSize: %d\nSender: %s\nRecipients: %s", m.id, m.date.Format(sortableDateFormat), m.status, m.reason, m.size, m.sender, strings.Join(m.recipients, ", "))
|
||||
}
|
||||
|
||||
func ParseMailQ(dataSource io.Reader) ([]QEntry, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user