]> git.giacomolli.uk - onechat/blobdiff - socket.go
Order daemon and storage declarations
[onechat] / socket.go
index 7b2da2b7a2077e11529c051efe4816de80827bf9..f87bec70ad5fca67fe1bce47e21cfc9d5bcb7c6f 100644 (file)
--- a/socket.go
+++ b/socket.go
@@ -20,21 +20,23 @@ const (
        terminalSource = "terminal"
 )
 
        terminalSource = "terminal"
 )
 
-// checkSocketPath makes sure that path fits in the address of a Unix socket.
-func checkSocketPath(path string) error {
-       if len(path) > socketPathBytes {
-               return fmt.Errorf("socket path %s is longer than %d bytes: set ONECHAT_DIR to a shorter path", path, socketPathBytes)
-       }
-
-       return nil
-}
-
 // SocketRequest is one line from a client: "send" with the text of a user
 // message, "interrupt", "stop" with the name of a subagent in Text, or
 // "whatsapp" with the text after /whatsapp of a WhatsApp command, or "backup"
 // with the absolute output path in Text. The backup answer is a "backup" event
 // SocketRequest is one line from a client: "send" with the text of a user
 // message, "interrupt", "stop" with the name of a subagent in Text, or
 // "whatsapp" with the text after /whatsapp of a WhatsApp command, or "backup"
 // with the absolute output path in Text. The backup answer is a "backup" event
-// with the path and size, or an "error" event.
+// with the path and size, or an "error" event. An "image" request has an
+// absolute Path and the caption in Text.
 type SocketRequest struct {
        Type string `json:"type"`
        Text string `json:"text,omitempty"`
 type SocketRequest struct {
        Type string `json:"type"`
        Text string `json:"text,omitempty"`
+       Path string `json:"path,omitempty"`
+}
+
+// checkSocketPath makes sure that path fits in the address of a Unix socket.
+func checkSocketPath(path string) error {
+       if len(path) > socketPathBytes {
+               return fmt.Errorf("socket path %s is longer than %d bytes: set ONECHAT_DIR to a shorter path", path, socketPathBytes)
+       }
+
+       return nil
 }
 }