// Path: src/org/onesocialweb/client/Inbox.java
// public interface Inbox {
// 	
// 	public ActivityEntry getEntry(String id);
// 	
// 	public List<ActivityEntry> getEntries();
// 	
// 	public void setEntries(List<ActivityEntry> entries);
// 	
// 	public void addEntry(ActivityEntry entry);
// 	
// 	public void removeEntry(ActivityEntry entry);
// 	
// 	public void updateEntry(ActivityEntry entry);
// 	
// 	public boolean refresh();
// 	
// 	public void registerInboxEventHandler(InboxEventHandler handler);
// 	
// 	public void unregisterInboxEventHandler(InboxEventHandler handler);
// 	
// 	public int getSize();
// 
// }
// 
// Path: src/org/onesocialweb/client/InboxEventHandler.java
// public interface InboxEventHandler {
// 
// 	public void onMessageReceived(ActivityEntry entry);
// 	
// 	public void onMessageDeleted(ActivityEntry entry);
// 	
// 	public void onMessageUpdated(ActivityEntry entry);
// 	
// 	public void onRefresh(List<ActivityEntry> activities);
// 	
// }
// 
// Path: src/org/onesocialweb/client/exception/AuthenticationRequired.java
// @SuppressWarnings("serial")
// public class AuthenticationRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/ConnectionRequired.java
// @SuppressWarnings("serial")
// public class ConnectionRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/RequestException.java
// @SuppressWarnings("serial")
// public class RequestException extends Exception {
// 
// 	public RequestException(String message) {
// 		super(message);
// 	}
// }


import java.util.ArrayList;
import java.util.List;
import org.onesocialweb.client.Inbox;
import org.onesocialweb.client.InboxEventHandler;
import org.onesocialweb.client.exception.AuthenticationRequired;
import org.onesocialweb.client.exception.ConnectionRequired;
import org.onesocialweb.client.exception.RequestException;
import org.onesocialweb.model.activity.ActivityEntry;
			entries.add(index, entry);
			entries.remove(previousActivity);
			notifyMessageUpdated(entry);
		}
	}

	@Override
	public void setEntries(List<ActivityEntry> entries) {
		this.entries = entries;
		notifyRefresh(entries);
	}
	
	private void notifyMessageReceived(ActivityEntry activity) {
		for (InboxEventHandler handler : handlers) {
			handler.onMessageReceived(activity);
		}
	}
	
	private void notifyMessageUpdated(ActivityEntry activity) {
		for (InboxEventHandler handler : handlers) {
			handler.onMessageUpdated(activity);
		}
	}	
	
	private void notifyMessageDeleted(ActivityEntry activity) {
		for (InboxEventHandler handler : handlers) {
			handler.onMessageDeleted(activity);
		}
	}
	
// Path: src/org/onesocialweb/client/Inbox.java
// public interface Inbox {
// 	
// 	public ActivityEntry getEntry(String id);
// 	
// 	public List<ActivityEntry> getEntries();
// 	
// 	public void setEntries(List<ActivityEntry> entries);
// 	
// 	public void addEntry(ActivityEntry entry);
// 	
// 	public void removeEntry(ActivityEntry entry);
// 	
// 	public void updateEntry(ActivityEntry entry);
// 	
// 	public boolean refresh();
// 	
// 	public void registerInboxEventHandler(InboxEventHandler handler);
// 	
// 	public void unregisterInboxEventHandler(InboxEventHandler handler);
// 	
// 	public int getSize();
// 
// }
// 
// Path: src/org/onesocialweb/client/InboxEventHandler.java
// public interface InboxEventHandler {
// 
// 	public void onMessageReceived(ActivityEntry entry);
// 	
// 	public void onMessageDeleted(ActivityEntry entry);
// 	
// 	public void onMessageUpdated(ActivityEntry entry);
// 	
// 	public void onRefresh(List<ActivityEntry> activities);
// 	
// }
// 
// Path: src/org/onesocialweb/client/exception/AuthenticationRequired.java
// @SuppressWarnings("serial")
// public class AuthenticationRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/ConnectionRequired.java
// @SuppressWarnings("serial")
// public class ConnectionRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/RequestException.java
// @SuppressWarnings("serial")
// public class RequestException extends Exception {
// 
// 	public RequestException(String message) {
// 		super(message);
// 	}
// }


// Path: src/org/onesocialweb/smack/InboxImp.java
import java.util.ArrayList;
import java.util.List;
import org.onesocialweb.client.Inbox;
import org.onesocialweb.client.InboxEventHandler;
import org.onesocialweb.client.exception.AuthenticationRequired;
import org.onesocialweb.client.exception.ConnectionRequired;
import org.onesocialweb.client.exception.RequestException;
import org.onesocialweb.model.activity.ActivityEntry;

			entries.add(index, entry);
			entries.remove(previousActivity);
			notifyMessageUpdated(entry);
		}
	}

	@Override
	public void setEntries(List<ActivityEntry> entries) {
		this.entries = entries;
		notifyRefresh(entries);
	}
	
	private void notifyMessageReceived(ActivityEntry activity) {
		for (InboxEventHandler handler : handlers) {
			handler.onMessageReceived(activity);
		}
	}
	
	private void notifyMessageUpdated(ActivityEntry activity) {
		for (InboxEventHandler handler : handlers) {
			handler.onMessageUpdated(activity);
		}
	}	
	
	private void notifyMessageDeleted(ActivityEntry activity) {
		for (InboxEventHandler handler : handlers) {
			handler.onMessageDeleted(activity);
		}
	}
	
	private void notifyRefresh(List<ActivityEntry> activities) {