MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / GetInboundMessage

Method GetInboundMessage

internal/identity/store.go:1277–1292  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

1275}
1276
1277func (s *Store) GetInboundMessage(ctx context.Context, id string) (*Message, error) {
1278 m := &Message{}
1279 var authVerdict []byte
1280 err := s.pool.QueryRow(ctx,
1281 `SELECT id, agent_id, direction, sender, recipient, to_recipients, cc, reply_to, subject, email_message_id, raw_message, auth_verdict, COALESCE(flagged, false), COALESCE(flag_reason, ''), created_at, expires_at
1282 FROM messages WHERE id = $1 AND direction = 'inbound' AND expires_at > now()
1283 AND status NOT IN (`+heldInboundStatuses+`)`, id,
1284 ).Scan(&m.ID, &m.AgentID, &m.Direction, &m.Sender, &m.Recipient, &m.ToRecipients, &m.CC, &m.ReplyTo, &m.Subject, &m.EmailMessageID, &m.RawMessage, &authVerdict, &m.Flagged, &m.FlagReason, &m.CreatedAt, &m.ExpiresAt)
1285 if err != nil {
1286 return nil, err
1287 }
1288 if err := unmarshalAuthVerdict(authVerdict, m); err != nil {
1289 return nil, err
1290 }
1291 return m, nil
1292}
1293
1294// unmarshalAuthVerdict parses the messages.auth_verdict JSONB column into
1295// m.Auth. A NULL/empty column (every outbound row, and inbound rows written

Implementers 1

Storeinternal/identity/store.go

Calls 3

unmarshalAuthVerdictFunction · 0.85
ScanMethod · 0.80
QueryRowMethod · 0.80