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

JabberAgent: 'connect_to_receiver' #2375

Open
sfischer13 opened this issue Sep 19, 2018 · 10 comments
Open

JabberAgent: 'connect_to_receiver' #2375

sfischer13 opened this issue Sep 19, 2018 · 10 comments

Comments

@sfischer13
Copy link
Contributor

I'm trying to understand what the option connect_to_receiver of the JabberAgent does. Could someone please explain?

@dsander
Copy link
Collaborator

dsander commented Sep 20, 2018

Then that is set to true the Agent will connect to the configured server and emit Events for a few actions it receives.

@sfischer13
Copy link
Contributor Author

Thanks! So there are two possible "routes"?

  1. message from sending Huginn agent > JabberAgent > Jabber message to jabber_receiver
  2. Jabber event > JabberAgent > message to receiving Huginn agent

Route 1 works on my server but I am having problems with route 2. Based on that, my Jabber account and server settings should be correct.

Looking at the code, the jabber_sender seems to create a MUC and then "invite" the jabber_receiver. Is that correct? How can I join that MUC in order to trigger an event, e.g. on_join?

@dsander
Copy link
Collaborator

dsander commented Sep 21, 2018

Looking at the code, the jabber_sender seems to create a MUC and then "invite" the jabber_receiver. Is that correct? How can I join that MUC in order to trigger an event, e.g. on_join?

Hmm not sure the code call join with jabber_receiver as the argument. So jabber_receiver needs to be a room maybe?

Can you "invite" the bot into another room using a different client?

@sfischer13
Copy link
Contributor Author

Found the issue. join requires a different format, e.g. chatroom@conference.jabber.org/huginn-bot.
I fixed the problem by introducing another variable, which is used if connect_to_receiver is set to true.

@dsander
Copy link
Collaborator

dsander commented Sep 23, 2018

Using the join format in jabber_receiver did not work?

@sfischer13
Copy link
Contributor Author

Using the simple format (user@jabberserver.xyz), there was an error message by the xmpp4r library ("Nickname already used"). It worked after appending a nickname ("/huginn-bot" in my previous post) and using a multi-user chat JID.

@dsander
Copy link
Collaborator

dsander commented Sep 24, 2018

You mentioned you introduced a new variable. I was wondering if hatroom@conference.jabber.org/huginn-bot could be used as jabber_receiver without changing the code.

@sfischer13
Copy link
Contributor Author

If connect_to_receiver is true, the "/huginn-bot" nick will be blocked by the Huginn agent. So I cannot join the MUC with the same nick on a different device. On the other hand, if I use my jabber_sender credentials on a different client, I can see "my" chat messages, which were actually created by the Huginn agent. So I can see the generated messages from the wrong perspective 😆

Maybe someone else should verify this behavior.

@dsander
Copy link
Collaborator

dsander commented Sep 28, 2018

Oh, yes jabber_sender is also used when connecting to the jabber server with connect_to_receiver=true.

So you added another variable to use the same Agent to both receive and send Events?

@sfischer13
Copy link
Contributor Author

Yes, I added another variable jabber_muc_jid. Then I replaced jabber_receiver with the new variable in the following line of code:

muc.join(agent.interpolated['jabber_receiver'])

Actually, I made more changes, but they are not relevant for fixing the problem.

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

2 participants