Создавать группы на сервере XMPP

Я создаю приложение чата с использованием xmpp / openfire и хочу создавать группы на сервере, к которым любой на сервере может присоединиться.

Кто-нибудь, пожалуйста, помогите мне в том же.


person Gaurav Arora    schedule 28.11.2012    source источник


Ответы (3)


Таким образом вы можете создать группу на сервере Xmpp

            SmackAndroid.init(SelectMembers.this);
            MultiUserChat muc = new MultiUserChat(xconnection, GroupName
                    + "@conference.fonechat.in");
            muc.create(my_number);
            setConfig(muc);
            muc = new MultiUserChat(xconnection, GroupName + "@conference.serverid");
            muc.join(my_number);
            for (int i = 0; i < name.size(); i++) {
                muc.invite(phone.get(i).toString() + "@fonechat.in",
                        "Meet me in this excellent room");

// Функция SetConfig

    private void setConfig(MultiUserChat multiUserChat) {

    try {
        Form form = multiUserChat.getConfigurationForm();
        Form submitForm = form.createAnswerForm();
        for (Iterator<FormField> fields = submitForm.getFields(); fields
                .hasNext();) {
            FormField field = (FormField) fields.next();
            if (!FormField.TYPE_HIDDEN.equals(field.getType())
                    && field.getVariable() != null) {
                submitForm.setDefaultAnswer(field.getVariable());
            }
        }
        submitForm.setAnswer("muc#roomconfig_publicroom", true);
        submitForm.setAnswer("muc#roomconfig_persistentroom", true);
        multiUserChat.sendConfigurationForm(submitForm);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
person saurabh dixit    schedule 07.04.2015

Попробуйте создать постоянный многопользовательский чат (MUC: http://xmpp.org/extensions/xep-0045.html) для каждой группы. Вы сможете отправить сообщение всем в группе, что очень полезно.

person Joe Hildebrand    schedule 09.12.2012

Попробуйте QuickBlox.com, у них тоже есть образец программы ..

person Jashan PJ    schedule 16.04.2013