/* * Copyright (c) 2026 Kaiy Ragur * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package remote import ( "fmt" pb "github.com/neilalexander/yggmail/internal/remote/types" ) func (s *RemoteStorage) Watch(pk, mailbox string) (uint32, uint32, error) { resp, _, err := s.Call(&pb.Request{ Call: &pb.Request_MailWatch{ MailWatch: &pb.WatchRequest{Mailbox: mailbox}, }, }, nil, 0) if err != nil { return 0, 0, err } if !resp.Success { return 0, 0, fmt.Errorf("remote error: %s", resp.Error) } status := resp.GetMboxStatus() if status != nil { return status.UidNext, status.MessagesCount, nil } return 0, 0, nil }