mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-11-24 19:42:00 -08:00
Make channel type more specific (Packet instead of interface{})
Thanks to Genofire for spotting this
This commit is contained in:
parent
36e3379f5a
commit
411619c2ef
@ -72,7 +72,7 @@ type Client struct {
|
|||||||
// TCP level connection / can be replaced by a TLS session after starttls
|
// TCP level connection / can be replaced by a TLS session after starttls
|
||||||
conn net.Conn
|
conn net.Conn
|
||||||
// Packet channel
|
// Packet channel
|
||||||
RecvChannel chan interface{}
|
RecvChannel chan Packet
|
||||||
// Track and broadcast connection state
|
// Track and broadcast connection state
|
||||||
EventManager
|
EventManager
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ func NewClient(config Config) (c *Client, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a default channel that developers can override
|
// Create a default channel that developers can override
|
||||||
c.RecvChannel = make(chan interface{})
|
c.RecvChannel = make(chan Packet)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ func (c *Client) SetHandler(handler EventHandler) {
|
|||||||
// Recv abstracts receiving preparsed XMPP packets from a channel.
|
// Recv abstracts receiving preparsed XMPP packets from a channel.
|
||||||
// Channel allow client to receive / dispatch packets in for range loop.
|
// Channel allow client to receive / dispatch packets in for range loop.
|
||||||
// TODO: Deprecate this function in favor of reading directly from the RecvChannel ?
|
// TODO: Deprecate this function in favor of reading directly from the RecvChannel ?
|
||||||
func (c *Client) Recv() <-chan interface{} {
|
func (c *Client) Recv() <-chan Packet {
|
||||||
return c.RecvChannel
|
return c.RecvChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ type ComponentOptions struct {
|
|||||||
// Communication with developer client / StreamManager
|
// Communication with developer client / StreamManager
|
||||||
|
|
||||||
// Packet channel
|
// Packet channel
|
||||||
RecvChannel chan interface{}
|
RecvChannel chan Packet
|
||||||
// Track and broadcast connection state
|
// Track and broadcast connection state
|
||||||
EventManager
|
EventManager
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ type Component struct {
|
|||||||
func NewComponent(opts ComponentOptions) (*Component, error) {
|
func NewComponent(opts ComponentOptions) (*Component, error) {
|
||||||
c := Component{ComponentOptions: opts}
|
c := Component{ComponentOptions: opts}
|
||||||
// Create a default channel that developers can override
|
// Create a default channel that developers can override
|
||||||
c.RecvChannel = make(chan interface{})
|
c.RecvChannel = make(chan Packet)
|
||||||
return &c, nil
|
return &c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ func (c *Component) SetHandler(handler EventHandler) {
|
|||||||
// Recv abstracts receiving preparsed XMPP packets from a channel.
|
// Recv abstracts receiving preparsed XMPP packets from a channel.
|
||||||
// Channel allow client to receive / dispatch packets in for range loop.
|
// Channel allow client to receive / dispatch packets in for range loop.
|
||||||
// TODO: Deprecate this function in favor of reading directly from the RecvChannel ?
|
// TODO: Deprecate this function in favor of reading directly from the RecvChannel ?
|
||||||
func (c *Component) Recv() <-chan interface{} {
|
func (c *Component) Recv() <-chan Packet {
|
||||||
return c.RecvChannel
|
return c.RecvChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user