/** * Leave the chat room. * * @return the leave presence as reflected by the MUC. * @throws NotConnectedException * @throws InterruptedException * @throws XMPPErrorException * @throws NoResponseException * @throws MucNotJoinedException * @deprecated use {@link #leave()} instead. */ @Deprecated // TODO: Remove in Smack 4.5. public synchronized Presence leaveSync() throws NotConnectedException, InterruptedException, MucNotJoinedException, NoResponseException, XMPPErrorException { return leave(); }
@SmackIntegrationTest public void mucJoinLeaveTest() throws XmppStringprepException, NotAMucServiceException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, MucNotJoinedException { EntityBareJid mucAddress = JidCreate.entityBareFrom(Localpart.from("smack-inttest-join-leave-" + randomString), mucService.getDomain()); MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress); muc.join(Resourcepart.from("nick-one")); Presence reflectedLeavePresence = muc.leave(); MUCUser mucUser = MUCUser.from(reflectedLeavePresence); assertNotNull(mucUser); assertTrue(mucUser.getStatus().contains(MUCUser.Status.PRESENCE_TO_SELF_110)); }
@SmackIntegrationTest public void testMucBookmarksAutojoin(XMPPTCPConnection connection) throws InterruptedException, TestNotPossibleException, XMPPException, SmackException, IOException { final BookmarkManager bookmarkManager = BookmarkManager.getBookmarkManager(connection); if (!bookmarkManager.isSupported()) { throw new TestNotPossibleException("Private data storage not supported"); } final MultiUserChatManager multiUserChatManager = MultiUserChatManager.getInstanceFor(connection); final Resourcepart mucNickname = Resourcepart.from("Nick-" + StringUtils.randomString(6)); final String randomMucName = StringUtils.randomString(6); final DomainBareJid mucComponent = multiUserChatManager.getMucServiceDomains().get(0); final MultiUserChat muc = multiUserChatManager.getMultiUserChat(JidCreate.entityBareFrom( Localpart.from(randomMucName), mucComponent)); MucCreateConfigFormHandle handle = muc.createOrJoin(mucNickname); if (handle != null) { handle.makeInstant(); } muc.leave(); bookmarkManager.addBookmarkedConference("Smack Inttest: " + testRunId, muc.getRoom(), true, mucNickname, null); connection.disconnect(); connection.connect().login(); // MucBookmarkAutojoinManager is also able to do its task automatically // after every login, it's not deterministic when this will be finished. // So we trigger it manually here. MucBookmarkAutojoinManager.getInstanceFor(connection).autojoinBookmarkedConferences(); assertTrue(muc.isJoined()); // If the test went well, leave the MUC muc.leave(); }
@Override protected void doDisconnect() { chat.leave(); }
for (MultiUserChat muc : getChats()) { try { muc.leave(); } catch (IllegalStateException ise) {
if(muc != null) muc.leave(); connection.disconnect();
leave(); throw new XMPPException("Creation failed - Missing acknowledge of room creation.");
muc.leave();
leave(); throw new XMPPException("Creation failed - Missing acknowledge of room creation.");
leave(); throw new XMPPException("Creation failed - Missing acknowledge of room creation.");
leave(); throw new XMPPException("Creation failed - Missing acknowledge of room creation.");