private void setNickname(Resourcepart nickname) { this.myRoomJid = JidCreate.entityFullFrom(room, nickname); }
public static EntityFullJid getFullJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException { final String jidString = parser.getAttributeValue("", name); if (jidString == null) { return null; } return JidCreate.entityFullFrom(jidString); }
Presence getJoinPresence(MultiUserChat multiUserChat) { final EntityFullJid jid = JidCreate.entityFullFrom(multiUserChat.getRoom(), nickname); joinPresence.setTo(jid); return joinPresence; }
@Override public Bind parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { String name; Bind bind = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: name = parser.getName(); switch (name) { case "resource": String resourceString = parser.nextText(); bind = Bind.newSet(Resourcepart.from(resourceString)); break; case "jid": EntityFullJid fullJid = JidCreate.entityFullFrom(parser.nextText()); bind = Bind.newResult(fullJid); break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return bind; }
private EntityFullJid getUserJid() { try { return JidCreate.entityFullFrom(config.getUsername() + "@" + config.getXMPPServiceDomain() + "/" + (config.getResource() != null ? config.getResource() : "Test")); } catch (XmppStringprepException e) { throw new IllegalStateException(e); } }
throw new MucNotJoinedException(this); final EntityFullJid jid = JidCreate.entityFullFrom(room, nickname);
/** * Get a {@link EntityFullJid} from a given {@link CharSequence} or {@code null} if the input does not represent a JID. * * @param cs the input {@link CharSequence} * @return a JID or {@code null} */ public static EntityFullJid entityFullFromOrNull(CharSequence cs) { try { return entityFullFrom(cs); } catch (XmppStringprepException e) { return null; } }
public static EntityFullJid getFullJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException { final String jidString = parser.getAttributeValue("", name); if (jidString == null) { return null; } return JidCreate.entityFullFrom(jidString); }
/** * Get a {@link EntityFullJid} representing the given CharSequence. * * @param jid a CharSequence representing a JID. * @return a full JID representing the given CharSequence. * @throws XmppStringprepException if an error occurs. */ public static EntityFullJid entityFullFrom(CharSequence jid) throws XmppStringprepException { return entityFullFrom(jid.toString()); }
/** * Like {@link #entityFullFrom(CharSequence)} but does throw an unchecked {@link IllegalArgumentException} instead of a * {@link XmppStringprepException}. * * @param cs the character sequence which should be transformed to a {@link EntityFullJid} * @return the {@link EntityFullJid} if no exception occurs * @throws IllegalArgumentException if the given input is not a valid JID * @see #entityFullFrom(CharSequence) * @since 0.6.2 */ public static EntityFullJid entityFullFromOrThrowUnchecked(CharSequence cs) { try { return entityFullFrom(cs); } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } }
/** * Get a {@link EntityFullJid} constructed from the given parts. * * @param localpart a localpart. * @param domainBareJid a domain bare JID.. * @param resource a resourcepart * @return a full JID. */ public static EntityFullJid entityFullFrom(Localpart localpart, DomainBareJid domainBareJid, Resourcepart resource) { return entityFullFrom(localpart, domainBareJid.getDomain(), resource); }
/** * Get a {@link EntityFullJid} constructed from the given parts. * * @param localpart the localpart. * @param domainpart the domainpart. * @param resource the resourcepart. * @return a full JID. */ public static EntityFullJid entityFullFrom(Localpart localpart, Domainpart domainpart, Resourcepart resource) { return entityFullFrom(entityBareFrom(localpart, domainpart), resource); }
/** * Returns the occupant of the room identified by their nickname. * * @param groupChatRoom the GroupChatRoom. * @param nickname the users nickname. * @return the Occupant found. */ public Occupant getOccupant(GroupChatRoom groupChatRoom, Resourcepart nickname) { EntityFullJid userJID = JidCreate.entityFullFrom(groupChatRoom.getRoomname(), nickname); Occupant occ = null; try { occ = groupChatRoom.getMultiUserChat().getOccupant(userJID); } catch (Exception e) { Log.error(e); } return occ; }
@Override public Bind parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { String name; Bind bind = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: name = parser.getName(); switch (name) { case "resource": String resourceString = parser.nextText(); bind = Bind.newSet(Resourcepart.from(resourceString)); break; case "jid": EntityFullJid fullJid = JidCreate.entityFullFrom(parser.nextText()); bind = Bind.newResult(fullJid); break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return bind; }
@Override public Bind parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { String name; Bind bind = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: name = parser.getName(); switch (name) { case "resource": String resourceString = parser.nextText(); bind = Bind.newSet(Resourcepart.from(resourceString)); break; case "jid": EntityFullJid fullJid = JidCreate.entityFullFrom("client@" + parser.nextText()); bind = Bind.newResult(fullJid); break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return bind; }
/** * Get a {@link EntityFullJid} representing the given String. * * @param jid the JID's String. * @return a full JID representing the input String. * @throws XmppStringprepException if an error occurs. */ public static EntityFullJid entityFullFrom(String jid) throws XmppStringprepException { EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(jid); if (fullJid != null) { return fullJid; } String localpart = XmppStringUtils.parseLocalpart(jid); String domainpart = XmppStringUtils.parseDomain(jid); String resource = XmppStringUtils.parseResource(jid); try { fullJid = entityFullFrom(localpart, domainpart, resource); } catch (XmppStringprepException e) { throw new XmppStringprepException(jid, e); } ENTITY_FULLJID_CACHE.put(jid, fullJid); return fullJid; }
throw new XmppStringprepException(jidString, e); entityJid = entityFullFrom(localpart, domainpart, resourcepart); } else { entityJid = entityBareFrom(localpart, domainpart);
try recipient = JidCreate.entityFullFrom(serverInfo.getRoomName() +"@" +serverInfo.getMUCDomain()
this.myOccupantJid = JidCreate.entityFullFrom(roomJid, myResourcepart);