/** * Stores the roster group delimiter in the private storage and afterwards sets it. * * @param groupDelimiter The group delimiter. * @return The async result. * @see #setGroupDelimiter(String) * @see <a href="https://xmpp.org/extensions/xep-0083.html">XEP-0083: Nested Roster Groups</a> */ public final AsyncResult<Void> storeGroupDelimiter(String groupDelimiter) { return privateDataManager.storeData(RosterDelimiter.of(groupDelimiter)) .thenAccept(result -> setGroupDelimiter(groupDelimiter)); }
/** * Initiates the session. * * @return The async result. * @see <a href="https://xmpp.org/extensions/xep-0166.html#protocol-initiate">6.2 Initiation</a> * @see <a href="https://xmpp.org/extensions/xep-0166.html#def-action-session-initiate">7.2.10 session-initiate</a> */ public AsyncResult<Void> initiate() { if (!createdLocally) { throw new UnsupportedOperationException("You are not the initiator."); } return xmppSession.query(IQ.set(peer, Jingle.initiator(xmppSession.getConnectedResource(), sessionId, Jingle.Action.SESSION_INITIATE, contents))).thenAccept(result -> state = State.PENDING); }
return xmppSession.query(IQ.set(peer, Jingle.responder(xmppSession.getConnectedResource(), sessionId, Jingle.Action.SESSION_ACCEPT, Arrays.asList(contents)))).thenAccept(result -> {
private synchronized void rescheduleNextPing() { // Reschedule in a separate thread, so that it won't interrupt the "pinging" thread due to the cancel, which then causes the ping to fail. if (pingInterval != null && !pingInterval.isNegative() && !scheduledExecutorService.isShutdown()) { cancelNextPing(); nextPing = scheduledExecutorService.schedule(() -> { if (isEnabled() && xmppSession.getStatus() == XmppSession.Status.AUTHENTICATED) { pingServer().thenAccept(result -> { if (!result) { try { throw new XmppException("Server ping failed."); } catch (XmppException e) { xmppSession.notifyException(e); } } }); } // Rescheduling of the next ping is already done by the IQ response of the ping. }, pingInterval.getSeconds(), TimeUnit.SECONDS); } }
}).thenAccept(vCard -> { if (avatar != null) {
}).thenAccept(rosterDelimiter -> setGroupDelimiter(rosterDelimiter != null ? rosterDelimiter.getRosterDelimiter() : null)); } else { rosterDelimiterQuery = new AsyncResult<>(CompletableFuture.completedFuture(null));