aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java')
-rw-r--r--juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java53
1 files changed, 1 insertions, 52 deletions
diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java
index fa097584..7cd0cbc0 100644
--- a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java
+++ b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java
@@ -47,15 +47,13 @@ import java.util.List;
/**
* Created by vt on 12/11/2016.
*/
-public class XMPPBot implements AutoCloseable, ProtocolListener {
+public class XMPPBot implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(XMPPBot.class);
@Inject
private UserService userService;
@Inject
private PMQueriesService pmQueriesService;
@Inject
- private JuickProtocol juickProtocol;
- @Inject
private Environment env;
Jid juickJid;
@@ -69,7 +67,6 @@ public class XMPPBot implements AutoCloseable, ProtocolListener {
env.getProperty("component_password", "secret"), env.getProperty("component_host", "localhost"),
NumberUtils.toInt(env.getProperty("component_port", "5347"), 5347));
juickJid = Jid.of(env.getProperty("xmppbot_jid", "juick@juick.com/Juick"));
- juickProtocol.setListener(this);
try {
SoftwareVersionManager softwareVersionManager = component.getManager(SoftwareVersionManager.class);
softwareVersionManager.setSoftwareVersion(new SoftwareVersion("Juick", "git", System.getProperty("os.name", "generic")));
@@ -100,16 +97,6 @@ public class XMPPBot implements AutoCloseable, ProtocolListener {
} catch (XmppException vce) {
logger.warn("vcard exception", vce);
}
- } else {
- try {
- String reply = juickProtocol.getReply(user, text);
- Message replyMessage = new Message(message.getFrom(), Message.Type.CHAT);
- replyMessage.setBody(reply);
- replyMessage.setFrom(juickJid);
- component.send(replyMessage);
- } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException ex) {
- logger.warn("unhandled error", ex);
- }
}
});
component.connect();
@@ -125,42 +112,4 @@ public class XMPPBot implements AutoCloseable, ProtocolListener {
logger.info("ExternalComponent on xmpp-bot destroyed");
}
-
- @Override
- public void privateMessage(User from, User to, String body) {
- List<String> toJids = userService.getJIDsbyUID(to.getUid());
- toJids.forEach(jid -> {
- Message mm = new Message();
- mm.setTo(Jid.of(jid));
- mm.setType(Message.Type.CHAT);
- boolean haveInRoster = pmQueriesService.havePMinRoster(from.getUid(), jid);
- if (haveInRoster) {
- mm.setFrom(Jid.of(from.getName(), juickJid.getDomain(), "Juick"));
- mm.setBody(body);
- } else {
- mm.setFrom(Jid.of("juick", juickJid.getDomain(), "Juick"));
- mm.setBody("Private message from @" + from.getName() + ":\n" + body);
- }
- component.send(mm);
- });
- }
-
- @Override
- public void userSubscribed(User from, User to) {
- String notification = String.format("%s subscribed to your blog", from.getName());
- List<String> toJids = userService.getJIDsbyUID(to.getUid());
- toJids.forEach(jid -> {
- Message mm = new Message();
- mm.setTo(Jid.of(jid));
- mm.setType(Message.Type.CHAT);
- mm.setFrom(juickJid);
- mm.setBody(notification);
- component.send(mm);
- });
- }
-
- @Override
- public void messagePosted(com.juick.Message msg) {
-
- }
}