• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MultiUserChatService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
@Override
public void run() {
    rooms = new ArrayList<>();
    // Get all services that have local occupants and include them in the reply
    for (MultiUserChatService mucService : XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServices()) {
        // Get rooms that have local occupants and include them in the reply
        for (MUCRoom room : mucService.getChatRooms()) {
            LocalMUCRoom localRoom = (LocalMUCRoom) room;
            Collection<MUCRole> localOccupants = new ArrayList<>();
            for (MUCRole occupant : room.getOccupants()) {
                if (occupant.isLocal()) {
                    localOccupants.add(occupant);
                }
            }
            if (!localOccupants.isEmpty()) {
                rooms.add(new RoomInfo(localRoom, localOccupants));
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:GetNewMemberRoomsRequest.java


示例2: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
@Override
public void run() {
    MultiUserChatService service = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(subdomain);
    if (service != null) {
        if (service instanceof MultiUserChatServiceImpl) {
            MUCPersistenceManager.refreshProperties(subdomain);
            ((MultiUserChatServiceImpl)service).initializeSettings();
        }
        else {
            // Ok.  We don't handle non default implementations for this.  Why are we seeing it?
        }
    }
    else {
        // Hrm.  We got an update for something that we don't have.
        Log.warn("ServiceUpdatedEvent: Received update for service we are not running: "+subdomain);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:18,代码来源:ServiceUpdatedEvent.java


示例3: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public void run() {
    rooms = new ArrayList<RoomInfo>();
    // Get all services that have local occupants and include them in the reply
    for (MultiUserChatService mucService : XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServices()) {
        // Get rooms that have local occupants and include them in the reply
        for (MUCRoom room : mucService.getChatRooms()) {
            LocalMUCRoom localRoom = (LocalMUCRoom) room;
            Collection<MUCRole> localOccupants = new ArrayList<MUCRole>();
            for (MUCRole occupant : room.getOccupants()) {
                if (occupant.isLocal()) {
                    localOccupants.add(occupant);
                }
            }
            if (!localOccupants.isEmpty()) {
                rooms.add(new RoomInfo(localRoom, localOccupants));
            }
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:20,代码来源:GetNewMemberRoomsRequest.java


示例4: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public void run() {
    MultiUserChatService service = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(subdomain);
    if (service != null) {
        if (service instanceof MultiUserChatServiceImpl) {
            MUCPersistenceManager.refreshProperties(subdomain);
            ((MultiUserChatServiceImpl)service).initializeSettings();
        }
        else {
            // Ok.  We don't handle non default implementations for this.  Why are we seeing it?
        }
    }
    else {
        // Hrm.  We got an update for something that we don't have.
        Log.warn("ServiceUpdatedEvent: Received update for service we are not running: "+subdomain);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:17,代码来源:ServiceUpdatedEvent.java


示例5: LocalMUCRole

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
/**
 * Create a new role.
 * 
 * @param chatserver the server hosting the role.
 * @param chatroom the room the role is valid in.
 * @param nickname the nickname of the user in the role.
 * @param role the role of the user in the room.
 * @param affiliation the affiliation of the user in the room.
 * @param chatuser the user on the chat server.
 * @param presence the presence sent by the user to join the room.
 * @param packetRouter the packet router for sending messages from this role.
 */
public LocalMUCRole(MultiUserChatService chatserver, LocalMUCRoom chatroom, String nickname,
        MUCRole.Role role, MUCRole.Affiliation affiliation, LocalMUCUser chatuser, Presence presence,
        PacketRouter packetRouter)
{
    this.room = chatroom;
    this.nick = nickname;
    this.user = chatuser;
    this.server = chatserver;
    this.router = packetRouter;
    this.role = role;
    this.affiliation = affiliation;
    // Cache the user's session (will only work for local users)
    this.session = XMPPServer.getInstance().getSessionManager().getSession(presence.getFrom());

    extendedInformation =
            DocumentHelper.createElement(QName.get("x", "http://jabber.org/protocol/muc#user"));
    calculateExtendedInformation();
    rJID = new JID(room.getName(), server.getServiceDomain(), nick);
    setPresence(presence);
    // Check if new occupant wants to be a deaf occupant
    Element element = presence.getElement()
            .element(QName.get("x", "http://jivesoftware.org/protocol/muc"));
    if (element != null) {
        voiceOnly = element.element("deaf-occupant") != null;
    }
    // Add the new role to the list of roles
    user.addRole(room.getName(), this);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:41,代码来源:LocalMUCRole.java


示例6: RemoteMUCRole

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public RemoteMUCRole(MultiUserChatService server, OccupantAddedEvent event) {
    this.serviceDomain = server.getServiceDomain();
    presence = event.getPresence();
    role = event.getRole();
    affiliation = event.getAffiliation();
    nickname = event.getNickname();
    voiceOnly = event.isVoiceOnly();
    roleAddress = event.getRoleAddress();
    userAddress = event.getUserAddress();
    room = event.getRoom();
    this.nodeID = event.getNodeID();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:13,代码来源:RemoteMUCRole.java


示例7: LocalMUCRoom

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
/**
 * Create a new chat room.
 *
 * @param chatservice the service hosting the room.
 * @param roomname the name of the room.
 * @param packetRouter the router for sending packets from the room.
 */
LocalMUCRoom(MultiUserChatService chatservice, String roomname, PacketRouter packetRouter) {
    this.mucService = chatservice;
    this.name = roomname;
    this.naturalLanguageName = roomname;
    this.description = roomname;
    this.router = packetRouter;
    this.startTime = System.currentTimeMillis();
    this.creationDate = new Date(startTime);
    this.modificationDate = new Date(startTime);
    this.emptyDate = new Date(startTime);
    this.canOccupantsChangeSubject = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canOccupantsChangeSubject", false);
    this.maxUsers = MUCPersistenceManager.getIntProperty(mucService.getServiceName(), "room.maxUsers", 30);
    this.publicRoom = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.publicRoom", true);
    this.persistent = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.persistent", false);
    this.moderated = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.moderated", false);
    this.membersOnly = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.membersOnly", false);
    this.canOccupantsInvite = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canOccupantsInvite", false);
    this.canAnyoneDiscoverJID = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canAnyoneDiscoverJID", true);
    this.logEnabled = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.logEnabled", false);
    this.loginRestrictedToNickname = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.loginRestrictedToNickname", false);
    this.canChangeNickname = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.canChangeNickname", true);
    this.registrationEnabled = MUCPersistenceManager.getBooleanProperty(mucService.getServiceName(), "room.registrationEnabled", true);
    // TODO Allow to set the history strategy from the configuration form?
    roomHistory = new MUCRoomHistory(this, new HistoryStrategy(mucService.getHistoryStrategy()));
    this.iqOwnerHandler = new IQOwnerHandler(this, packetRouter);
    this.iqAdminHandler = new IQAdminHandler(this, packetRouter);
    // No one can join the room except the room's owner
    this.lockedTime = startTime;
    // Set the default roles for which presence is broadcast
    rolesToBroadcastPresence.add("moderator");
    rolesToBroadcastPresence.add("participant");
    rolesToBroadcastPresence.add("visitor");
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:41,代码来源:LocalMUCRoom.java


示例8: 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


示例9: ServiceInfo

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public ServiceInfo(MultiUserChatService service) {
    this.subdomain = service.getServiceName();
    this.description = service.getDescription();
    this.isHidden = service.isHidden();
    rooms = new ArrayList<>();
    // Get rooms that have occupants and include them in the reply
    for (MUCRoom room : service.getChatRooms()) {
        LocalMUCRoom localRoom = (LocalMUCRoom) room;
        if (!room.getOccupants().isEmpty()) {
            rooms.add(new RoomInfo(localRoom, localRoom.getOccupants()));
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:14,代码来源:ServiceInfo.java


示例10: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
@Override
public void run() {
    services = new ArrayList<>();
    // Get all services and include them in the reply
    for (MultiUserChatService mucService : XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServices()) {
        services.add(new ServiceInfo(mucService));
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:9,代码来源:SeniorMemberServicesRequest.java


示例11: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
@Override
public void run() {
    count = 0;
    for (MultiUserChatService mucService : XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServices()) {
        count += mucService.getNumberConnectedUsers(true);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:8,代码来源:GetNumberConnectedUsers.java


示例12: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
@Override
public void run() {
    // If it's registered already, no need to create it.  Most likely this is because the service
    // is provided by an internal component that registered at startup.  This scenario, however,
    // should really never occur.
    if (!XMPPServer.getInstance().getMultiUserChatManager().isServiceRegistered(subdomain)) {
        MultiUserChatService service = new MultiUserChatServiceImpl(subdomain, description, isHidden);
        XMPPServer.getInstance().getMultiUserChatManager().registerMultiUserChatService(service);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:11,代码来源:ServiceAddedEvent.java


示例13: start

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public void start() {
    for (IQHandler iqHandler : iqHandlers) {
        try {
            iqHandler.initialize(server);
            iqHandler.start();
        } catch (Exception e) {
            Log.error("Unable to initialize and start "
                    + iqHandler.getClass());
            continue;
        }

        element2Handlers.put(iqHandler.getInfo().getName(), iqHandler);
        if (iqHandler instanceof ServerFeaturesProvider) {
            for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler)
                    .getFeatures(); i.hasNext();) {
                server.getIQDiscoInfoHandler().addServerFeature(i.next());
            }
        }
        if (muc) {
            MultiUserChatManager manager = server.getMultiUserChatManager();
            for (MultiUserChatService mucService : manager.getMultiUserChatServices()) {
                mucService.addIQHandler(iqHandler);
                mucService.addExtraFeature(namespace);
            }
        }
    }
    server.getIQDiscoInfoHandler().addServerFeature(namespace);
    server.getIQRouter().addHandler(iqDispatcher);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:30,代码来源:AbstractXepSupport.java


示例14: stop

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public void stop() {
    IQRouter iqRouter = server.getIQRouter();
    IQDiscoInfoHandler iqDiscoInfoHandler = server.getIQDiscoInfoHandler();

    for (IQHandler iqHandler : iqHandlers) {
        element2Handlers.remove(iqHandler.getInfo().getName());
        try {
            iqHandler.stop();
            iqHandler.destroy();
        } catch (Exception e) {
            Log.warn("Unable to stop and destroy " + iqHandler.getClass());
        }

        if (iqHandler instanceof ServerFeaturesProvider) {
            for (Iterator<String> i = ((ServerFeaturesProvider) iqHandler)
                    .getFeatures(); i.hasNext();) {
                if (iqDiscoInfoHandler != null) {
                    iqDiscoInfoHandler.removeServerFeature(i.next());
                }
            }
        }
        if (muc) {
            MultiUserChatManager manager = server.getMultiUserChatManager();
            for (MultiUserChatService mucService : manager.getMultiUserChatServices()) {
                mucService.removeIQHandler(iqHandler);
                mucService.removeExtraFeature(namespace);
            }
        }
    }
    if (iqRouter != null) {
        iqRouter.removeHandler(iqDispatcher);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:34,代码来源:AbstractXepSupport.java


示例15: ServiceInfo

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public ServiceInfo(MultiUserChatService service) {
    this.subdomain = service.getServiceName();
    this.description = service.getDescription();
    this.isHidden = service.isHidden();
    rooms = new ArrayList<RoomInfo>();
    // Get rooms that have occupants and include them in the reply
    for (MUCRoom room : service.getChatRooms()) {
        LocalMUCRoom localRoom = (LocalMUCRoom) room;
        if (!room.getOccupants().isEmpty()) {
            rooms.add(new RoomInfo(localRoom, localRoom.getOccupants()));
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:14,代码来源:ServiceInfo.java


示例16: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public void run() {
    services = new ArrayList<ServiceInfo>();
    // Get all services and include them in the reply
    for (MultiUserChatService mucService : XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServices()) {
        services.add(new ServiceInfo(mucService));
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:8,代码来源:SeniorMemberServicesRequest.java


示例17: run

import org.jivesoftware.openfire.muc.MultiUserChatService; //导入依赖的package包/类
public void run() {
    // If it's registered already, no need to create it.  Most likely this is because the service
    // is provided by an internal component that registered at startup.  This scenario, however,
    // should really never occur.
    if (!XMPPServer.getInstance().getMultiUserChatManager().isServiceRegistered(subdomain)) {
        MultiUserChatService service = new MultiUserChatServiceImpl(subdomain, description, isHidden);
        XMPPServer.getInstance().getMultiUserChatManager().registerMultiUserChatService(service);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:10,代码来源:ServiceAddedEvent.java


示例18: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Label类代码示例发布时间:2022-05-23
下一篇:
Java InterceptingHttpAccessor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap