Thanks Matt! Seems to work!
I have also got started with some code found on this site!
I seem to be having a problem in creating a sendMessage through the command line. What I want to do is send a Message to a user through the command line. So any text that is typed on the command line will be attached and sent to another Jabber ID. At the moment I have this code that listens to the replys. I have put a test message inside the class that sends a message but I want for the user to type there own messages.
Please Help.
Thanks
Dilip
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.filter.*;
public class JabberClient extends Thread implements PacketListener {
public static void main(String [] args) throws Exception {
XMPPConnection connection = new XMPPConnection(“localhost”);
connection.login(“pateldw”, “intel1”);
Chat newChat = connection.createChat(“dilip1@localhost”);
newChat.sendMessage(“This is a Test”);
PacketFilter filter = new PacketTypeFilter(Message.class);
JabberClient listener = new JabberClient();
listener.start();
connection.addPacketListener(listener, filter);
}
public void processPacket(Packet packet) {
Message message = (Message)packet;
System.out.println("From: " + packet.getFrom());
System.out.println("Body: " + message.getBody());
System.out.println("----
");
}
public void run() {
while (true) {
try {
Thread.sleep(10);
}
catch (Exception e) { }
}
}
}