]> git.giacomolli.uk - onechat/blobdiff - daemon.go
Link WhatsApp with a pairing code
[onechat] / daemon.go
index d67c5be60c663aa9f712de3ac5819776a2ff3785..41b3ab66a419000e2f4247cd39a9dcfc4999855f 100644 (file)
--- a/daemon.go
+++ b/daemon.go
@@ -305,8 +305,8 @@ func daemonListenSocket(path string) (net.Listener, error) {
 }
 
 // daemonServe runs the loop that start makes and serves the clients of listener
-// until ctx ends or the loop fails. It closes listener. It keeps whatsapp
-// connected. When bot is not nil, it runs the bot too, and a failure of the bot
+// until ctx ends or the loop fails. It closes listener. It runs whatsapp, which
+// logs its notes in the loop and tells all clients its notices. When bot is not nil, it runs the bot too, and a failure of the bot
 // stops the agent.
 func daemonServe(ctx context.Context, listener net.Listener, bot *TelegramBot, whatsapp *WhatsApp, start func(notify func(Event)) (*TurnLoop, error)) error {
        ctx, cancel := context.WithCancel(ctx)
@@ -341,7 +341,7 @@ func daemonServe(ctx context.Context, listener net.Listener, bot *TelegramBot, w
        go func() {
                defer workers.Done()
 
-               whatsapp.Run(ctx)
+               whatsapp.Run(ctx, l, notify)
        }()
 
        var botErr error