~singpolyma/cheogram-android

f586a5dfdfb736644e10453ab54afa52dc19e3e0 — Stephen Paul Weber 11 months ago c83adad
Fix using bookmarks with advanced nicks
M src/main/java/eu/siacs/conversations/entities/Bookmark.java => src/main/java/eu/siacs/conversations/entities/Bookmark.java +13 -2
@@ 192,8 192,19 @@ public class Bookmark extends Element implements ListItem {
	}

	public Jid getFullJid() {
		final String nick = getNick();
		return jid == null || nick == null || nick.trim().isEmpty() ? jid : jid.withResource(nick);
		return getFullJid(getNick(), true);
	}

	private Jid getFullJid(final String nick, boolean tryFix) {
		try {
			return jid == null || nick == null || nick.trim().isEmpty() ? jid : jid.withResource(nick);
		} catch (final IllegalArgumentException e) {
			try {
				return tryFix ? getFullJid(gnu.inet.encoding.Punycode.encode(nick), false) : null;
			} catch (final gnu.inet.encoding.PunycodeException e2) {
				return null;
			}
		}
	}

	public List<Tag> getGroupTags() {

M src/main/java/eu/siacs/conversations/entities/MucOptions.java => src/main/java/eu/siacs/conversations/entities/MucOptions.java +3 -3
@@ 110,7 110,7 @@ public class MucOptions {

    void notifyOfBookmarkNick(final String nick) {
        final String normalized = normalize(account.getJid(),nick);
        if (normalized != null && normalized.equals(getSelf().getFullJid().getResource())) {
        if (normalized != null && normalized.equals(getSelf().getNick())) {
            this.tookProposedNickFromBookmark = true;
        }
    }


@@ 469,12 469,12 @@ public class MucOptions {
        if (account == null || TextUtils.isEmpty(nick)) {
            return null;
        }

        try {
            return account.withResource(nick).getResource();
        } catch (IllegalArgumentException e) {
            return null;
            return nick;
        }

    }

    public String getActualNick() {