Creating new Groupchat

in javadocs it says to create a chatroom like this:

GroupChat(XMPPConnection connection, String room)

(constructor for class Groupchat…)

in documentation it says to create it like this:

GroupChat newGroupChat = connection.createGroupChat("test@jivesoftware.com");

what’'s the difference?

then it says to join a chatroom thus:

newGroupChat.join(“jsmith”);

how do you tell WHOM this nickname belongs to?

if I have a JID, let’'s say, me@jabber.org how/when do I create nickname I will use to connect to room?

(do you HAVE to connect w/a nickname? can u connect to room w/JID?)

thank you…

first: groupchat is not used very much anymore so you might want to look into Multiuserchat. And for newGroupChat.join(“jsmith”) the nickname belongs to you as you are the one joining the group chat. If you look in the source XMPPConnection#createGroupChat delegates to that constructor, it just checks to make sure you are connected before hand.

thank you very much for yr response…

w/these two compiles fine:

// GroupChat newGroupChat = new GroupChat(conn, theRoom);

GroupChat newGroupChat = conn.createGroupChat(theRoom);

with these two won’'t compile:

// MultiUserChat newGroupChat = new MultiUserChat(conn, theRoom);

MultiUserChat newGroupChat = conn.createGroupChat(theRoom);

chat.java:100: cannot find symbol

symbol : class MultiUserChat

location: class chat

MultiUserChat newGroupChat = new MultiUserChat(conn, theRoom);

chat.java:101: cannot find symbol

symbol : class MultiUserChat

location: class chat

MultiUserChat newGroupChat = conn.createGroupChat(theRoom);

again, thank you very much…

MultiUserChat is not GroupChat. So instead of:

MultiUserChat newGroupChat = conn.createGroupChat(theRoom);

/code

use:

MultiUserChat newGroupChat = new MultiUserChat(conn, theRoom);

/code

ahhh… this is one of the two that isn’'t compiling…

MultiUserChat newGroupChat = new MultiUserChat(conn, theRoom);

chat.java:101: cannot find symbol

symbol : class MultiUserChat

location: class chat

MultiUserChat newGroupChat = new MultiUserChat(conn, theRoom);

^

chat.java:101: cannot find symbol

symbol : class MultiUserChat

location: class chat

MultiUserChat newGroupChat = new MultiUserChat(conn, theRoom);

^

however, I’'m fine w/GroupChat if it works… (is this ok?)

// GroupChat newGroupChat = new GroupChat(conn, theRoom);

GroupChat newGroupChat = conn.createGroupChat(theRoom);

// no problem with either one of these…

again, thank you very much…

GroupChat works, but MultiUserChat is better. It also depends on your server, whether it supports one - the other- or both. MultiUserChat may not be working if you don’'t have the smackx library on your class path.

again, thank you very much for yr response… so why won’'t my stuff compile if I use MultiUserChat?

it says “can’'t find symbol”… this is odd…

this is my situation:

this will not be yr usual situation where you have yr client on yr machine and you’'re the only user connecting thru that client…

there will be tons of JID’'s, tons of chatrooms, all generated/created dynamically… (need to use threads? – yikes! have never done threads…)

also I need to be able to refer to a room, once it’'s been created, by its name, not just the obj… what I mean:

newGroupChat = conn.createGroupChat(roomName);

to connect I would like to be able to do:

roomName.join(nickname); // instead of

newGroupChat.join(nickname);

to make sure user is connecting to right room…

also, can you connect to a room w/JID? or does it HAVE to be a nickname?

(also need to find a way to make sure nickname corresponds to right JID… if can’'t connect to room w/JID…)

again, thank you very much… I appreciate any help I can get…

the reason you cannot connect to the room as a JID is because you are using smack as whatever user you are signed in as. In other words if I sign in as awenckus, awenckus is my userID throughout the session. You can setup a map, mapping room names to rooms, if you need to randomly access rooms. Otherwise, if you just need to do things with them iterativly you can just setup a list. Im not sure what can’'t find symbol means, do you see smackx.jar in your class path?

sort of as an ammendium to that: if you are looking to join different chat rooms, with different user ids you will need to setup a connection for each jid.

again, thank you very much for all your help… I have applet and all three packages in same dir… I import packages…

I had just this:

import org.jivesoftware.smack.*;

I just added this

import org.jivesoftware.smackx.*;

but it still gives me ‘‘cannot find symbol’’ for MultiUserChat…

??? again, thank you so much…

I am not at all familiar with applets so we can hope someone else knowledgable will respond.

ok got it… had to import

smackx.muc.; (import org.jivesoftware.smackx.muc.:wink:

wonder how many other packages I’'m not importing that I should import…

(wonder why not everything is in one package… but what do I know…:wink:

again, thank you very much…