aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/api/PM.java4
-rw-r--r--src/main/java/com/juick/api/TelegramBotHook.java6
-rw-r--r--src/main/java/com/juick/api/Users.java14
3 files changed, 11 insertions, 13 deletions
diff --git a/src/main/java/com/juick/api/PM.java b/src/main/java/com/juick/api/PM.java
index c7123d0a..631ae978 100644
--- a/src/main/java/com/juick/api/PM.java
+++ b/src/main/java/com/juick/api/PM.java
@@ -87,8 +87,8 @@ public class PM {
Main.replyJSON(request, response, messageSerializer.serialize(jmsg).toString());
- String jid = UserQueries.getJIDbyUID(sql, uid);
- if (jid != null) {
+ List<String> jids = UserQueries.getJIDsbyUID(sql, uid);
+ for (String jid: jids) {
Message mm = new Message();
mm.to = new JID(jid);
mm.type = Message.Type.chat;
diff --git a/src/main/java/com/juick/api/TelegramBotHook.java b/src/main/java/com/juick/api/TelegramBotHook.java
index e3afdd51..e1094ff6 100644
--- a/src/main/java/com/juick/api/TelegramBotHook.java
+++ b/src/main/java/com/juick/api/TelegramBotHook.java
@@ -52,6 +52,7 @@ public class TelegramBotHook {
@Override
public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception {
logger.info("ws disconnected");
+ ws.connect();
}
@Override
@@ -67,8 +68,8 @@ public class TelegramBotHook {
StringBuilder sb = new StringBuilder();
sb.append("@").append(jmsg.getUser().getUName()).append(":\n")
.append(jmsg.getTagsString()).append("\n").append(jmsg.getText()).append("\n");
- if (jmsg.getAttachmentURL() != null) {
- sb.append(jmsg.getAttachmentURL());
+ if (jmsg.Photo != null) {
+ sb.append(jmsg.Photo);
}
String msg = sb.toString();
List<Long> users = getSubscribers(jmsg.getUser().getUID());
@@ -89,6 +90,7 @@ public class TelegramBotHook {
@Override
public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception {
logger.info("ws replies disconnected");
+ ws.connect();
}
@Override
diff --git a/src/main/java/com/juick/api/Users.java b/src/main/java/com/juick/api/Users.java
index 57f8c4b9..e85c517a 100644
--- a/src/main/java/com/juick/api/Users.java
+++ b/src/main/java/com/juick/api/Users.java
@@ -1,5 +1,6 @@
package com.juick.api;
+import com.juick.User;
import com.juick.json.UserSerializer;
import com.juick.server.UserQueries;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -115,15 +116,10 @@ public class Users {
}
if (uid > 0) {
- List<Integer> uids = UserQueries.getUserReaders(sql, uid);
- if (uids.size() > 0) {
- List<com.juick.User> users = UserQueries.getUsersByID(sql, uids);
- if (users.size() > 0) {
- String json = userSerializer.serializeList(users);
- Main.replyJSON(request, response, json);
- return;
- }
- }
+ List<User> users = UserQueries.getUserReaders(sql, uid);
+ String json = userSerializer.serializeList(users);
+ Main.replyJSON(request, response, json);
+ return;
}
response.sendError(404);
}