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

Java Version类代码示例

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

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



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

示例1: VersionManager

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
private VersionManager(final XMPPConnection connection) {
    super(connection);

    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
    sdm.addFeature(Version.NAMESPACE);

    connection.registerIQRequestHandler(new AbstractIqRequestHandler(Version.ELEMENT, Version.NAMESPACE, IQ.Type.get,
                    Mode.async) {
        @Override
        public IQ handleIQRequest(IQ iqRequest) {
            if (ourVersion == null) {
                return IQ.createErrorResponse(iqRequest, new XMPPError(Condition.not_acceptable));
            }

            return Version.createResultFor(iqRequest, ourVersion);
        }
    });
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:19,代码来源:VersionManager.java


示例2: handleVersion

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
@CommandHandler(name = ACTION_VERSION)
private boolean handleVersion(Intent intent) {
    if (isConnected()) {
        try {
            Version version = new Version(JidCreate.from(intent.getStringExtra(EXTRA_TO)));
            version.setStanzaId(intent.getStringExtra(EXTRA_PACKET_ID));
            sendPacket(version);
        }
        catch (XmppStringprepException e) {
            Log.w(TAG, "error parsing JID: " + e.getCausingString(), e);
            // report it because it's a big deal
            ReportingManager.logException(e);
        }
    }
    return false;
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:17,代码来源:MessageCenterService.java


示例3: discoInfoFeatureNamespaces

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * Gets the namespaces of features that this <tt>Component</tt>
 * offers/supports i.e. {@link ColibriConferenceIQ#NAMESPACE}.
 */
@Override
protected String[] discoInfoFeatureNamespaces()
{
    return
        new String[]
                {
                    ColibriConferenceIQ.NAMESPACE,
                    HealthCheckIQ.NAMESPACE,
                    ProtocolProviderServiceJabberImpl
                        .URN_XMPP_JINGLE_DTLS_SRTP,
                    ProtocolProviderServiceJabberImpl
                        .URN_XMPP_JINGLE_ICE_UDP_1,
                    ProtocolProviderServiceJabberImpl
                        .URN_XMPP_JINGLE_RAW_UDP_0,
                    Version.NAMESPACE
                };
}
 
开发者ID:jitsi,项目名称:jitsi-videobridge,代码行数:24,代码来源:ComponentImpl.java


示例4: parse

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
@Override
public Version parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
    String name = null, version = null, os = null;

    outerloop: while (true) {
        int eventType = parser.next();
        switch (eventType) {
        case XmlPullParser.START_TAG:
            String tagName = parser.getName();
            switch (tagName) {
            case "name":
                name = parser.nextText();
                break;
            case "version":
                version = parser.nextText();
                break;
            case "os":
                os = parser.nextText();
                break;
            }
            break;
        case XmlPullParser.END_TAG:
            if (parser.getDepth() == initialDepth && parser.getName().equals(IQ.QUERY_ELEMENT)) {
                break outerloop;
            }
        }
    }
    if (name == null && version == null && os == null) {
        return new Version();
    }
    return new Version(name, version, os);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:33,代码来源:VersionProvider.java


示例5: checkProvider

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
@Test
public void checkProvider() throws Exception {
    // @formatter:off
    String control = "<iq from='capulet.lit' to='[email protected]/balcony' id='s2c1' type='get'>"
            + "<query xmlns='jabber:iq:version'/>"
            + "</iq>";
    // @formatter:on
    DummyConnection con = new DummyConnection();
    con.connect();

    // Enable version replys for this connection
    VersionManager.setAutoAppendSmackVersion(false);
    VersionManager.getInstanceFor(con).setVersion("Test", "0.23", "DummyOS");
    IQ versionRequest = (IQ) PacketParserUtils.parseStanza(control);

    assertTrue(versionRequest instanceof Version);

    con.processPacket(versionRequest);

    Stanza replyPacket = con.getSentPacket();
    assertTrue(replyPacket instanceof Version);

    Version reply = (Version) replyPacket;
    //getFrom check is pending for SMACK-547
    //assertEquals("[email protected]/balcony", reply.getFrom());
    assertEquals("capulet.lit", reply.getTo());
    assertEquals("s2c1", reply.getStanzaId());
    assertEquals(IQ.Type.result, reply.getType());
    assertEquals("Test", reply.getName());
    assertEquals("0.23", reply.getVersion());
    assertEquals("DummyOS", reply.getOs());
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:33,代码来源:VersionTest.java


示例6: processStanza

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
@Override
public void processStanza(Stanza packet) {
    Version p = (Version) packet;
    Intent i = new Intent(ACTION_VERSION);
    i.putExtra(EXTRA_PACKET_ID, p.getStanzaId());

    i.putExtra(EXTRA_FROM, p.getFrom().toString());
    i.putExtra(EXTRA_TO, p.getTo().toString());

    i.putExtra(EXTRA_VERSION_NAME, p.getName());
    i.putExtra(EXTRA_VERSION_NUMBER, p.getVersion());

    sendBroadcast(i);
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:15,代码来源:VersionListener.java


示例7: handleVersionIQ

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
/**
 * Handles a <tt>Version</tt> stanza which represents a request.
 *
 * @param versionRequest the <tt>Version</tt> stanza represents
 * the request to handle
 * @return an <tt>org.jivesoftware.smack.packet.IQ</tt> stanza which
 * represents the response to the specified request.
 */
private org.jivesoftware.smack.packet.IQ handleVersionIQ(
        org.jivesoftware.smackx.iqversion.packet.Version versionRequest)
{
    VersionService versionService = getVersionService();
    if (versionService == null)
    {
        return org.jivesoftware.smack.packet.IQ.createErrorResponse(
            versionRequest,
            XMPPError.getBuilder(XMPPError.Condition.service_unavailable));
    }

    org.jitsi.service.version.Version
        currentVersion = versionService.getCurrentVersion();

    if (currentVersion == null)
    {
        return org.jivesoftware.smack.packet.IQ.createErrorResponse(
            versionRequest,
            XMPPError.getBuilder(XMPPError.Condition.internal_server_error));
    }

    // send packet
    org.jivesoftware.smackx.iqversion.packet.Version versionResult =
        new org.jivesoftware.smackx.iqversion.packet.Version(
                currentVersion.getApplicationName(),
                currentVersion.toString(),
                System.getProperty("os.name")
        );

    // to, from and packetId are set by the caller.
    // versionResult.setTo(versionRequest.getFrom());
    // versionResult.setFrom(versionRequest.getTo());
    // versionResult.setPacketID(versionRequest.getPacketID());
    versionResult.setType(org.jivesoftware.smack.packet.IQ.Type.result);

    return versionResult;
}
 
开发者ID:jitsi,项目名称:jitsi-videobridge,代码行数:46,代码来源:ComponentImpl.java


示例8: isSupported

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
public boolean isSupported(String jid) throws NoResponseException, XMPPErrorException,
                NotConnectedException {
    return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
                    Version.NAMESPACE);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:6,代码来源:VersionManager.java


示例9: generateVersionFrom

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
private static Version generateVersionFrom(String name, String version, String os) {
    if (autoAppendSmackVersion) {
        name += " (Smack " + SmackConfiguration.getVersion() + ')';
    }
    return new Version(name, version, os);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:7,代码来源:VersionManager.java


示例10: handleIQRequest

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
private org.jivesoftware.smack.packet.IQ handleIQRequest(
        org.jivesoftware.smack.packet.IQ request)
    throws Exception
{
    // Requests can be categorized in pieces of Videobridge functionality
    // based on the org.jivesoftware.smack.packet.IQ runtime type (of their
    // child element) and forwarded to specialized Videobridge methods for
    // convenience.
    if (request instanceof org.jivesoftware.smackx.iqversion.packet.Version)
    {
        return
            handleVersionIQ(
                    (org.jivesoftware.smackx.iqversion.packet.Version)
                            request);
    }

    Videobridge videobridge = getVideobridge();
    if (videobridge == null)
    {
        return IQUtils.createError(
                request,
                XMPPError.Condition.internal_server_error,
                "No Videobridge service is running");
    }

    org.jivesoftware.smack.packet.IQ response;

    if (request instanceof ColibriConferenceIQ)
    {
        response
            = videobridge.handleColibriConferenceIQ(
                    (ColibriConferenceIQ) request);
    }
    else if (request instanceof HealthCheckIQ)
    {
        response = videobridge.handleHealthCheckIQ((HealthCheckIQ) request);
    }
    else if (request instanceof ShutdownIQ)
    {
        response = videobridge.handleShutdownIQ((ShutdownIQ) request);
    }
    else
    {
        response = null;
    }
    return response;
}
 
开发者ID:jitsi,项目名称:jitsi-videobridge,代码行数:48,代码来源:ComponentImpl.java


示例11: getVersion

import org.jivesoftware.smackx.iqversion.packet.Version; //导入依赖的package包/类
/**
 * Request version information from a given JID.
 * 
 * @param jid
 * @return the version information or {@code null} if not supported by JID
 * @throws NoResponseException
 * @throws XMPPErrorException
 * @throws NotConnectedException
 */
public Version getVersion(String jid) throws NoResponseException, XMPPErrorException,
                NotConnectedException {
    if (!isSupported(jid)) {
        return null;
    }
    return connection().createPacketCollectorAndSend(new Version(jid)).nextResultOrThrow();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:17,代码来源:VersionManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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