All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lantern.LanternXmppUtils Maven / Gradle / Ivy

Go to download

Lantern is a peer-to-peer and trust-network-based tool for circumventing censors and preventing monitoring.

There is a newer version: 0.1
Show newest version
package org.lantern;

import org.apache.commons.lang3.StringUtils;


public class LanternXmppUtils {

    public static String jidToUserId(final String fullId) {
        if (fullId.contains("/")) {
            return fullId.split("/")[0];
        } else {
            return fullId;
        }
    }

    public static String jidToInstanceId(final String fullId) {
        return fullId.split("/", 2)[1];
    }

    public static boolean isLanternJid(final String from) {
        // Here's the format we're looking for: "-lan-"
        if (from.contains("/"+LanternConstants.UNCENSORED_ID)) {
            return true;
        }
        return false;
    }

    public static String jidToEmail(final String jid) {
        if (jid.contains("/")) {
            return StringUtils.substringBefore(jid, "/");
        }
        return jid;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy