添加参与者XMPP聊天室参与者、聊天室、XMPP

2023-09-07 16:23:59 作者:Nostalgia 留恋

我要实现群聊在我的应用程序,用于这一目的,我使用MUC聊天室实现相同的。

在这里我要添加成员的名单(我有JID的)房间。我想在内部将它们添加到列表中的所有成员。如何添加他们没有邀请他们。

和加入成员后,我希望实现的功能,每当聊天室的消息的用户或聊天,应该被传递到的所有其他用户

的主要问题是如何将成员添加到聊天室

code:

 私人无效createRoom(){        MultiUserChat privateRoom =新MultiUserChat(连接testGroup@conference.abc.com);        尝试{            privateRoom.join(高拉夫,123456);            privateRoom.sendConfigurationForm(新表格(Form.TYPE_SUBMIT));            的System.out.println(空间中创建的!!!);            消息消息=新的消息(testGroup@conference.abc.com,Message.Type.normal);            message.setBody(欢乐用户);            privateRoom.sendMessage(消息);        }赶上(XMPPException E){            // TODO自动生成catch块            e.printStackTrace();        }    } 

解决方案 除了名人和邀请码,Clubhouse 爆红还有哪些道理

XEP-0045 不包含其中客户端被强制地作出的聊天室的参加者的情况。虽然你可以发送邀请联系人(或者直接到用户,或通过MUC服务器),接触实际上并没有加入该聊天室,直到接触的客户端请求加入聊天室。

因此​​,将用户添加到聊天室没有邀请他们需要在用户的客户端的特殊支持。可能的话,客户可以修改自动接受来自受信任的联系人聊天室邀请。

I want to implement Group Chat in my application, for that purpose i am using MUC chat rooms to implement the same.

Here I want to add a list of members( i have the JID's) to the room. I want to add them internally to all the members in the list. How can i add them without inviting them.

And after adding the members i want to implement a functionality that whenever a user of the chat room messages or chat, it should be delivered to all the other users.

The main problem is how to add members to the chat room

code:

private void createRoom(){

        MultiUserChat privateRoom = new MultiUserChat(connection, "testGroup@conference.abc.com");
        try {
            privateRoom.join("gaurav","123456");
            privateRoom.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
            System.out.println("Room Created!!!");

            Message message = new Message("testGroup@conference.abc.com", Message.Type.normal);
            message.setBody("Happy User");

            privateRoom.sendMessage(message);



        } catch (XMPPException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

解决方案

XEP-0045 doesn't contain a scenario where a client is forcibly made a participant of a chat room. While you can send an invite to a contact (either directly to the user, or through the MUC server), the contact doesn't actually join the chat room until the contact's client requests to join the room.

Thus, adding a user to a chat room without inviting them requires special support in the user's client. Possibly, the client could be modified to automatically accept chat room invites from trusted contacts.