powered by Jive Software

Would like sample code

I’'m using the smack lib to write a ‘‘bot’’. Actual human

users will invite this ‘‘bot’’ into group chat rooms. So

I need to be able to do 2 things: 1) receive invitations

from users to join group chats and 2). after accepting the

invitation by creating a GroupChat and joining, receive

messages sent to this chat by other users. I don’'t care if

I do this w/ the PacketCollector or PacketListener. But I’'d

like to see some sample code that is in addition to the

smack API and docs. I have the smack debugger turned on

but I’'m not getting invitations.

Hi mperry,

i belive you will find some answers in this thread:


As i understand your problem, you will need the Multi User Chat to receive a proper invitation. Because this invitation can include a room password, GroupChat can not help you anymore. But read the thread first!

P.S. The smack source code also includes the folder

test\org\jivesoftware\smackx with nice basic examples like

GroupChatInvitationTest.java. But I beliven you will need the MUC invitation.



If the room that you will be using does not support Multi User Chat (MUC) then you could use GroupChatInvitation to listen for group chat invitations and GroupChat to join the room. If your room does support MUC you could then use the new class MultiUserChat to join and listen for invitations.

As Joachim said, you could take a look at GroupChatInvitationTest to see a running example of group chat invitations. To learn how to use Multi User Chat in Smack you can take a look at MultiUserChatTest which provides some basic usage examples (we are still adding new functionalities to this class so we don’'t have yet a better tutorial document).


– Gato

Thank you for responding. As it turns out, I do not

want to receive and accept invitations to group chats,

but to create a new persistent room and then join

(or just join if the room exists). I followed the

MUC support thread, got the latest nighly build,

poked at the src for MUC support (in smackx), and

have Iian’'s book.

But how can I send the server an iq stanza with a

that includes a submit form which sets my own room config,

e.g., <field var=’‘muc#owner_persistentroom’’>

1 …

Thamks for any advice (or code snippet).

I think smack is way cool and want it to work for

my purpose and not search for alternative packages :