Java Code Examples for org.jivesoftware.smackx.bookmarks.BookmarkedConference#getJid()

The following examples show how to use org.jivesoftware.smackx.bookmarks.BookmarkedConference#getJid() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConferenceRoomBrowser.java    From Spark with Apache License 2.0 5 votes vote down vote up
/**
    * Returns true if the room specified is bookmarked.
    *
    * @param roomJID
    *            the jid of the room to check.
    * @return true if the room is bookmarked.
    */
   private boolean isBookmarked(EntityBareJid roomJID) {
for (Object o : conferences.getBookmarks()) {
    BookmarkedConference bk = (BookmarkedConference) o;
    EntityBareJid jid = bk.getJid();
    if (jid != null && roomJID.equals(jid)) {
	return true;
    }
}

return false;

   }
 
Example 2
Source File: BookmarksUI.java    From Spark with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the current bookmarks used with this account.
 *
 * @param bookmarks the current bookmarks used with this account.
 */
public void setBookmarks(Collection<BookmarkedConference> bookmarks) {

    for (BookmarkedConference bookmark : bookmarks) {
        DomainBareJid serviceName = bookmark.getJid().asDomainBareJid();
        EntityBareJid roomJID = bookmark.getJid();
        Localpart roomName = roomJID.getLocalpart();

        if (bookmark.isAutoJoin()) {
            ConferenceUtils.joinConferenceOnSeperateThread(roomName, bookmark.getJid(), bookmark.getPassword());
            ConferenceUtils.addUnclosableChatRoom(roomJID);
            autoJoinRooms.add(bookmark.getJid());
        }

        // Get Service Node
        TreePath path = tree.findByName(tree, new String[]{rootNode.getUserObject().toString(), serviceName.toString()});
        JiveTreeNode serviceNode;
        if (path == null) {
            serviceNode = addServiceToList(serviceName);
            path = tree.findByName(tree, new String[]{rootNode.getUserObject().toString(), serviceName.toString()});
        }
        else {
            serviceNode = (JiveTreeNode)path.getLastPathComponent();
        }

        addBookmark(serviceNode, roomName.toString(), roomJID.toString());

        tree.expandPath(path);
    }
}