package com.gss.gmo.cao.integration.xmpp.component.core;

import org.xmpp.component.AbstractComponent;
import org.xmpp.packet.Message;

/**
 * @author linus_chien
 *
 */
public class GlobalComponent extends AbstractComponent {

	private String name;
	private String description;

	private MessageListener messageListener;

	public GlobalComponent(String name, String description) {
		super();
		this.name = name;
		this.description = description;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public String getDescription() {
		return description;
	}

	public void setMessageListener(MessageListener messageListener) {
		this.messageListener = messageListener;
	}

	@Override
	protected void handleMessage(Message message) {
		if (messageListener != null) {
			messageListener.handleMessage(message);
		}
	}

}

@@ -131,16 +131,50 @@
 essage;%0D
+%0Aimport org.xmpp.packet.Presence;%0D
 %0A%0D%0A/**%0D%0A
@@ -363,16 +363,61 @@
 stener;%0D
+%0A%09private PresenceListener presenceListener;%0D
 %0A%0D%0A%09publ
@@ -792,32 +792,154 @@
 istener;%0D%0A%09%7D%0D%0A%0D%0A
+%09public void setPresenceListener(PresenceListener presenceListener) %7B%0D%0A%09%09this.presenceListener = presenceListener;%0D%0A%09%7D%0D%0A%0D%0A
 %09@Override%0D%0A%09pro
@@ -1073,11 +1073,169 @@
 %0D%0A%09%7D%0D%0A%0D%0A
+%09@Override%0D%0A%09protected void handlePresence(Presence presence) %7B%0D%0A%09%09if (presenceListener != null) %7B%0D%0A%09%09%09presenceListener.handlePresence(presence);%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A
 %7D%0D%0A

add presenceListener field