Project

General

Profile

MUC component: is there a way to get all of group-chat list I have joined ?

peirong jiang
Added over 3 years ago

MUC component: is there a way to get all of group-chat list I have joined ?

As it said in title。


Replies (6)

(1)

Added by Wojciech Kapcia TigaseTeam over 3 years ago

MUC specification doesn't cover such use-case and in general this should be tracked by the client upon joining/leaving rooms.

(1)

Added by peirong jiang over 3 years ago

is there a way to create a rest api to get all group-chat list?

I create a groovy script named "RoomHandler.groovy" in tigase-http-api component,but I can't get the mucRepository instance.

class RoomHandler extends tigase.http.rest.Handler {

    def mucRepository = (IMucRepository)mucRepository;
    public RoomHandler() {
        regex =  /\/(?:([^@\/]+)@){0,1}([^@\/]+)/
        requiredRole = "user"
        isAsync = false

        execGet = { Service service, callback, jid , localPart, domain ->
            def senderJID = localPart != null ? "$localPart@$domain" : domain;
            //IMucRepository  mucRepository= service.getMucRepository();
            if(null!=mucRepository){
                def rooms = mucRepository.getPublicVisibleRoomsIdList();
                callback([rooms:[items:rooms, count:rooms.size()]]);
            }else{
                callback([user:[jid:(localPart != null ? "$localPart@$domain" : domain)],msg:"MUC对象没有持久化!无法进行操作"]);
            }
        }
    }

}

how can i to make it work well?

(1)

Added by Wojciech Kapcia TigaseTeam over 3 years ago

You can create an admin ad-hoc scrip which is executed within context of MUC component, and you'll get access to mucReepository. Please check those scripts: https://projects.tigase.org/projects/tigase-muc/repository/revisions/master/show/src/main/groovy/muc/admin

(1)

Added by Moffitt tig about 3 years ago

Do you have a detailed point?Achieve this demand?

(1)

Added by Wojciech Kapcia TigaseTeam about 3 years ago

You can read existing Groovy/Java scripts. An overview of how those are handles is described in Component Implementation - Lesson 6 - Scripting Support

Added by Moffitt tig about 3 years ago

Through the HTTP form instantiation IMucRepository, the inside of the access method?

    (1-6/6)