types

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuddyListEvent

type BuddyListEvent struct {
	Action string      `json:"action"` // "add", "remove", "update"
	Buddy  interface{} `json:"buddy"`
	Group  string      `json:"group,omitempty"`
}

BuddyListEvent represents a buddy list change event.

type Event

type Event struct {
	Type      EventType   `json:"type"`
	SeqNum    uint64      `json:"seqNum"`
	Timestamp int64       `json:"timestamp"`
	Data      interface{} `json:"data"`
}

Event represents an event to be delivered to a web client.

type EventQueue

type EventQueue struct {
	// contains filtered or unexported fields
}

EventQueue manages a queue of events for a WebAPI session.

func NewEventQueue

func NewEventQueue(maxSize int) *EventQueue

NewEventQueue creates a new event queue with the specified maximum size.

func (*EventQueue) Clear

func (q *EventQueue) Clear()

Clear removes all events from the queue.

func (*EventQueue) Close

func (q *EventQueue) Close()

Close closes the event queue, unblocking any waiting fetchers.

func (*EventQueue) Fetch

func (q *EventQueue) Fetch(ctx context.Context, lastSeqNum uint64, timeout time.Duration) ([]Event, error)

Fetch retrieves events from the queue, optionally waiting for new events.

func (*EventQueue) GetAllEvents

func (q *EventQueue) GetAllEvents() []Event

GetAllEvents returns all events in the queue (for debugging).

func (*EventQueue) IsClosed

func (q *EventQueue) IsClosed() bool

IsClosed returns whether the queue is closed.

func (*EventQueue) Push

func (q *EventQueue) Push(eventType EventType, data interface{})

Push adds an event to the queue.

func (*EventQueue) Size

func (q *EventQueue) Size() int

Size returns the current number of events in the queue.

type EventType

type EventType string

EventType defines the type of WebAPI event.

const (
	// Event types that can be subscribed to
	EventTypeBuddyList    EventType = "buddylist"
	EventTypePresence     EventType = "presence"
	EventTypeIM           EventType = "im"
	EventTypeSentIM       EventType = "sentIM"
	EventTypeTyping       EventType = "typing"
	EventTypeStatus       EventType = "status"
	EventTypeOfflineIM    EventType = "offlineIM"
	EventTypeSessionEnded EventType = "sessionEnded"
	EventTypeRateLimit    EventType = "rateLimit"
)

type IMEvent

type IMEvent struct {
	From      string  `json:"from"`
	Message   string  `json:"message"`
	Timestamp float64 `json:"timestamp"` // float64 for AMF3 encoding
	AutoResp  bool    `json:"autoResponse,omitempty"`
}

IMEvent represents an instant message event.

type PresenceEvent

type PresenceEvent struct {
	AimID      string `json:"aimId"`
	State      string `json:"state"` // "online", "offline", "away", "idle"
	StatusMsg  string `json:"statusMsg,omitempty"`
	AwayMsg    string `json:"awayMsg,omitempty"`
	IdleTime   int    `json:"idleTime,omitempty"`   // Minutes idle
	OnlineTime int64  `json:"onlineTime,omitempty"` // Unix timestamp
	UserType   string `json:"userType"`             // "aim", "icq", "admin"
}

PresenceEvent represents a presence change event.

type SentIMEvent

type SentIMEvent struct {
	Sender    UserInfo `json:"sender"` // Sender user info
	Dest      UserInfo `json:"dest"`   // Destination user info
	Message   string   `json:"message"`
	Timestamp float64  `json:"timestamp"` // float64 for AMF3 encoding
	AutoResp  bool     `json:"autoResponse,omitempty"`
}

SentIMEvent represents a sent instant message event.

type TypingEvent

type TypingEvent struct {
	From   string `json:"from"`
	Typing bool   `json:"typing"`
}

TypingEvent represents a typing notification event.

type UserInfo

type UserInfo struct {
	AimID      string  `json:"aimId"`
	DisplayID  string  `json:"displayId,omitempty"`
	UserType   string  `json:"userType,omitempty"`
	State      string  `json:"state,omitempty"`
	OnlineTime float64 `json:"onlineTime,omitempty"` // float64 for AMF3 encoding
}

UserInfo represents basic user information in events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL