Java Code Examples for org.jxmpp.jid.BareJid#toString()

The following examples show how to use org.jxmpp.jid.BareJid#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContactItem.java    From Spark with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the name that should be displayed to represent the the contact.
 * If an alias has been set, this alias will be returned. If no alias has
 * been set, the nickname will be returned. If that hasn't been set either,
 * the JID will be returned.
 *
 * @return a name suitable to be displayed
 */
   public String getDisplayName() {
   	String displayName = null;
	if (alias != null && !alias.trim().isEmpty()) {
		displayName = alias.trim();
	} else if (nickname != null && !nickname.trim().isEmpty()) {
		displayName = nickname.trim();
	} else {
	    BareJid bareJid = getJid();
	    if (bareJid != null) {
	        displayName = bareJid.toString();
	    }
	}

	if (displayName != null) {
		return displayName;
	} else {
		return ""; // weird, but happens.
	}
}
 
Example 2
Source File: MissingUserIdOnKeyException.java    From Smack with Apache License 2.0 4 votes vote down vote up
public MissingUserIdOnKeyException(BareJid owner, OpenPgpV4Fingerprint fingerprint) {
    super("Key " + fingerprint.toString() + " does not have a user-id of \"xmpp:" + owner.toString() + "\".");
}
 
Example 3
Source File: BareJidEncoder.java    From Smack with Apache License 2.0 4 votes vote down vote up
@Override
public String encode(BareJid jid) {
    return jid.toString();
}