Reputation: 289
I am wondering how I would make multiple group chats using the aSmack library.
For example a user should be able to make more than one group chat each with different members.
I can create an MUC using the following code,
MultiUserChat muc = new MultiUserChat(connection, "[email protected]");
try {
muc.create("thing1");
muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
muc.invite("test1@localhost", "Join My Group");
muc.sendMessage("This is message one");
Log.d("XMPP","People: "+ muc.getParticipants().toString());
} catch (XMPPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Basically i want to create another group chat, with different members. Can that be done using the same room?
So far i have created another instance of MUC, and am keeping track of that. (This seems sloppy in my opinion, because what if there are 50 groups?).
But is that the right way to go?
Thanks.
Upvotes: 0
Views: 757
Reputation: 24083
Basically i want to create another group chat, with different members. Can that be done using the same room?
No, as you said you want to create another group chat. You can't handle multiple MUCs with the same MUC instance.
So far i have created another instance of MUC, and am keeping track of that. (This seems sloppy in my opinion, because what if there are 50 groups?).
Then you need to come up with a way to manage those 50 MUC instances, e.g. by using a HashMap.
Upvotes: 1