Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pupetting multiple users that sit on the same matrix server fails #109

Open
Mai-Lapyst opened this issue Sep 17, 2023 · 0 comments
Open

Comments

@Mai-Lapyst
Copy link

Hi; trying to setup an xmpp bridge (using https://github.com/ilvar/mx-puppet-xmpp). When one has multiple (in my case two) users on the same matrix homeserver / bridge setup that both which to link their xmpp accounts to their matrix account and then want to write over the xmpp bridge, it fails.

The bridge correctly creates the bridged room for user 1, but not for user 2. The logs state that the message is recieved but blocked: Found some puppet with puppetId=2. block=true.

I guess the problem is this block of code, since it contains a bug where it always uses the first available puppet, and uses that to determine if it needs to be blocked:

let somePuppet = -1;
for (const puppetId of puppetIds) {
somePuppet = puppetId;
break;
}
if (somePuppet === -1) {
log.debug("No user at all found?");
return false;
}
{
const block = params.room.puppetId !== somePuppet;
log.debug(`Found some puppet with puppetId=${somePuppet}. block=${block}`);
return block;
}

Sep-17 03:58:05.035 [NamespaceHandler] debug: In global namespace, determining if it should be blocked... puppetId=2 userId=BBBB roomId=BBBB
Sep-17 03:58:05.072 [NamespaceHandler] debug: Found some puppet with puppetId=2. block=false

...

Sep-17 04:13:11.641 [NamespaceHandler] debug: In global namespace, determining if it should be blocked... puppetId=3 userId=AAAA roomId=AAAA
Sep-17 04:13:11.645 [NamespaceHandler] debug: Found some puppet with puppetId=2. block=true

Notes:

  • xmpp user AAAA is linked with puppet 2
  • xmpp user BBBB is linked with puppet 3
More log
Sep-17 03:58:05.035 [NamespaceHandler] debug: In global namespace, determining if it should be blocked... puppetId=2 userId=BBBB roomId=BBBB
Sep-17 03:58:05.035 [Postgres] silly: All: SELECT * FROM puppet_store
Sep-17 03:58:05.070 [XmppPuppet:xmpp] info: getUserIdsInRoom { puppetId: 2, roomId: 'BBBB' }
Sep-17 03:58:05.070 [XmppPuppet:client] info: Fetching conversation { puppetId: 2, roomId: 'BBBB' }
Sep-17 03:58:05.070 [XmppPuppet:client] info: Fetching conversation puppetId=2 roomId=BBBB
Sep-17 03:58:05.071 [XmppPuppet:client] info: Returning cached result
Sep-17 03:58:05.071 [XmppPuppet:client] silly: { id: 'BBBB', members: [] }
Sep-17 03:58:05.071 [XmppPuppet:xmpp] info: getUserIdsInRoom users Set {}
Sep-17 03:58:05.072 [XmppPuppet:xmpp] info: Received create request for channel update puppetId=2 roomId=BBBB
Sep-17 03:58:05.072 [XmppPuppet:client] info: Fetching conversation { puppetId: 2, roomId: 'BBBB' }
Sep-17 03:58:05.072 [XmppPuppet:client] info: Fetching conversation puppetId=2 roomId=BBBB
Sep-17 03:58:05.072 [XmppPuppet:client] info: Returning cached result
Sep-17 03:58:05.072 [XmppPuppet:client] silly: { id: 'BBBB', members: [] }
Sep-17 03:58:05.072 [NamespaceHandler] debug: Found some puppet with puppetId=2. block=false

...

Sep-17 04:13:11.641 [NamespaceHandler] debug: In global namespace, determining if it should be blocked... puppetId=3 userId=AAAA roomId=AAAA
Sep-17 04:13:11.641 [XmppPuppet:xmpp] info: getUserIdsInRoom { puppetId: 2, roomId: 'AAAA' }
Sep-17 04:13:11.641 [XmppPuppet:client] info: Fetching conversation { puppetId: 2, roomId: 'AAAA' }
Sep-17 04:13:11.642 [XmppPuppet:client] info: Fetching conversation puppetId=2 roomId=AAAA
Sep-17 04:13:11.642 [XmppPuppet:client] info: Returning cached result
Sep-17 04:13:11.642 [XmppPuppet:client] silly: { id: 'AAAA', members: [] }
Sep-17 04:13:11.642 [XmppPuppet:xmpp] info: getUserIdsInRoom users Set {}
Sep-17 04:13:11.642 [XmppPuppet:xmpp] info: getUserIdsInRoom { puppetId: 3, roomId: 'AAAA' }
Sep-17 04:13:11.643 [XmppPuppet:client] info: Fetching conversation { puppetId: 3, roomId: 'AAAA' }
Sep-17 04:13:11.643 [XmppPuppet:client] info: Fetching conversation puppetId=3 roomId=AAAA
Sep-17 04:13:11.643 [XmppPuppet:client] info: Returning cached result
Sep-17 04:13:11.643 [XmppPuppet:client] silly: { id: 'AAAA', members: [] }
Sep-17 04:13:11.643 [XmppPuppet:xmpp] info: getUserIdsInRoom users Set {}
Sep-17 04:13:11.643 [XmppPuppet:xmpp] info: Received create request for channel update puppetId=2 roomId=AAAA
Sep-17 04:13:11.644 [XmppPuppet:client] info: Fetching conversation { puppetId: 2, roomId: 'AAAA' }
Sep-17 04:13:11.644 [XmppPuppet:client] info: Fetching conversation puppetId=2 roomId=AAAA
Sep-17 04:13:11.644 [XmppPuppet:client] info: Returning cached result
Sep-17 04:13:11.644 [XmppPuppet:client] silly: { id: 'AAAA', members: [] }
Sep-17 04:13:11.644 [XmppPuppet:xmpp] info: Received create request for channel update puppetId=3 roomId=AAAA
Sep-17 04:13:11.645 [XmppPuppet:client] info: Fetching conversation { puppetId: 3, roomId: 'AAAA' }
Sep-17 04:13:11.645 [XmppPuppet:client] info: Fetching conversation puppetId=3 roomId=AAAA
Sep-17 04:13:11.645 [XmppPuppet:client] info: Returning cached result
Sep-17 04:13:11.645 [XmppPuppet:client] silly: { id: 'AAAA', members: [] }
Sep-17 04:13:11.645 [NamespaceHandler] debug: Found some puppet with puppetId=2. block=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant