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/xmpp/s2s/ConnectionRouter.java23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java
index 48d2efd5..2a1fed5d 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java
@@ -166,13 +166,17 @@ public class ConnectionRouter extends Connection implements Runnable {
public void sendJuickComment(JuickMessage jmsg) throws Exception {
List<String> jids;
String replyQuote;
+ String replyTo;
synchronized (XMPPComponent.sqlSync) {
jids = SubscriptionsQueries.getJIDSubscribedToComments(XMPPComponent.sql, jmsg.getMID(), jmsg.getUser().getUID());
- replyQuote = getReplyQuote(XMPPComponent.sql, jmsg.getMID(), jmsg.ReplyTo);
+ com.juick.Message replyMessage = jmsg.ReplyTo > 0 ? MessagesQueries.getReply(XMPPComponent.sql, jmsg.getMID(), jmsg.ReplyTo)
+ : MessagesQueries.getMessage(XMPPComponent.sql, jmsg.getMID());
+ replyTo = replyMessage.getUser().getUName();
+ replyQuote = getReplyQuote(replyMessage);
}
- String txt = "Reply by @" + jmsg.getUser().getUName() + ":\n" + replyQuote + "\n";
+ String txt = "Reply by @" + jmsg.getUser().getUName() + ":\n" + replyQuote + "\n@" + replyTo + " ";
String attachment = jmsg.getAttachmentURL();
if (attachment != null) {
txt += attachment + "\n";
@@ -190,19 +194,8 @@ public class ConnectionRouter extends Connection implements Runnable {
}
}
- private String getReplyQuote(java.sql.Connection sql, int MID, int ReplyTo) {
- String quote = "";
- if (ReplyTo > 0) {
- com.juick.Message q = MessagesQueries.getReply(sql, MID, ReplyTo);
- if (q != null) {
- quote = q.getText();
- }
- } else {
- com.juick.Message q = MessagesQueries.getMessage(sql, MID);
- if (q != null) {
- quote = q.getText();
- }
- }
+ private String getReplyQuote(com.juick.Message q) {
+ String quote = q.getText();
if (quote.length() > 50) {
quote = ">" + quote.substring(0, 47).replace('\n', ' ') + "...\n";
} else if (quote.length() > 0) {