aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/XMPPManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-31 01:32:42 +0300
committerGravatar Vitaly Takmazov2022-12-31 01:32:42 +0300
commitbf5550b515c305c017cf8b3fcf04976d74314233 (patch)
tree7da644034410ee138dc821a6f0f30194a2cd0859 /src/main/java/com/juick/XMPPManager.java
parent47bdad85f7ac2b12daf1da4e340be902a568d976 (diff)
PMQueriesService -> ChatService
Diffstat (limited to 'src/main/java/com/juick/XMPPManager.java')
-rw-r--r--src/main/java/com/juick/XMPPManager.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/main/java/com/juick/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java
index 1080b1b9..9bd3b7b5 100644
--- a/src/main/java/com/juick/XMPPManager.java
+++ b/src/main/java/com/juick/XMPPManager.java
@@ -20,7 +20,7 @@ package com.juick;
import com.juick.model.CommandResult;
import com.juick.model.User;
import com.juick.service.MessagesService;
-import com.juick.service.PMQueriesService;
+import com.juick.service.ChatService;
import com.juick.service.StorageService;
import com.juick.service.UserService;
import com.juick.service.component.NotificationListener;
@@ -31,16 +31,13 @@ import com.juick.util.formatters.PlainTextFormatter;
import com.juick.util.xmpp.iq.MessageQuery;
import com.juick.www.WebApp;
import com.juick.www.api.SystemActivity;
-import jakarta.annotation.PostConstruct;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
-import org.springframework.stereotype.Component;
import rocks.xmpp.addr.Jid;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.session.Extension;
@@ -70,7 +67,6 @@ import rocks.xmpp.extensions.version.SoftwareVersionManager;
import rocks.xmpp.extensions.version.model.SoftwareVersion;
import javax.annotation.Nonnull;
-import javax.inject.Inject;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
@@ -94,19 +90,19 @@ public class XMPPManager implements NotificationListener {
private final CommandsManager commandsManager;
private final MessagesService messagesService;
private final UserService userService;
- private final PMQueriesService pmQueriesService;
+ private final ChatService chatService;
private final Jid jid;
public XMPPManager(String botJid, String componentName, int componentPort, String componentHost,
String password, Resource vCardImage, CommandsManager commandsManager,
StorageService storageService, MessagesService messagesService, UserService userService,
- PMQueriesService pmQueriesService, Executor applicationTaskExecutor, WebApp webApp) {
+ ChatService chatService, Executor applicationTaskExecutor, WebApp webApp) {
jid = Jid.of(botJid);
this.commandsManager = commandsManager;
this.messagesService = messagesService;
this.userService = userService;
- this.pmQueriesService = pmQueriesService;
+ this.chatService = chatService;
logger.info("xmpp component start connecting to {}", componentPort);
XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
.extensions(Extension.of(com.juick.model.Message.class), Extension.of(MessageQuery.class))
@@ -346,7 +342,7 @@ public class XMPPManager implements NotificationListener {
Message mm = new Message();
mm.setTo(Jid.of(userJid));
mm.setType(Message.Type.CHAT);
- boolean inroster = pmQueriesService.havePMinRoster(msg.getUser().getUid(), userJid);
+ boolean inroster = chatService.havePMinRoster(msg.getUser().getUid(), userJid);
if (inroster) {
mm.setFrom(Jid.of(msg.getUser().getName(), "juick.com", "Juick"));
mm.setBody(msg.getText());
@@ -491,7 +487,7 @@ public class XMPPManager implements NotificationListener {
} else {
int uid_to = userService.getUIDbyName(username);
if (uid_to > 0) {
- pmQueriesService.addPMinRoster(uid_to, p.getFrom().asBareJid().toEscapedString());
+ chatService.addPMinRoster(uid_to, p.getFrom().asBareJid().toEscapedString());
canSubscribe = true;
}
}
@@ -519,7 +515,7 @@ public class XMPPManager implements NotificationListener {
if (!toJuick) {
int uid_to = userService.getUIDbyName(username);
if (uid_to > 0) {
- pmQueriesService.removePMinRoster(uid_to, p.getFrom().asBareJid().toEscapedString());
+ chatService.removePMinRoster(uid_to, p.getFrom().asBareJid().toEscapedString());
}
}