camel-xmpp: fix private chat response issue

Responding to a private chat wasn't able because the message was always sent to

    String participant = exchange.getIn().getHeader(XmppConstants.TO, 
String.class);

However, the `XmppConstants.TO` in such messages is the camel instance
(which received the message) and not the chat's other participant.
Thus, responding to a chat message always resultet in a message to itself.
This patch fixes that issue and addresses messages always to

    String participant = endpoint.getParticipant();


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3f48f060
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3f48f060
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3f48f060

Branch: refs/heads/camel-2.16.x
Commit: 3f48f0604cdd39e10606353687c033788288739f
Parents: eed00f1
Author: Martin Scharm <mar...@binfalse.de>
Authored: Sat Apr 9 11:53:12 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat Apr 9 13:34:03 2016 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/xmpp/XmppPrivateChatProducer.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3f48f060/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
index 322980b..d56e108 100644
--- 
a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
+++ 
b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java
@@ -65,7 +65,7 @@ public class XmppPrivateChatProducer extends DefaultProducer {
             throw new RuntimeException("Could not connect to XMPP server.", e);
         }
 
-        String participant = exchange.getIn().getHeader(XmppConstants.TO, 
String.class);
+        String participant = endpoint.getParticipant();
         String thread = endpoint.getChatId();
         if (participant == null) {
             participant = getParticipant();

Reply via email to