aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--account.go1
-rw-r--r--connector/external/config.go4
-rw-r--r--connector/external/external.go5
-rwxr-xr-xexternal/messenger.py5
4 files changed, 9 insertions, 6 deletions
diff --git a/account.go b/account.go
index e6a2e3d..da6e854 100644
--- a/account.go
+++ b/account.go
@@ -188,6 +188,7 @@ func (a *Account) ezbrMessagef(format string, args ...interface{}) {
}
func (a *Account) connect() {
+ log.Printf("Connecting %s %s (%s)", a.MatrixUser, a.AccountName, a.Protocol)
ezbrSystemSendf(a.MatrixUser, "Connecting to account %s (%s)", a.AccountName, a.Protocol)
err := a.Conn.Configure(a.Config)
diff --git a/connector/external/config.go b/connector/external/config.go
index bf2a5f8..03e1feb 100644
--- a/connector/external/config.go
+++ b/connector/external/config.go
@@ -1,6 +1,8 @@
package external
import (
+ "os"
+
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
)
@@ -30,7 +32,7 @@ func init() {
return &External{
protocol: MESSENGER_PROTOCOL,
command: "./external/messenger.py",
- debug: true,
+ debug: (os.Getenv("EASYBRIDGE_MESSENGER_DEBUG") == "true"),
}
},
Schema: ConfigSchema{
diff --git a/connector/external/external.go b/connector/external/external.go
index 553c657..d4a6caf 100644
--- a/connector/external/external.go
+++ b/connector/external/external.go
@@ -152,12 +152,11 @@ func (ext *External) setupProc(generation int) error {
if ext.debug {
recv = io.TeeReader(recv, os.Stderr)
send = io.MultiWriter(send, os.Stderr)
+ ext.proc.Stderr = os.Stderr
}
ext.sendJson = json.NewEncoder(send)
- ext.proc.Stderr = os.Stderr
-
err = ext.proc.Start()
if err != nil {
return err
@@ -250,7 +249,7 @@ func (ext *External) recvLoop(from io.Reader, generation int) {
break
}
- log.Debugf("GOT MESSAGE: %#v %#v", msg, msg.Data)
+ log.Tracef("GOT MESSAGE: %#v %#v", msg, msg.Data)
if strings.HasPrefix(msg.MsgType, "rep_") {
func() {
ext.lock.Lock()
diff --git a/external/messenger.py b/external/messenger.py
index 684f7a0..b5dd2d3 100755
--- a/external/messenger.py
+++ b/external/messenger.py
@@ -234,6 +234,8 @@ class MessengerBridge:
self.client.setBridge(self)
+ self.my_user_id = self.getUserIdFromUid(self.client.uid)
+
threads = self.client.fetchThreadList()
# ensure we have a correct mapping for bridged user IDs to fb uids
# (this should be fast)
@@ -252,8 +254,7 @@ class MessengerBridge:
self.close()
elif ty == GET_USER:
- userId = self.getUserIdFromUid(self.client.uid)
- return {"_type": REP_OK, "user": userId}
+ return {"_type": REP_OK, "user": self.my_user_id}
elif ty == JOIN:
self.ensure_i_joined(cmd["room"])