muc : setup auto-join option
authorVincent V. <marseille@beem-project.com>
Sun, 08 Jan 2012 12:08:22 +0100
changeset 927 039fe4e3534f
parent 926 7c079b0f146a
child 928 008566b90ba8
muc : setup auto-join option
src/com/beem/project/beem/BeemService.java
--- a/src/com/beem/project/beem/BeemService.java	Thu Jan 05 23:26:33 2012 +0100
+++ b/src/com/beem/project/beem/BeemService.java	Sun Jan 08 12:08:22 2012 +0100
@@ -566,26 +566,28 @@
 
 	    }
 	}
+	//Bookmark : Muc 
 	if (mConnection.containsKey(accountName)) {
 	    Connection xmppCo = mConnection.get(accountName).getAdaptee();
 	    Collection<BookmarkedConference> list = null;
-	    try {		
+	    try {
 		BookmarkManager bm = BookmarkManager.getBookmarkManager(xmppCo);
 		list = bm.getBookmarkedConferences();
 	    } catch (XMPPException e) {
 		Log.e(TAG, "BookmarkManager", e);
 	    }
 	    for (BookmarkedConference bookmarkedConference : list) {
-		Log.e("TAG + BOOKMARK", bookmarkedConference.getName());
-		// Create a MultiUserChat using a Connection for a room
-		MultiUserChat muc2 = new MultiUserChat(xmppCo, bookmarkedConference.getJid());
+		if (bookmarkedConference.isAutoJoin()) {
+		    MultiUserChat muc2 = new MultiUserChat(xmppCo, bookmarkedConference.getJid());
 
-		DiscussionHistory history = new DiscussionHistory();
-		history.setMaxStanzas(5);
-		try {
-		    muc2.join(bookmarkedConference.getNickname(), bookmarkedConference.getPassword(), history, SmackConfiguration.getPacketReplyTimeout());
-		} catch (XMPPException e) {
-		    Log.e(TAG, "MUC Join Problem", e);
+		    DiscussionHistory history = new DiscussionHistory();
+		    history.setMaxStanzas(5);
+		    try {
+			muc2.join(bookmarkedConference.getNickname(), bookmarkedConference.getPassword(), history,
+			    SmackConfiguration.getPacketReplyTimeout());
+		    } catch (XMPPException e) {
+			Log.e(TAG, "MUC Join Problem", e);
+		    }
 		}
 	    }
 	}