package com.bluesky.visualprogramming.protocol.xmpp;

import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

public class Test {
	public static void main(String[] args) {
		// Create XMPP connection to gmail.com server
		//XMPPConnection connection = new XMPPConnection("gmail.com");
		XMPPConnection connection = new XMPPConnection("jabber.me");

		try {
			// Connect
			connection.connect();

			// Login with appropriate credentials
			//connection.login("jackding", "HTpw1234b");
			//connection.login("jackhatedance", "2085764");
			connection.login("jackhatedance", "HTpw1234");
			
			// Get the user's roster
			Roster roster = connection.getRoster();

			// Print the number of contacts
			System.out.println("Number of contacts: " + roster.getEntryCount());

			// Enumerate all contacts in the user's roster
			for (RosterEntry entry : roster.getEntries()) {
				System.out.println("User: " + entry.getUser());
			}
		} catch (XMPPException e) {
			// Do something better than this!
			e.printStackTrace();
		}
	}
}

@@ -286,121 +286,9 @@
 ) %7B%0A
-%09%09// Create XMPP connection to gmail.com server%0A%09%09//XMPPConnection connection = new XMPPConnection(%22gmail.com%22);
 %0A
+
 %09%09XM
@@ -440,107 +440,8 @@
 als%0A
-%09%09%09//connection.login(%22jackding%22, %22HTpw1234b%22);%0A%09%09%09//connection.login(%22jackhatedance%22, %222085764%22);%0A
 %09%09%09c
@@ -486,19 +486,16 @@
 1234%22);%0A
-%09%09%09
 %0A%09%09%09// G
@@ -916,16 +916,58 @@
 race();%0A
+%09%09%7D finally %7B%0A%09%09%09connection.disconnect();%0A
 %09%09%7D%0A%09%7D%0A%7D

test xmpp