My code does:
// Create a connection to the jabber.org server on a specific port.
ConnectionConfiguration config
= new ConnectionConfiguration(“jarmac.local”, 5222);
XMPPConnection conn2 = new XMPPConnection(config);
conn2.connect();
conn2.login(“Jim”, “JimRome”);
MultiUserChat muc2
= new MultiUserChat(conn2, “honeywell@conference.jarmac.local”);
muc2.join(“Jim”, “JimRome”);
// Discover information about the room roomName@conference.myserver
RoomInfo info = MultiUserChat.getRoomInfo(conn2, “honeywell@conference.jarmac.local”);
And it throws an exception when I try to get the roomInfo. The server says:
item-not-found(404)
But I have already joined the room, and it is listed in the directory of OpenFire. So why isn’t the server returning the roomInfo?
Your code for getting the room info looks correct to me. So I am wondering if the isn’t setup on the server correctly somehow. Did you call the MultiUserChat#create method at some point before running this code? If not, perhaps the room didn’t properly created, as you need to do that before you can join or query for it.
Chris
Thanks, Chris. But the code I posted was the totatality of my code. I set up the room in the Openfire server. Here is a cut and paste from the room setup:
Room Administration
Use the form below to edit the room settings.
||Room ID||Users||Created On||Last Modified||
honeywell
1 / 30\
Nov 17, 2007 11:03 AM
Nov 17, 2007 11:03 AM
Change the room settings of this room using the form below
Room Name:
Description:
Topic:
Maximum Room Occupants:
10
20
30
40
50
Unlimited
Broadcast Presence for:
Moderator
Participant
Visitor
Password Required to Enter:
Confirm Password:
Show Real JIDs of Occupants to:
Moderator
Anyone
|
Room Options
List Room in Directory
Make Room Moderated
Make Room Members-only
Allow Occupants to invite Others
Allow Occupants to change Subject
Only login with registered nickname
Allow Occupants to change nicknames
Allow Users to register with the room
Log Room Conversations
|
|
List room in directory was checked, as was broadcast presence for everyone, and allow users to change nicks and to register with the room.
Okay, I had never tried creating the room using the admin console, but it seems to work for me. The only differences I can see are that I am displaying a list of all available rooms in my client, so I call MultiUserChat#getHostedRooms first and then iterate over each room making the call to MultiUserChat#getRoomInfo. The other difference is that I don’t join the room first. The docs say the method is useful for getting info about a room before joining it, but I don’t know why joining it would prevent you from then getting the room info. I don’t have any other ideas though.
Chris
I think that you should also “create” the room and send the configuration form. For example this test case works:
public void testCreateInstantRoom() {
MultiUserChat muc = new MultiUserChat(getConnection(0), room); try {
// Create the room
muc.create("testbot"); // Send an empty room configuration form which indicates that we want
// an instant room
muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT)); // Get the RoomInfo
RoomInfo info = MultiUserChat.getRoomInfo(getConnection(0), room);
assertNotNull(info); // Destroy the new room
muc.destroy("The room has almost no activity...", null);
}
catch (XMPPException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
I need to create the room using the server because it is a permanent room used for transferring fire alarms.
Hmmm. Iterating worked. and I got the same jid “honeywell@conference.jarmac.local” as I did without iterating. Must strange. Or it could have been that the Openfire server needed a restart.
Thanks,
Jim