42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package presence
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.asio.asia/nixevol/NixMsg/internal/app/port"
|
|
"git.asio.asia/nixevol/NixMsg/internal/protocol"
|
|
)
|
|
|
|
// Stub 是测试用假实现:全部视为离线。
|
|
type Stub struct{}
|
|
|
|
func NewStub() *Stub { return &Stub{} }
|
|
|
|
func (s *Stub) Get(_ context.Context, ids []string) ([]StatusItem, error) {
|
|
out := make([]StatusItem, 0, len(ids))
|
|
for _, id := range ids {
|
|
out = append(out, StatusItem{ID: id, Online: false, SinceMs: 0})
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (s *Stub) Directory(context.Context, *protocol.DirectoryList) ([]DirectoryItem, string, error) {
|
|
return nil, "", nil
|
|
}
|
|
|
|
func (s *Stub) Watch(context.Context, port.ConnID, string, *protocol.PresenceWatch) error {
|
|
return nil
|
|
}
|
|
|
|
func (s *Stub) ClearWatch(port.ConnID) {}
|
|
|
|
func (s *Stub) SetOnline(context.Context, string, port.ConnID, int64) error { return nil }
|
|
|
|
func (s *Stub) SetOffline(context.Context, string, port.ConnID, int64) error { return nil }
|
|
|
|
func (s *Stub) IsOnline(string) bool { return false }
|
|
|
|
func (s *Stub) CurrentConn(string) (port.ConnID, bool) { return "", false }
|
|
|
|
var _ Service = (*Stub)(nil)
|