// import the JSkype packages

import net.lamot.java.jskype.general.AbstractMessenger;
import net.lamot.java.jskype.general.MessageListenerInterface;
import net.lamot.java.jskype.windows.Messenger;
import java.lang.Thread;
import java.lang.Exception;

/** the MessageListenerInterface interface defines a method onMessageReceived suppose to be called when notifications are received from run-time Skype Client */
public class JSkypeTest implements MessageListenerInterface {
    
   // declare a messenger object to be used to send Skype commands
   private AbstractMessenger msgr = null;

    /** Creates a new instance of JSkypeTest */
    public JSkypeTest() {
        msgr = new Messenger();
        msgr.addListener(this);
        msgr.initialize();    
            try {
	  // pause 6 seconds to wait for the initialization of JSkype	
              Thread.sleep(6000);
	  // send the Skype API text command
              msgr.sendMessage("Message theptcompany hello from JSkypeTest" );
	}
	catch (Exception e) {
	        e.printStackTrace();
	}
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new JSkypeTest();
    }
    
     public void onMessageReceived(String str) {
	// we simply just print out if any notifications arrive through JSkype
            System.out.println(str);
    }
    
}
