Skip to content

Ability to set 'Reply to' or Sending user? #13

@toddr

Description

@toddr

https://code.google.com/archive/p/perl-net-jabber-bot/issues/31

Posted on May 10, 2013 by Quick Cat
What steps will reproduce the problem? 1. Create a bot that relays incoming messages to multiple people, in this case one bot for each department. 2. Start the bot. 3. When a user broadcasts a message to a given department, those who get it invariably try to respond to the person sending it by replying to the message received. Since they are responding to the broadcast user ID, their messages are rebroadcast to the group as a whole.

What is the expected output? What do you see instead?

I believe the module is working exactly as it should. This is more a request for a new feature or help in finding how to access an existing feature.

Looking in the code, I saw a line in _send_individual_message that sets the from user in the parameters of the call to jabber_client->Message_Send, but it's commented out. Removing this comment and explicitly setting the sending user to something specific results in the bot disconnecting as soon as any messages are sent.

What version of the product are you using? On what operating system?

2.1.5 on FreeBSD

Please provide any additional information below.

This may be a setting on the ejabberd server, as the relayed messages are not in the message log. It would be very nice to be able to fix, but I do not know enough about the Jabber protocol to know if it's feasible or even possible.

While it would be nice to have this feature, I'm also not going to put an extreme amount of work into something which sole purpose is to prevent users from embarrassing themselves because they won't read the warning at the end of each relayed message.

Comment #1
Posted on May 10, 2013 by Quick Cat
I uncommented the line referenced above in the _send_individual_message function of Bot.pm that sets the 'from' user and changed it to use the $self->full_from variable instead of the undefined hash that was there. (Guess being undefined was at least part of the reason that line was commented out... ;) ) Using a packet sniffer, I observed the following when trying to send with an explicitly set the from user:

This is followed by:

It appears that setting $botobject->from_full explicitly before sending a message has no effect and it instead uses for the from_full variable. Given this, I changed the line in the _send_individual_message function within Bot.pm and hardcoded it to explicitly use my own Jabber ID in string form, the exact same ID as a packet capture shows as the from user when I send a message. Figured that once I got it working, I'd then figure out a way to get the actual sending user ID passed between my script and the module code... something like that wouldn't be difficult, but I wanted to confirm it'd work before adding & testing code to do this. The packet capture shows the same stream error as above the below following as well:

http://jabber.org/protocol/chatstates'/>

The numbers after my Jabber ID has something to do with the fact that my primary work box is BSD and that's where pidgin lives. It's not there on windoze and while annoying, not enough so to bother with; my guess is that it's some sort of compilation info. Regardless, I cut & pasted this directly into Bot.pm as the from address and received the above errors.

There's nothing in the ejabberd logs on the server to indicate any sort of problem. The messages I send to the bot appear in the server message log (set up via bandersnatch and dumping to a mysql database), but there's nothing in the message log showing the message sent from the bot to the destination ID. (Which is also set to my own for testing.)

Honestly, I don't know what else to try at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions