/** * Return the agents JID. * * @return - the agents JID. */ public Jid getUser() { return connection.getUser(); }
@Override public String toString() { return "MUC: " + room + "(" + connection.getUser() + ")"; } }
@Override public boolean evaluate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser()); return info.containsFeature(dummyFeature); } });
/** * Creates an Jingle session to start a communication with another user. * * @param responder the fully qualified jabber ID with resource of the other * user. * @return The session on which the negotiation can be run. */ public JingleSession createOutgoingJingleSession(EntityFullJid responder) throws XMPPException { JingleSession session = new JingleSession(connection, null, connection.getUser(), responder, jingleMediaManagers); triggerSessionCreated(session); return session; }
@Override public SubscribeAnswer processSubscribe(Jid from, Presence subscribeRequest) { if (from.equals(conOne.getUser().asBareJid())) { return SubscribeAnswer.Approve; } return SubscribeAnswer.Deny; } };
@Override public SubscribeAnswer processSubscribe(Jid from, Presence subscribeRequest) { if (from.equals(conTwo.getUser().asBareJid())) { return SubscribeAnswer.Approve; } return SubscribeAnswer.Deny; } };
private void fireInvitationEvent(Jid groupChatJID, String sessionID, String body, Jid from, Map<String, List<String>> metaData) { WorkgroupInvitation invitation = new WorkgroupInvitation(connection.getUser(), groupChatJID, workgroupJID, sessionID, body, from, metaData); synchronized (invitationListeners) { for (WorkgroupInvitationListener listener : invitationListeners) { listener.invitationReceived(invitation); } } }
@SmackIntegrationTest public void testCapsChanged() { final String dummyFeature = getNewDummyFeature(); String nodeVerBefore = EntityCapsManager.getNodeVersionByJid(conTwo.getUser()); sdmTwo.addFeature(dummyFeature); String nodeVerAfter = EntityCapsManager.getNodeVersionByJid(conTwo.getUser()); assertFalse(nodeVerBefore.equals(nodeVerAfter)); }
/** * Return our own {@link BareJid}. * * @return our bareJid * * @throws SmackException.NotLoggedInException in case our connection is not logged in, which means our BareJid is unknown. */ public BareJid getJidOrThrow() throws SmackException.NotLoggedInException { throwIfNotAuthenticated(); return connection().getUser().asEntityBareJidOrThrow(); }
public static void ensureNotSubscribedToEachOther(XMPPConnection connectionOne, XMPPConnection connectionTwo) throws NotConnectedException, InterruptedException { final Roster rosterOne = Roster.getInstanceFor(connectionOne); final BareJid jidOne = connectionOne.getUser().asBareJid(); final Roster rosterTwo = Roster.getInstanceFor(connectionTwo); final BareJid jidTwo = connectionTwo.getUser().asBareJid(); ensureNotSubscribed(rosterOne, jidTwo); ensureNotSubscribed(rosterTwo, jidOne); }
private static void send(String messageString, XMPPConnection from, XMPPConnection to) throws NotConnectedException, InterruptedException { Message message = new Message(to.getUser()); message.setBody(messageString); from.sendStanza(message); }
@Override public void presenceSubscribed(BareJid address, Presence subscribedPresence) { if (!address.equals(conOne.getUser().asBareJid())) { return; } syncPoint.signal(); } });
private static void notInRoster(XMPPConnection c1, XMPPConnection c2) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Roster roster = Roster.getInstanceFor(c1); RosterEntry c2Entry = roster.getEntry(c2.getUser().asBareJid()); if (c2Entry == null) { return; } roster.removeEntry(c2Entry); }
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { XMPPConnection connection = connection(); ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); BareJid localBareJid = connection.getUser().asBareJid(); return serviceDiscoveryManager.supportsFeatures(localBareJid, REQUIRED_FEATURES); } }
/** * Return the BareJid of the user. * * @return bareJid */ public BareJid getOwnJid() { if (ownJid == null && connection().isAuthenticated()) { ownJid = connection().getUser().asBareJid(); } return ownJid; }
public Jingle createSessionPing(FullJid recipient, String sessionId) { Jingle.Builder jb = Jingle.getBuilder(); jb.setSessionId(sessionId) .setAction(JingleAction.session_info); Jingle jingle = jb.build(); jingle.setFrom(connection.getUser()); jingle.setTo(recipient); return jingle; }
private void publishMood(MoodElement moodElement) throws SmackException.NotLoggedInException, InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException { if (pubSubManager == null) { pubSubManager = PubSubManager.getInstance(getAuthenticatedConnectionOrThrow(), connection().getUser().asBareJid()); } LeafNode node = pubSubManager.getOrCreateLeafNode(MOOD_NODE); node.publish(new PayloadItem<>(moodElement)); }
public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason reason) { Jingle.Builder jb = Jingle.getBuilder(); jb.setAction(JingleAction.session_terminate) .setSessionId(sessionId) .setReason(reason); Jingle jingle = jb.build(); jingle.setFrom(connection.getUser()); jingle.setTo(recipient); return jingle; }
public Jingle createSessionTerminateContentCancel(FullJid recipient, String sessionId, JingleContent.Creator contentCreator, String contentName) { Jingle.Builder jb = Jingle.getBuilder(); jb.setAction(JingleAction.session_terminate) .setSessionId(sessionId); JingleContent.Builder cb = JingleContent.getBuilder(); cb.setCreator(contentCreator).setName(contentName); Jingle jingle = jb.addJingleContent(cb.build()).build(); jingle.setFrom(connection.getUser()); jingle.setTo(recipient); return jingle; }
public Jingle createCandidateError(FullJid remote, FullJid initiator, String sessionId, JingleContent.Senders senders, JingleContent.Creator creator, String name, String streamId) { Jingle.Builder jb = Jingle.getBuilder(); jb.setSessionId(sessionId).setInitiator(initiator).setAction(JingleAction.transport_info); JingleContent.Builder cb = JingleContent.getBuilder(); cb.setName(name).setCreator(creator).setSenders(senders); JingleS5BTransport.Builder tb = JingleS5BTransport.getBuilder(); tb.setCandidateError().setStreamId(streamId); Jingle jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build(); jingle.setFrom(getConnection().getUser().asFullJidOrThrow()); jingle.setTo(remote); return jingle; }