replace /me when quoting messages. fixes #3669
This commit is contained in:
parent
88cc097732
commit
7ca543e42f
|
@ -143,6 +143,16 @@ public class Contact implements ListItem, Blockable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPublicDisplayName() {
|
||||||
|
if (!TextUtils.isEmpty(this.presenceName)) {
|
||||||
|
return this.presenceName;
|
||||||
|
} else if (jid.getLocal() != null) {
|
||||||
|
return JidHelper.localPartOrFallback(jid);
|
||||||
|
} else {
|
||||||
|
return jid.getDomain().toEscapedString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getProfilePhoto() {
|
public String getProfilePhoto() {
|
||||||
return this.photoUri;
|
return this.photoUri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -643,8 +643,8 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
|
||||||
!this.isOOb() &&
|
!this.isOOb() &&
|
||||||
!message.treatAsDownloadable() &&
|
!message.treatAsDownloadable() &&
|
||||||
!this.treatAsDownloadable() &&
|
!this.treatAsDownloadable() &&
|
||||||
!message.getBody().startsWith(ME_COMMAND) &&
|
!message.hasMeCommand() &&
|
||||||
!this.getBody().startsWith(ME_COMMAND) &&
|
!this.hasMeCommand() &&
|
||||||
!this.bodyIsOnlyEmojis() &&
|
!this.bodyIsOnlyEmojis() &&
|
||||||
!message.bodyIsOnlyEmojis() &&
|
!message.bodyIsOnlyEmojis() &&
|
||||||
((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) &&
|
((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) &&
|
||||||
|
|
|
@ -29,10 +29,13 @@
|
||||||
|
|
||||||
package eu.siacs.conversations.utils;
|
package eu.siacs.conversations.utils;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.entities.Conversational;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.http.AesGcmURLStreamHandler;
|
import eu.siacs.conversations.http.AesGcmURLStreamHandler;
|
||||||
import eu.siacs.conversations.http.P1S3UrlStreamHandler;
|
import eu.siacs.conversations.http.P1S3UrlStreamHandler;
|
||||||
|
@ -45,7 +48,22 @@ public class MessageUtils {
|
||||||
|
|
||||||
public static String prepareQuote(Message message) {
|
public static String prepareQuote(Message message) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
final String body = message.getMergedBody().toString();
|
final String body;
|
||||||
|
if (message.hasMeCommand()) {
|
||||||
|
final String nick;
|
||||||
|
if (message.getStatus() == Message.STATUS_RECEIVED) {
|
||||||
|
if (message.getConversation().getMode() == Conversational.MODE_MULTI) {
|
||||||
|
nick = Strings.nullToEmpty(message.getCounterpart().getResource());
|
||||||
|
} else {
|
||||||
|
nick = message.getContact().getPublicDisplayName();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nick = UIHelper.getMessageDisplayName(message);
|
||||||
|
}
|
||||||
|
body = nick + " " + message.getBody().substring(Message.ME_COMMAND.length());
|
||||||
|
} else {
|
||||||
|
body = message.getMergedBody().toString();;
|
||||||
|
}
|
||||||
for (String line : body.split("\n")) {
|
for (String line : body.split("\n")) {
|
||||||
if (line.length() <= 0) {
|
if (line.length() <= 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue