aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-31 16:40:54 +0000
committerRunxi Yu <me@runxiyu.org>2024-12-31 16:40:54 +0000
commit20e67f650b1e3a5dca584f5a468ce0e558075f49 (patch)
tree491dca41175293da881b8e7e8cabe6608af4f993 /main.go
parentDelete weird debug prints (diff)
downloadmaild-20e67f650b1e3a5dca584f5a468ce0e558075f49.tar.gz
maild-20e67f650b1e3a5dca584f5a468ce0e558075f49.tar.zst
maild-20e67f650b1e3a5dca584f5a468ce0e558075f49.zip
Implement QUIT and RSET
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.go b/main.go
index cdd6b11..d894d8c 100644
--- a/main.go
+++ b/main.go
@@ -173,6 +173,16 @@ func handle_connection(reader *bufio.Reader, writer *bufio.Writer) error {
server_state = server_state_helo
_, _ = writer.WriteString("250 2.0.0 Ok: Accepted\r\n")
_ = writer.Flush()
+ case "QUIT":
+ _, _ = writer.WriteString("221 2.0.0 Bye\r\n")
+ _ = writer.Flush()
+ return nil
+ case "RSET":
+ if server_state != server_state_begin {
+ server_state = server_state_helo
+ }
+ _, _ = writer.WriteString("250 2.0.0 Ok\r\n")
+ _ = writer.Flush()
default:
_, _ = writer.WriteString("500 5.5.2 Error: command not recognized\r\n")
_ = writer.Flush()