func (s State) GetItem(msgID gregor.MsgID) (gregor.Item, bool) { for _, i := range s.Items_ { if i.Metadata().MsgID().String() == msgID.String() { return i, true } } return nil, false }
func (o ObjFactory) makeMetadata(uid gregor.UID, msgid gregor.MsgID, devid gregor.DeviceID, ctime time.Time, i gregor.InBandMsgType) (Metadata, error) { uid2, e := castUID(uid) if e != nil { return Metadata{}, e } devid2, e := castDeviceID(devid) if e != nil { return Metadata{}, e } return Metadata{ Uid_: uid2, MsgID_: MsgID(msgid.Bytes()), Ctime_: ToTime(ctime), DeviceID_: devid2, InBandMsgType_: int(i), }, nil }
func (g *gregorHandler) DismissItem(id gregor.MsgID) error { if id == nil { return nil } var err error defer g.G().Trace(fmt.Sprintf("gregorHandler.DismissItem(%s)", id.String()), func() error { return err }, )() dismissal, err := g.templateMessage() if err != nil { return err } dismissal.Ibm_.StateUpdate_.Dismissal_ = &gregor1.Dismissal{ MsgIDs_: []gregor1.MsgID{gregor1.MsgID(id.Bytes())}, } incomingClient := gregor1.IncomingClient{Cli: g.cli} // TODO: Should the interface take a context from the caller? err = incomingClient.ConsumeMessage(context.TODO(), *dismissal) return err }
func (o ObjFactory) MakeReminderID(u gregor.UID, msgid gregor.MsgID, seqno int) (gregor.ReminderID, error) { return ReminderID{Uid_: u.Bytes(), MsgID_: msgid.Bytes(), Seqno_: seqno}, nil }
func msgIDtoString(m gregor.MsgID) string { return hex.EncodeToString(m.Bytes()) }