diff options
author | Alex Auvolat <alex@adnab.me> | 2020-03-01 13:08:32 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-03-01 13:08:32 +0100 |
commit | 810e75a34dddd88279bea1cd2ea38816fe872d52 (patch) | |
tree | 780a18b5488dcdac708a4428776e588095442d61 /connector | |
parent | 1316a3031b829daa28eda205bd3cdf14b192a0b4 (diff) | |
download | easybridge-810e75a34dddd88279bea1cd2ea38816fe872d52.tar.gz easybridge-810e75a34dddd88279bea1cd2ea38816fe872d52.zip |
Very primitive ability to send fb messages
Diffstat (limited to 'connector')
-rw-r--r-- | connector/connector.go | 2 | ||||
-rw-r--r-- | connector/external/external.go | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/connector/connector.go b/connector/connector.go index 210d4ad..48fc9e7 100644 --- a/connector/connector.go +++ b/connector/connector.go @@ -130,7 +130,7 @@ type Event struct { Room RoomID `json:"room"` // Message text or action text - Text string `json:"text` + Text string `json:"text"` // Attached files such as images Attachments []SMediaObject `json:"attachments"` diff --git a/connector/external/external.go b/connector/external/external.go index 26f3c40..741802c 100644 --- a/connector/external/external.go +++ b/connector/external/external.go @@ -162,7 +162,7 @@ func (ext *External) setupProc() error { } func (ext *External) restartLoop(generation int) { - for { + for i := 0; i < 2; i++ { if ext.proc == nil { break } @@ -178,6 +178,7 @@ func (ext *External) restartLoop(generation int) { break } } + log.Warnf("More than 3 attempts (%s); abandonning.", ext.command) } func (m *extMessageWithData) UnmarshalJSON(jj []byte) error { @@ -294,7 +295,7 @@ func (ext *External) cmd(msg extMessage, data interface{}) (*extMessageWithData, } else { return rep, nil } - case <-time.After(5 * time.Second): + case <-time.After(30 * time.Second): return nil, fmt.Errorf("(%s) timeout", msg.MsgType) } } @@ -379,7 +380,7 @@ func (ext *External) Join(room RoomID) error { func (ext *External) Invite(user UserID, room RoomID) error { _, err := ext.cmd(extMessage{ - MsgType: LEAVE, + MsgType: INVITE, User: user, Room: room, }, nil) |