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


Java XmppSession类代码示例

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


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

示例1: findFirstMucDomain

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
/**
 * Returns the domain of the first XMPP MUC service available
 *
 * @return The first found MUC domain if any, else null
 */
private String findFirstMucDomain() {

    try {
        // Get the MUC extension manager
        final XmppSession session = pBot.getSession();
        final MultiUserChatManager mucManager = session
                .getExtensionManager(MultiUserChatManager.class);

        // Get the list of chat services
        final Collection<ChatService> chatServices = mucManager
                .getChatServices();

        // Use the first one available (same as Python side)
        return chatServices.iterator().next().getAddress().getDomain();

    } catch (final XmppException ex) {
        pLogger.log(LogService.LOG_ERROR,
                "Error looking for XMPP MUC chat services: " + ex);
    }

    return null;
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:28,代码来源:XmppTransport.java

示例2: onSessionStart

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
@Override
public void onSessionStart(final XmppSession aSession) {

    // Log our JID
    pLogger.log(LogService.LOG_INFO, "Bot connected with JID: "
            + pBot.getJid().asBareJid());

    // Get local peer information
    final Peer localPeer = pDirectory.getLocalPeer();
    final String appId = localPeer.getApplicationId();

    // Create/join rooms for each group
    final Set<String> allRooms = new LinkedHashSet<>();
    for (final String group : localPeer.getGroups()) {
        allRooms.add(appId + "--" + group);
    }
    allRooms.add(appId);

    // Wait to have joined all rooms before activating the service
    pLogger.log(LogService.LOG_DEBUG, "Creating XMPP rooms...");
    createRooms(allRooms, localPeer.getUid());
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:23,代码来源:XmppTransport.java

示例3: onSessionEnd

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
@Override
public void onSessionEnd(final XmppSession aSession) {

    // Clean up our access
    pDirectory.getLocalPeer().unsetAccess(IXmppConstants.ACCESS_ID);

    // Shut down the service
    pController = false;
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:10,代码来源:XmppTransport.java

示例4: RoomCreator

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
public RoomCreator(final XmppSession aSession, final LogService aLogger) {

        // Setup members
        pLogger = aLogger;
        pSession = aSession;

        // Find the MUC chat service
        findChatServices();
    }
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:10,代码来源:RoomCreator.java

示例5: isConnected

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
/**
 * Returns true if connection online and authenticated.
 * 
 * @return true or false.
 */
public boolean isConnected() {
	if (getXmppSession() != null && getXmppSession().getStatus() == XmppSession.Status.AUTHENTICATED) {
		return true;
	}
	return false;
}
 
开发者ID:Globility,项目名称:openlink-java,代码行数:12,代码来源:OpenlinkClient.java

示例6: ManageVoiceMessageHandler

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
public ManageVoiceMessageHandler(XmppSession xmppSession) {
	this.xmppSession = xmppSession;
}
 
开发者ID:Globility,项目名称:openlink-java,代码行数:4,代码来源:ManageVoiceMessageHandler.java

示例7: PrivateDataHandler

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
public PrivateDataHandler(XmppSession xmppSession) {
	this.xmppSession = xmppSession;
	this.privateDataManager = this.xmppSession.getExtensionManager(PrivateDataManager.class);
}
 
开发者ID:Globility,项目名称:openlink-java,代码行数:5,代码来源:PrivateDataHandler.java

示例8: getXmppSession

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
/**
 * Get XMPP (Babbler) connection object.
 */
public XmppSession getXmppSession() {
	return xmppSession;
}
 
开发者ID:Globility,项目名称:openlink-java,代码行数:7,代码来源:OpenlinkClient.java

示例9: setXmppSession

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
private void setXmppSession(XmppSession xmppSession) {
	this.xmppSession = xmppSession;
}
 
开发者ID:Globility,项目名称:openlink-java,代码行数:4,代码来源:OpenlinkClient.java

示例10: activate

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
public void activate(final Router router) throws XmppException, InterruptedException, SuspendExecution {

        // connect to xmpp

        XmppSessionConfiguration configuration = XmppSessionConfiguration.builder().build();

        xmppSession = new XmppSession("chat.hipchat.com", configuration);
        xmppSession.connect();
        xmppSession.login(username, password);
        xmppSession.send(new Presence());

        // join the rooms

        joinRooms(this.rooms);

        // send a welcome message

        joinedRooms.values().stream()
            .forEach(cr -> {
                String peeps = String.join(", ", cr.getOccupants().stream()
                    .filter(x -> !x.isSelf())
                    .map(Occupant::getNick)
                    .collect(Collectors.toList()));
                cr.sendMessage("Hey " + peeps);
            });

        log.info("Joined room(s) " + String.join(", ", joinedRooms.keySet()));

        // reconnect listener

        xmppSession.addSessionStatusListener(e -> {

            if (e.getStatus() == XmppSession.Status.AUTHENTICATED) {

                try {
                    joinRooms(this.rooms);
                } catch (XmppException e1) {
                    e1.printStackTrace();
                }

            } else {

                log.info("Received unhandled session status: " + e.getStatus());

            }

        });

        selectMessageLoop(router);

    }
 
开发者ID:ninjabear,项目名称:marissa-java,代码行数:52,代码来源:Marissa.java

示例11: getSession

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
/**
 * Returns the internal Babbler {@link XmppSession}
 *
 * @return The XMPP session
 */
public XmppSession getSession() {

    return pSession;
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:10,代码来源:Bot.java

示例12: onSessionEnd

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
/**
 * The XMPP session has ended
 *
 * @param aSession
 *            The XMPP session
 */
void onSessionEnd(XmppSession aSession);
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:8,代码来源:IBotListener.java

示例13: onSessionStart

import rocks.xmpp.core.session.XmppSession; //导入依赖的package包/类
/**
 * The XMPP session has started, client is authenticated
 *
 * @param aSession
 *            The XMPP session
 */
void onSessionStart(XmppSession aSession);
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:8,代码来源:IBotListener.java


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