X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/8d9547f6e7ffa1e95ad25d9f8f2e7cfd23d992d0..7088b82414bdf947a6f88918c0a7b2c7fb0c53ef:/whatsapp.go?ds=sidebyside diff --git a/whatsapp.go b/whatsapp.go index 2c1b6cb..40729d8 100644 --- a/whatsapp.go +++ b/whatsapp.go @@ -405,7 +405,7 @@ func (w *WhatsApp) connect(ctx context.Context) { err := client.ConnectContext(ctx) if err != nil { - w.logger.Printf("WhatsApp messages do not come, because the connection failed, and it is tried again only at a restart of the daemon: %s", w.redact(err.Error())) + w.logger.Printf("connect failed, restart to retry: %s", w.redact(err.Error())) } } @@ -435,7 +435,7 @@ func (w *WhatsApp) loggedOut(ctx context.Context, l *TurnLoop) error { return nil } - w.logger.Print("WhatsApp messages stop, because the phone logged out this device (run /whatsapp pair PHONE to link it again)") + w.logger.Print("logged out by the phone, run /whatsapp pair PHONE") err := w.inbox.deliver(ctx, l, w.link(), true) if err != nil { return err @@ -443,12 +443,12 @@ func (w *WhatsApp) loggedOut(ctx context.Context, l *TurnLoop) error { err = w.removeSession() if err != nil { - w.logger.Printf("the session of the logged out device stays on the disk, because its delete failed: %v", err) + w.logger.Printf("session delete failed: %v", err) } err = l.note("WhatsApp was unlinked from the phone.") if err != nil { - w.logger.Printf("the chat has no note of the logout, because its write failed: %v", err) + w.logger.Printf("chat note failed: %v", err) } w.broadcast("WhatsApp was unlinked from the phone. Run /whatsapp pair PHONE to link it again.") @@ -491,10 +491,10 @@ func (w *WhatsApp) unlink(ctx context.Context, l *TurnLoop, answer func(text str return nil } - w.logger.Print("WhatsApp messages stop, because the user unlinked WhatsApp") + w.logger.Print("unlinked") err = l.note("WhatsApp is unlinked.") if err != nil { - w.logger.Printf("the chat has no note of the unlink, because its write failed: %v", err) + w.logger.Printf("chat note failed: %v", err) } if client == nil || logoutErr != nil { @@ -631,11 +631,11 @@ func (w *WhatsApp) pair(ctx, runCtx context.Context, l *TurnLoop, phone string, case item.Event == whatsmeow.QRChannelSuccess.Event: linked = true w.linkedBy(client) - w.logger.Print("WhatsApp is linked") + w.logger.Print("linked") err = l.note("WhatsApp is linked.") if err != nil { - w.logger.Printf("the chat has no note of the link, because its write failed: %v", err) + w.logger.Printf("chat note failed: %v", err) } answer("WhatsApp is linked to +" + phone + ".") @@ -732,9 +732,9 @@ func (w *WhatsApp) handle(event any) bool { switch { case !w.linked || w.connected: case w.disconnectedAt.IsZero(): - line = "WhatsApp is connected, and new messages come in" + line = "connected" default: - line = "WhatsApp is connected again, after " + durationText(w.clock().Sub(w.disconnectedAt)) + line = "connected again after " + durationText(w.clock().Sub(w.disconnectedAt)) } w.connected = true @@ -749,9 +749,9 @@ func (w *WhatsApp) handle(event any) bool { } case *events.Disconnected: if w.linked && (w.connected || w.disconnectedAt.IsZero()) { - line = "new WhatsApp messages wait, because the connection is lost (the next try is automatic)" + line = "disconnected, retrying" if !w.connected { - line = "new WhatsApp messages wait, because the first connection failed (the next try is automatic)" + line = "first connect failed, retrying" } w.disconnectedAt = w.clock() @@ -773,7 +773,7 @@ func (w *WhatsApp) handle(event any) bool { w.connected = false w.noticed = true notice = "WhatsApp is disconnected and does not connect again by itself: " + event.PermanentDisconnectDescription() + ". Restart the daemon to try again." - line = "WhatsApp messages do not come, because the connection is lost and it is tried again only at a restart of the daemon: " + whatsappRedact(w.own, event.PermanentDisconnectDescription()) + line = "disconnected for good, restart to retry: " + whatsappRedact(w.own, event.PermanentDisconnectDescription()) } }