當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。