aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-01-27 18:26:38 +0300
committerGravatar Vitaly Takmazov2018-01-27 18:26:38 +0300
commit1eb4eedbde8b33bce4bb6f00342b8ea8f115fd12 (patch)
tree9ed81e7d5e278f6c06eda51adafa40f7d577a579 /juick-core/src/main/java/com
parentf4c94626e3ede2cc68647421ad691bc6cd59e47d (diff)
xmpp: formatPostSummary next fixes
Diffstat (limited to 'juick-core/src/main/java/com')
-rw-r--r--juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java b/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java
index f41e9ccc..529db18a 100644
--- a/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java
+++ b/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java
@@ -74,8 +74,8 @@ public class PlainTextFormatter {
: String.format("; %d replies", m.getReplies());
String txt = StringUtils.defaultString(m.getText()).length() >= cropLength ?
StringUtils.substring(StringUtils.defaultString(m.getText()), 0, cropLength) + " [...]" : m.getText();
- return String.format("@%s:%s\n%s\n#%d (%s%s) %s",
- m.getUser().getName(), m.getTagsString(), txt, m.getMid(), timeAgo, repliesCount, formatUrl(m));
+ return String.format("@%s:%s\n%s\n#%s (%s%s) %s",
+ m.getUser().getName(), m.getTagsString(), txt, formatPostNumber(m), timeAgo, repliesCount, formatUrl(m));
}
public static String formatUrl(com.juick.Message jmsg) {
@@ -85,6 +85,13 @@ public class PlainTextFormatter {
return "https://juick.com/" + jmsg.getMid();
}
+ public static String formatPostNumber(com.juick.Message jmsg) {
+ if (jmsg.getRid() > 0) {
+ return String.format("%d/%d", jmsg.getMid(), jmsg.getRid());
+ }
+ return String.format("%d", jmsg.getMid());
+ }
+
public static String formatTwitterCard(Message jmsg) {
return MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText());
}