当前位置: 首页>>代码示例>>Java>>正文


Java MultiUserChatService.getChatRoom方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.muc.MultiUserChatService.getChatRoom方法的典型用法代码示例。如果您正苦于以下问题:Java MultiUserChatService.getChatRoom方法的具体用法?Java MultiUserChatService.getChatRoom怎么用?Java MultiUserChatService.getChatRoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.muc.MultiUserChatService的用法示例。


在下文中一共展示了MultiUserChatService.getChatRoom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRoom

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入方法依赖的package包/类
public LocalMUCRoom getRoom() {
    MultiUserChatService mucService = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(subdomain);
    if (mucService == null) {
        throw new IllegalArgumentException("MUC service not found for subdomain: "+subdomain);
    }
    LocalMUCRoom room = (LocalMUCRoom) mucService.getChatRoom(roomName);
    if (room == null) {
        throw new IllegalArgumentException("Room not found: " + roomName);
    }
    return room;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:12,代码来源:MUCRoomTask.java

示例2: isRoomOwner

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入方法依赖的package包/类
private boolean isRoomOwner(JID roomJID, JID user) {
    if (user == null || roomJID == null) {
        return false;
    }
    MultiUserChatService chatService =
            XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(roomJID);
    MUCRoom room = chatService.getChatRoom(roomJID.getNode());
    return room != null && room.getOwners().contains(user.toBareJID());
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:10,代码来源:ClearspaceMUCTranscriptManager.java

示例3: execute

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入方法依赖的package包/类
@Override
public void execute(SessionData sessionData, Element command) {
    Element note = command.addElement("note");
    Collection<JID> admins = XMPPServer.getInstance().getAdmins();
    if (admins.size() <= 0) {
        note.addAttribute("type", "error");
        note.setText("Server needs admin user to be able to create rooms.");
        return;
    }
    Map<String, List<String>> data = sessionData.getData();

    // Let's find the requested MUC service to create the room in
    String servicehostname = get(data, "servicename", 0);
    if (servicehostname == null) {
        note.addAttribute("type", "error");
        note.setText("Service name must be specified.");
        return;
    }
    // Remove the server's domain name from the passed hostname
    String servicename = servicehostname.replace("."+XMPPServer.getInstance().getServerInfo().getXMPPDomain(), "");
    MultiUserChatService mucService;
    mucService = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(servicename);
    if (mucService == null) {
        note.addAttribute("type", "error");
        note.setText("Invalid service name specified.");
        return;
    }
    if (!mucService.isServiceEnabled()) {
        note.addAttribute("type", "error");
        note.setText("Multi user chat is disabled for specified service.");
        return;
    }
    // Let's create the jid and check that they are a local user
    String roomname = get(data, "roomname", 0);
    if (roomname == null) {
        note.addAttribute("type", "error");
        note.setText("Room name must be specified.");
        return;
    }
    JID admin = admins.iterator().next();
    MUCRoom room;
    try {
        room = mucService.getChatRoom(roomname, admin);
    }
    catch (NotAllowedException e) {
        note.addAttribute("type", "error");
        note.setText("No permission to create rooms.");
        return;
    }

    boolean isPersistent = "1".equals(get(data, "persistent", 0));
    room.setPersistent(isPersistent);

    boolean isPublic = "1".equals(get(data, "public", 0));
    room.setPublicRoom(isPublic);

    String password = get(data, "password", 0);
    if (password != null) {
        room.setPassword(password);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:62,代码来源:CreateMUCRoom.java

示例4: execute

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入方法依赖的package包/类
@Override
public void execute(SessionData sessionData, Element command) {
       Element note = command.addElement("note");
       Collection<JID> admins = XMPPServer.getInstance().getAdmins();
       if (admins.size() <= 0) {
           note.addAttribute("type", "error");
           note.setText("Server needs admin user to be able to create rooms.");
           return;
       }
       Map<String, List<String>> data = sessionData.getData();

       // Let's find the requested MUC service to create the room in
       String servicehostname = get(data, "servicename", 0);
       if (servicehostname == null) {
           note.addAttribute("type", "error");
           note.setText("Service name must be specified.");
           return;
       }
       // Remove the server's domain name from the passed hostname
       String servicename = servicehostname.replace("."+XMPPServer.getInstance().getServerInfo().getXMPPDomain(), "");
       MultiUserChatService mucService;
       mucService = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(servicename);
       if (mucService == null) {
           note.addAttribute("type", "error");
           note.setText("Invalid service name specified.");
           return;
       }
       if (!mucService.isServiceEnabled()) {
           note.addAttribute("type", "error");
           note.setText("Multi user chat is disabled for specified service.");
           return;
       }
       // Let's create the jid and check that they are a local user
       String roomname = get(data, "roomname", 0);
       if (roomname == null) {
           note.addAttribute("type", "error");
           note.setText("Room name must be specified.");
           return;
       }
       JID admin = admins.iterator().next();
       MUCRoom room;
       try {
           room = mucService.getChatRoom(roomname, admin);
       }
       catch (NotAllowedException e) {
           note.addAttribute("type", "error");
           note.setText("No permission to create rooms.");
           return;
       }

       boolean isPersistent = "1".equals(get(data, "persistent", 0));
       room.setPersistent(isPersistent);

       boolean isPublic = "1".equals(get(data, "public", 0));
       room.setPublicRoom(isPublic);

       String password = get(data, "password", 0);
       if (password != null) {
           room.setPassword(password);
       }
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:62,代码来源:CreateMUCRoom.java


注:本文中的org.jivesoftware.openfire.muc.MultiUserChatService.getChatRoom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。