~sircmpwn/aerc

Print success to socket if no error was thrown v1 PROPOSED

Thanks!

To git.sr.ht:~sircmpwn/aerc
   1bedb8f..f15811a  master -> master
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/%3C20190929112236.740875-1-me%40miterion.de%3E/mbox | git am -3
Learn more about email & git

[PATCH] Print success to socket if no error was thrown Export this patch

Heiko Carrasco
When Reto Brunners patch is applied (which works really well for me), the user gets to see the message
returned by AercServer. Since this is nil if no errors were thrown it
prints "result: <nil>" to the cmd. This patch fixes that by just
returning success instead of the error message when err != nil.
---
 lib/socket.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/socket.go b/lib/socket.go
index fe473ba..d5db3dc 100644
--- a/lib/socket.go
+++ b/lib/socket.go
@@ -76,7 +76,11 @@ func (as *AercServer) handleClient(conn net.Conn) {
 			if as.OnMailto != nil {
 				err = as.OnMailto(mailto)
 			}
-			conn.Write([]byte(fmt.Sprintf("result: %v\n", err)))
+			if err != nil {
+				conn.Write([]byte(fmt.Sprintf("result: %v\n", err)))
+			} else {
+				conn.Write([]byte(fmt.Sprint("result: success\n")))
+			}
 		}
 	}
 	as.logger.Printf("Closed Unix connection %d", clientId)
-- 
2.23.0
Thanks!

To git.sr.ht:~sircmpwn/aerc
   1bedb8f..f15811a  master -> master
View this thread in the archives