diff options
author | Runxi Yu <me@runxiyu.org> | 2024-12-31 16:40:54 +0000 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-12-31 16:40:54 +0000 |
commit | 20e67f650b1e3a5dca584f5a468ce0e558075f49 (patch) | |
tree | 491dca41175293da881b8e7e8cabe6608af4f993 /main.go | |
parent | Delete weird debug prints (diff) | |
download | maild-20e67f650b1e3a5dca584f5a468ce0e558075f49.tar.gz maild-20e67f650b1e3a5dca584f5a468ce0e558075f49.tar.zst maild-20e67f650b1e3a5dca584f5a468ce0e558075f49.zip |
Implement QUIT and RSET
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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() |