4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-08-10 18:48:10 +00:00

Update nc-talk to version 0.1.2 (#1220)

Signed-off-by: Tilo Spannagel <development@tilosp.de>
This commit is contained in:
Tilo Spannagel
2020-08-30 15:19:51 +02:00
committed by GitHub
parent f9928c9e25
commit ad90cf09fe
6 changed files with 74 additions and 17 deletions

View File

@@ -18,6 +18,7 @@ import (
"context"
"errors"
"io/ioutil"
"strconv"
"time"
"github.com/monaco-io/request"
@@ -98,16 +99,16 @@ func (t *TalkRoom) ReceiveMessages(ctx context.Context) (chan ocs.TalkRoomMessag
"includeLastKnown": "0",
}
lastKnown := ""
client := t.User.RequestClient(request.Client{
URL: url,
Params: requestParam,
Timeout: time.Second * 60,
})
res, err := client.Resp()
res, err := t.User.GetRooms()
if err != nil {
return nil, err
}
lastKnown = res.Header.Get("X-Chat-Last-Given")
for _, r := range *res {
if r.Token == t.Token {
lastKnown = strconv.Itoa(r.LastReadMessage)
break
}
}
go func() {
for {
if ctx.Err() != nil {