mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 18:17:03 +00:00
Most of RFC1939 implmented
Most of the stuff in RFC1939 is implemented, and I was able to download messages with Thunderbird. We do not yet purge deleted messages, and probably need to implement some more auth modes.
This commit is contained in:
@@ -199,6 +199,21 @@ func (ses *Session) authorizationHandler(cmd string, args []string) {
|
|||||||
// TRANSACTION state
|
// TRANSACTION state
|
||||||
func (ses *Session) transactionHandler(cmd string, args []string) {
|
func (ses *Session) transactionHandler(cmd string, args []string) {
|
||||||
switch cmd {
|
switch cmd {
|
||||||
|
case "STAT":
|
||||||
|
if len(args) != 0 {
|
||||||
|
ses.warn("STAT got an unexpected argument")
|
||||||
|
ses.send("-ERR STAT command must have no arguments")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var count int
|
||||||
|
var size int64
|
||||||
|
for i, msg := range ses.messages {
|
||||||
|
if ses.retain[i] {
|
||||||
|
count += 1
|
||||||
|
size += msg.Size()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ses.send(fmt.Sprintf("+OK %v %v", count, size))
|
||||||
case "LIST":
|
case "LIST":
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
ses.warn("LIST command had more than 1 argument")
|
ses.warn("LIST command had more than 1 argument")
|
||||||
@@ -327,6 +342,7 @@ func (ses *Session) transactionHandler(cmd string, args []string) {
|
|||||||
ses.send("-ERR RETR argument must not exceed the number of messages")
|
ses.send("-ERR RETR argument must not exceed the number of messages")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ses.send(fmt.Sprintf("+OK %v bytes follows", ses.messages[msgNum-1].Size()))
|
||||||
ses.sendMessage(ses.messages[msgNum-1])
|
ses.sendMessage(ses.messages[msgNum-1])
|
||||||
case "TOP":
|
case "TOP":
|
||||||
if len(args) != 2 {
|
if len(args) != 2 {
|
||||||
@@ -363,6 +379,7 @@ func (ses *Session) transactionHandler(cmd string, args []string) {
|
|||||||
ses.send("-ERR TOP second argument must be non-negative")
|
ses.send("-ERR TOP second argument must be non-negative")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ses.send("+OK Top of message follows")
|
||||||
ses.sendMessageTop(ses.messages[msgNum-1], int(lines))
|
ses.sendMessageTop(ses.messages[msgNum-1], int(lines))
|
||||||
case "QUIT":
|
case "QUIT":
|
||||||
ses.send("+OK We will process your deletes")
|
ses.send("+OK We will process your deletes")
|
||||||
|
|||||||
Reference in New Issue
Block a user