/** * Creates a new message to the specified recipient and with the specified body. * * @param to the user to send the message to. * @param body the body of the message. * @throws XmppStringprepException if 'to' is not a valid XMPP address. */ public Message(String to, String body) throws XmppStringprepException { this(JidCreate.from(to), body); }
private void setNickname(Resourcepart nickname) { this.myRoomJid = JidCreate.entityFullFrom(room, nickname); }
@Override public BareJid decode(String string) { try { return JidCreate.bareFrom(string); } catch (XmppStringprepException e) { throw new IllegalArgumentException("BareJid cannot be decoded.", e); } } }
public static EntityBareJid getBareJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException { final String jidString = parser.getAttributeValue("", name); if (jidString == null) { return null; } return JidCreate.entityBareFrom(jidString); }
public Builder setService(String service) throws XmppStringprepException { if (service == null) { // Do nothing if user did not specify the XMPP service domain. When the builder // builds a configuration using build() it will throw a meaningful exception. return this; } return setService(JidCreate.domainBareFrom(service)); }
@Test(expected = IllegalArgumentException.class) public void transportCandidateIllegalPriorityTest() throws XmppStringprepException { FullJid jid = JidCreate.fullFrom("test@test.test/test"); @SuppressWarnings("unused") JingleS5BTransportCandidate candidate = new JingleS5BTransportCandidate( "cid", "host", jid, 5555, -30, JingleS5BTransportCandidate.Type.proxy); }
@Override public BareJid decode(String string) { try { return JidCreate.bareFromUrlEncoded(string); } catch (XmppStringprepException e) { throw new IllegalArgumentException("BareJid cannot be decoded.", e); } } }
public Builder setJid(String jid) throws XmppStringprepException { this.jid = JidCreate.from(jid); return this; }
public static boolean tlsTest(CharSequence jidCs, String password, String host, int port, String tlsPin, boolean shouldThrow) throws XmppStringprepException, KeyManagementException, NoSuchAlgorithmException { EntityBareJid jid = JidCreate.entityBareFrom(jidCs); return tlsTest(jid, password, host, port, tlsPin, shouldThrow); }
/** * Set the XMPP domain. The XMPP domain is what follows after the '@' sign in XMPP addresses (JIDs). * * @param xmppServiceDomain the XMPP domain. * @return a reference to this builder. * @throws XmppStringprepException if the given string is not a domain bare JID. */ public B setXmppDomain(String xmppServiceDomain) throws XmppStringprepException { this.xmppServiceDomain = JidCreate.domainBareFrom(xmppServiceDomain); return getThis(); }
OmemoStoreTest(OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> store) throws XmppStringprepException { this.store = store; alice = new OmemoDevice(JidCreate.bareFrom("alice@wonderland.lit"), 123); bob = new OmemoDevice(JidCreate.bareFrom("bob@builder.tv"), 987); }
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); }
public static Jid getJidAttribute(XmlPullParser parser, String name) throws XmppStringprepException { final String jidString = parser.getAttributeValue("", name); if (jidString == null) { return null; } return JidCreate.from(jidString); }
public static void tlsTest(int runs, CharSequence jidCs, String password, String host, int port, String tlsPin, boolean shouldThrow) throws XmppStringprepException, KeyManagementException, NoSuchAlgorithmException { EntityBareJid jid = JidCreate.entityBareFrom(jidCs); for (int i = 0; i < runs; i++) { boolean res = tlsTest(jid, password, host, port, tlsPin, shouldThrow); if (!res) { throw new IllegalStateException(); } } }
public static boolean supportsIbr(String xmppDomain) throws SmackException, IOException, XMPPException, InterruptedException, KeyManagementException, NoSuchAlgorithmException { DomainBareJid xmppDomainJid = JidCreate.domainBareFrom(xmppDomain); return supportsIbr(xmppDomainJid); }
private EntityFullJid getUserJid() { try { return JidCreate.entityFullFrom(config.getUsername() + "@" + config.getXMPPServiceDomain() + "/" + (config.getResource() != null ? config.getResource() : "Test")); } catch (XmppStringprepException e) { throw new IllegalStateException(e); } }
public boolean updatedAddressesContains(String jidString) { Jid jid; try { jid = JidCreate.from(jidString); } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } return addressesUpdated.contains(jid); }
private static void populateStore(RosterStore store) throws IOException { store.addEntry(new RosterPacket.Item(JidCreate.entityBareFrom("geoff@example.com"), "geoff hurley"), ""); RosterPacket.Item item = new RosterPacket.Item(JidCreate.entityBareFrom("joe@example.com"), "joe stevens"); item.addGroupName("friends"); item.addGroupName("partners"); store.addEntry(item, ""); item = new RosterPacket.Item(JidCreate.entityBareFrom("higgins@example.com"), "higgins mcmann"); item.addGroupName("all"); item.addGroupName("friends"); store.addEntry(item, "v96"); }
public static boolean createAccount(String xmppDomain, String username, String password) throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException, InterruptedException { DomainBareJid xmppDomainJid = JidCreate.domainBareFrom(xmppDomain); Localpart localpart = Localpart.from(username); return createAccount(xmppDomainJid, localpart, password); }
private static Item vaglafItem() throws XmppStringprepException { Item item = new Item(JidCreate.entityBareFrom("vaglaf@example.com"), "vaglaf the only"); item.setItemType(ItemType.both); item.addGroupName("all"); item.addGroupName("friends"); item.addGroupName("partners"); return item; }