Hi, I’‘m trying to figure out how to create some XMPPConnections and join the together in a chat. My program has no user interface, so I don’'t think I need the many features of multiuser chat, but if it is easier, then never mind.
I create two connections and log them in:
conn1.login(username1", “-”);
conn2.login(username2", “-”);[/code]
Then I’'ve tried to do something like:
conn2.addPacketListener(this, null);
GroupChat c = conn1.createGroupChat(“myroom”);
c.join(username1);
inviteToChat (conn2, c, username2);[/code]
In which the invitetochat method is something I’'ve found in this forum:
private void inviteToChat (XMPPConnection conn, GroupChat chat, final String participant) {
final String user = conn.getUser();
final String host = conn.getHost();
final String room = chat.getRoom();
final String service = conn.getServiceName();
Packet invite = new Packet() {
public String toXML() {
return “<message from=’’“user”@“host”’’ to=’’“participant”’’>” +
“Chat invitation.” +
“<x jid=’’“room”@“service”’’ xmlns=’‘jabber:x:conference’’/>” +
“”;
}
};
conn.sendPacket(invite);
}[/code]
conn2 also get a package, that when i do toXML() on it writes something about “Chat invitation”, but how do I join the chat?[/b]