powered by Jive Software

Smack 4.2.0 OutgoingChatMessageListener is not getting any call


#1

I am using smack 4.2.0 latest version, here IncomingChatMessageListener is working fine but OutgoingChatMessageListener is not getting called when I send the message. Can any one suggest me whats the issue?

My code is below

ChatManager chatManager = ChatManager.getInstanceFor(mXMPPConn);

EntityBareJid jid = JidCreate.entityBareFrom(mStrJabberID);

Chat chat = chatManager.chatWith(jid);

chatManager.addOutgoingListener(new OutgoingChatMessageListener() {
  @Override
  public void newOutgoingMessage(EntityBareJid to, Message message, Chat chat) {
    System.out.format("OUTGOING: %s.\n", message);
  }
});

chat.send(strMsg);

newOutgoingMessage not working
#2

Same problem here, I’m looking for a solution all this next week, if I found something I will tell you


#3

Can you make sure, that your outgoing messages have a “to” attribute?


newOutgoingMessage not working
#4

Hi Paul, this is what I got from the log. I think it’s fine right?

<message to='869706@XXXXX' id='8lLLh-7'><body>Hi 869706 QWER</body></message><r xmlns='urn:xmpp:sm:3'/>

#5

Which Smack version do you use?


#6

I’m not able to reproduce the issue.

<message to='test@server.tld' id='byTkP-80'><body>Hello World!</body></message>

My setup is the following:

        ChatManager m1 = ChatManager.getInstanceFor(connection);

        BareJid user = JidCreate.bareFrom("test@server.tld");

        final Message out = new Message(user);
        out.setBody("Hello World!");
        
        m1.addOutgoingListener(new OutgoingChatMessageListener() {
            @Override
            public void newOutgoingMessage(EntityBareJid to, Message message, Chat chat) {
                LOGGER.log(Level.INFO, "Voila!");
            }
        });

        connection.sendStanza(out);

Edit: I also tried it with your exact setup as well.

Everything is working as intended for me. The fact, that there are two independent bug reports make me curious though…

Btw: I’m using the latest Smack 4.2.3 fresh out of the oven :slight_smile:


#7

Sorry for the late answer, it’s working now


#8

Can you recall if/what you changed to make it work?


#9

Using 4.2.3 as you said :slight_smile:


#10

Can you mark this as resolved then?
Solution: Use recent Smack version.


#11

I was looking for “solution” option but I can’t find it (I already use it in another post you gave me the answer but I can’t in this one)


#12

You press the … under the message and then press on a checkmark.


#13

yeah but Im not the owner of the post xD


#14

Ok, done it for you :slight_smile: