system
September 18, 2017, 6:46am
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);
1 Like
Same problem here, I’m looking for a solution all this next week, if I found something I will tell you
Can you make sure, that your outgoing messages have a “to” attribute?
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'/>
Flow
February 10, 2018, 8:31pm
5
Which Smack version do you use?
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
3 Likes
Sorry for the late answer, it’s working now
Can you recall if/what you changed to make it work?
Can you mark this as resolved then?
Solution: Use recent Smack version.
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)
wroot
March 8, 2018, 9:17pm
12
You press the … under the message and then press on a checkmark.
yeah but Im not the owner of the post xD