1. Invitation:
In a simple sentence, the jid of the invitee should be input during the invitation. The invitation information can be blank.
MUC. Invite (userjid, "let's chat ");
At the same time, we need to know what happened. When this statement is executed, a message will be sent to the server, as shown below:
<Message from = 'crone1 @ Shakespeare. logs/desktop 'To =' darkcave @ chat. shakespeare. comment '> <X xmlns = 'HTTP: // jabber.org/protocol/muc?user'> <invite to = 'hecate @ Shakespeare. comment '> <reason> come in and chat with our sister </reason> </invite> </x> </message>
2. Invited
If you are invited, you can enable a listener. If you want to enter the room, you can skip this step. If you have an invitation, you can directly enter the room. If you have a need, you can consider the following:
Multiuserchat. addinvitationlistener (constants. conn, new invitationlistener () {// corresponding parameter: connection, room jid, room name, included content, password, message @ overridepublic void invitationreceived (connection Conn, string room, string inviter, string reason, string password, message) {log. I (TAG, "received from" + inviter + "chat room invitation. Content included with the invitation: "+ reason); intent = new intent (mucservice. this, activitymultiroom. class); intent. setflags (intent. flag_activity_new_task); intent. putextra ("jid", room); intent. putextra ("action", "Join"); startactivity (intent );}});