From 67f3a526d5b5e4b448331ac4282116780ad7bdc6 Mon Sep 17 00:00:00 2001
From: Carl Worth <cworth@cworth.org>
Date: Wed, 19 Mar 2008 17:05:34 -0700
Subject: [PATCH 1/1] Initial import (simple test of smack basics)

---
 Loa.java | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Loa.java

diff --git a/Loa.java b/Loa.java
new file mode 100644
index 0000000..ed29824
--- /dev/null
+++ b/Loa.java
@@ -0,0 +1,63 @@
+/* Compile:
+ *
+ *	javac -classpath ./smack_3_0_4/smack.jar Loa.java
+ *
+ * Run:
+ *
+ *	java -classpath .:./smack_3_0_4/smack.jar:./smack_3_0_4/smackx.jar Loa
+ */
+
+import org.jivesoftware.smack.*;
+import org.jivesoftware.smack.packet.*;
+
+/**
+ * Loa: A Java implementation of Lines of Action (eventually, anyway)
+ * 
+ * @author Carl Worth
+ */
+public class Loa
+{
+    public static void main(String[] args) {
+	ConnectionConfiguration config;
+	XMPPConnection conn;
+	ChatManager chat_manager;
+	Chat chat;
+
+	config = new ConnectionConfiguration ("jabber.friendlygames.org", 5222);
+	conn = new XMPPConnection(config);
+
+	try {
+	    conn.connect();
+	} catch (XMPPException e) {
+	    System.out.println ("connect() failed");
+	}
+
+	try {
+	    conn.login ("test", "19zulu.");
+	} catch (XMPPException e) {
+	    System.out.println ("login() failed");
+	}
+
+	try {
+	    chat_manager = conn.getChatManager();
+	    chat = chat_manager.createChat("cworth@jabber.friendlygames.org",
+	           new MessageListener() {
+		       public void processMessage (Chat chat, Message message) {
+			   System.out.println ("Received message: " + message);
+		       }
+		   });
+
+	    chat.sendMessage ("Hello, from smack.");
+	} catch (XMPPException e) {
+	    System.out.println ("sendMessage() failed");
+	}
+
+	while (true) {
+	    Long one_second = 1000L;
+	    try {
+		Thread.sleep (one_second);
+	    } catch (InterruptedException e) {
+	    }
+	}
+    }
+}
-- 
2.45.2