github.com/tada-team/tdproto@v1.51.57/server_online.go (about)

     1  package tdproto
     2  
     3  func NewServerOnline(contacts []OnlineContact, calls []OnlineCall) (r ServerOnline) {
     4  	r.Name = r.GetName()
     5  	r.Params.Contacts = contacts
     6  	r.Params.Calls = calls
     7  	return r
     8  }
     9  
    10  // Online team members and current active calls
    11  type ServerOnline struct {
    12  	BaseEvent
    13  	Params serverOnlineParams `json:"params"`
    14  }
    15  
    16  func (p ServerOnline) GetName() string { return "server.online" }
    17  
    18  // Params of the server.online event
    19  type serverOnlineParams struct {
    20  	// Online team members
    21  	Contacts []OnlineContact `json:"contacts"`
    22  
    23  	// Active calls
    24  	Calls []OnlineCall `json:"calls,omitempty"`
    25  }
    26  
    27  // Contact online status
    28  type OnlineContact struct {
    29  	// Contact id
    30  	Jid JID `json:"jid"`
    31  
    32  	// Is away from keyboard
    33  	Afk bool `json:"afk,omitempty"`
    34  
    35  	// Focus mode enabled
    36  	Focused bool `json:"focused,omitempty"`
    37  
    38  	// Is mobile client
    39  	Mobile bool `json:"mobile"` // TODO: omitempty. 17feb2020
    40  }
    41  
    42  // Active call status
    43  type OnlineCall struct {
    44  	// Chat or contact id
    45  	Jid JID `json:"jid"`
    46  
    47  	// Call id
    48  	Uid string `json:"uid"`
    49  
    50  	// Call start
    51  	Start ISODateTimeString `json:"start,omitempty"`
    52  
    53  	// Number participants in call
    54  	OnlineCount int `json:"online_count,omitempty"`
    55  
    56  	// CallType is a type of call("audio" - audio room, "video" - video room)
    57  	CallType CallType `json:"call_type"`
    58  }