public void joinConference(String room) {
MultiUserChat muc = new MultiUserChat(connection, room);
try {
muc.join(chatRoom);
myChatRooms.add(muc);
PacketListener myListener = new PacketListener() {
@Override
public void processPacket(Packet packet) {
//System.out.println("\nIN:" + chatRoom);
//System.out.println("PacketClass:" + packet.getClass());
//System.out.println("PacketProperties:"
//+ packet.getPropertyNames());
//System.out.println("PacketData:" + packet.toXML());
if (packet.getClass().toString().equalsIgnoreCase(
"class org.jivesoftware.smack.packet.Message")) {
Message m = (Message) packet;
if (m.getBody() != null) {
System.out.println("Body is " + m.getBody());
DelayInformation inf = null;
try {
inf = (DelayInformation) packet.getExtension(
"x", "jabber:x:delay");
// get offline message timestamp
String[] username = m.getFrom().split("/");
String t[] = username[0].split("@");
System.out.println("Room:" + t[0] + ",msg:" + m.getBody() + ",User:" + username[1]);
sendToConfPage(t[0], m.getBody(), username[1], t[1]);
} catch (Exception e) {
// log.error(e);
e.printStackTrace();
}
}
}
}
};
muc.addMessageListener(myListener);
PacketListener peopleListener = new PacketListener() {
@Override
public void processPacket(Packet packet) {
//System.out.println("People PacketData:" + packet.toXML());
if (packet.getClass().toString().equalsIgnoreCase(