Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ab84c1c645524f711dd70dad8497a083ee3fc221 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/******************************************************************************
 * Copyright (c) 2008 Versant Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Remy Chi Jian Suen (Versant Corporation) - initial API and implementation
 ******************************************************************************/
package org.eclipse.ecf.example.collab.share;

import org.eclipse.ecf.internal.example.collab.ui.LineChatClientView;
import org.eclipse.ecf.presence.roster.*;

/**
 * 
 * @since 2.0
 */
public class RosterListener implements IRosterListener {

	private final EclipseCollabSharedObject sharedObject;
	private final LineChatClientView view;

	RosterListener(EclipseCollabSharedObject sharedObject, LineChatClientView view) {
		this.sharedObject = sharedObject;
		this.view = view;
	}

	public void handleRosterEntryAdd(IRosterEntry entry) {
		boolean addUserResult = view.addUser(entry.getUser());
		// If addUserResult is false, it means that this is a new user
		// And we need to report our own existence to them
		if (addUserResult)
			sharedObject.sendNotifyUserAdded();
	}

	public void handleRosterEntryRemove(IRosterEntry entry) {
		view.removeUser(entry.getUser().getID());
	}

	public void handleRosterUpdate(IRoster roster, IRosterItem changedValue) {
		// unimplemented, update code has been removed at the moment
	}

}

Back to the top