aboutsummaryrefslogtreecommitdiff
path: root/juick-crosspost/src/main/java/com/juick/components
diff options
context:
space:
mode:
Diffstat (limited to 'juick-crosspost/src/main/java/com/juick/components')
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/Crosspost.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
index 7cf4ad3e..769fb892 100644
--- a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
+++ b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
@@ -19,6 +19,7 @@ package com.juick.components;
import com.juick.Tag;
import com.juick.service.CrosspostService;
+import com.juick.service.MessagesService;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.CharEncoding;
@@ -39,6 +40,7 @@ import rocks.xmpp.extensions.component.accept.ExternalComponent;
import javax.annotation.PostConstruct;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
+import javax.inject.Inject;
import javax.net.ssl.HttpsURLConnection;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
@@ -66,6 +68,8 @@ public class Crosspost implements AutoCloseable {
private final String crosspostJid;
private final String password;
private final int port;
+ @Inject
+ MessagesService messagesService;
public Crosspost(final Environment env, final CrosspostService crosspostService) {
Assert.notNull(env);
@@ -98,7 +102,7 @@ public class Crosspost implements AutoCloseable {
xmpp = ExternalComponent.create(crosspostJid, password, configuration, "localhost", port);
xmpp.addInboundMessageListener(e -> {
Message msg = e.getMessage();
- com.juick.Message jmsg = msg.getExtension(com.juick.Message.class);
+ com.juick.Message jmsg = messagesService.getMessage(msg.getExtension(com.juick.Message.class).getMid());
if (msg.getTo() != null && msg.getTo().getLocal() != null && jmsg != null && jmsg.getRid() == 0) {
if (msg.getTo().getLocal().equals("twitter")) {
twitterPost(jmsg);