aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-21 10:07:03 +0300
committerGravatar Vitaly Takmazov2018-11-21 10:07:03 +0300
commit59f028b3b255f2976d10ef752abc0e5a28530c38 (patch)
tree8cedd01308fb631ced902005643739813af60cb0 /src/main/java/com
parent366a0192fee0d2bd8fc13bed47e3a3e61ebb5f90 (diff)
XMPP: cleanup unused code
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/server/XMPPConnection.java50
1 files changed, 15 insertions, 35 deletions
diff --git a/src/main/java/com/juick/server/XMPPConnection.java b/src/main/java/com/juick/server/XMPPConnection.java
index e0e45cf7..01cbd32b 100644
--- a/src/main/java/com/juick/server/XMPPConnection.java
+++ b/src/main/java/com/juick/server/XMPPConnection.java
@@ -108,15 +108,11 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
@Inject
private UserService userService;
@Inject
- private SubscriptionService subscriptionService;
- @Inject
private PMQueriesService pmQueriesService;
@Inject
private BasicXmppSession session;
@Inject
private ExecutorService service;
- @Inject
- private ApplicationEventPublisher applicationEventPublisher;
@Value("${service_user:juick}")
private String serviceUsername;
@Inject
@@ -592,38 +588,22 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
String signuphash = userService.getSignUpHashByJID(msg.getFrom().asBareJid().toEscapedString());
return makeReply(msg.getFrom(), "Для того, чтобы начать пользоваться сервисом, пожалуйста пройдите быструю регистрацию: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nTo start using Juick, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account.");
}
-
- com.juick.Message jmsg = msg.getExtension(com.juick.Message.class);
- if (jmsg != null) {
- if (MessageUtils.isReply(jmsg)) {
- // to get quote and attachment
- com.juick.Message original = messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new);
- com.juick.Message reply = messagesService.getReply(jmsg.getMid(), jmsg.getRid());
- applicationEventPublisher.publishEvent(new MessageEvent(this, reply,
- subscriptionService.getUsersSubscribedToComments(original, reply)));
- } else if (!MessageUtils.isPM(jmsg)) {
- applicationEventPublisher.publishEvent(new MessageEvent(this,
- messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new),
- subscriptionService.getSubscribedUsers(jmsg.getUser().getUid(), jmsg)));
- }
- } else {
- URI attachment = URI.create(StringUtils.EMPTY);
- OobX oobX = msg.getExtension(OobX.class);
- if (oobX != null) {
- attachment = oobX.getUri();
- }
- try {
- if (msg.getTo().asBareJid().equals(jid.asBareJid())) {
- return incomingMessageJuick(user_from, msg.getFrom(), StringUtils.defaultString(msg.getBody()), attachment);
- } else {
- // PM
- result = incomingMessageJuick(user_from, msg.getFrom(),
- String.format("@%s %s", msg.getTo().getLocal(), StringUtils.defaultString(msg.getBody())), attachment);
- }
- messagesService.getUnread(user_from).forEach(mid -> messagesService.setRead(user_from, mid));
- } catch (Exception e1) {
- logger.warn("message exception", e1);
+ URI attachment = URI.create(StringUtils.EMPTY);
+ OobX oobX = msg.getExtension(OobX.class);
+ if (oobX != null) {
+ attachment = oobX.getUri();
+ }
+ try {
+ if (msg.getTo().asBareJid().equals(jid.asBareJid())) {
+ return incomingMessageJuick(user_from, msg.getFrom(), StringUtils.defaultString(msg.getBody()), attachment);
+ } else {
+ // PM
+ result = incomingMessageJuick(user_from, msg.getFrom(),
+ String.format("@%s %s", msg.getTo().getLocal(), StringUtils.defaultString(msg.getBody())), attachment);
}
+ messagesService.getUnread(user_from).forEach(mid -> messagesService.setRead(user_from, mid));
+ } catch (Exception e1) {
+ logger.warn("message exception", e1);
}
} else if (to.getDomain().endsWith(jid.getDomain()) && (to.getDomain().equals(jid.getDomain())
|| to.getDomain().endsWith("." + jid.getDomain()))) {