Rename long poll file and functions to be more accurate
This commit is contained in:
parent
01464c5cc2
commit
a4639eb668
3 changed files with 5 additions and 5 deletions
|
@ -120,7 +120,7 @@ func (c *Client) Connect() error {
|
||||||
return fmt.Errorf("failed to get web encryption key: %w", err)
|
return fmt.Errorf("failed to get web encryption key: %w", err)
|
||||||
}
|
}
|
||||||
c.updateWebEncryptionKey(webEncryptionKeyResponse.GetKey())
|
c.updateWebEncryptionKey(webEncryptionKeyResponse.GetKey())
|
||||||
go c.ListenReceiveMessages(true)
|
go c.doLongPoll(true)
|
||||||
c.sessionHandler.startAckInterval()
|
c.sessionHandler.startAckInterval()
|
||||||
|
|
||||||
bugleRes, bugleErr := c.IsBugleDefault()
|
bugleRes, bugleErr := c.IsBugleDefault()
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"go.mau.fi/mautrix-gmessages/libgm/util"
|
"go.mau.fi/mautrix-gmessages/libgm/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) ListenReceiveMessages(loggedIn bool) {
|
func (c *Client) doLongPoll(loggedIn bool) {
|
||||||
c.listenID++
|
c.listenID++
|
||||||
listenID := c.listenID
|
listenID := c.listenID
|
||||||
errored := true
|
errored := true
|
||||||
|
@ -86,12 +86,12 @@ func (c *Client) ListenReceiveMessages(loggedIn bool) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
c.startReadingData(resp.Body)
|
c.readLongPoll(resp.Body)
|
||||||
c.longPollingConn = nil
|
c.longPollingConn = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) startReadingData(rc io.ReadCloser) {
|
func (c *Client) readLongPoll(rc io.ReadCloser) {
|
||||||
defer rc.Close()
|
defer rc.Close()
|
||||||
c.disconnecting = false
|
c.disconnecting = false
|
||||||
reader := bufio.NewReader(rc)
|
reader := bufio.NewReader(rc)
|
|
@ -19,7 +19,7 @@ func (c *Client) StartLogin() (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
c.AuthData.TachyonAuthToken = registered.AuthKeyData.TachyonAuthToken
|
c.AuthData.TachyonAuthToken = registered.AuthKeyData.TachyonAuthToken
|
||||||
go c.ListenReceiveMessages(false)
|
go c.doLongPoll(false)
|
||||||
qr, err := c.GenerateQRCodeData(registered.GetPairingKey())
|
qr, err := c.GenerateQRCodeData(registered.GetPairingKey())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to generate QR code: %w", err)
|
return "", fmt.Errorf("failed to generate QR code: %w", err)
|
||||||
|
|
Loading…
Reference in a new issue