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


Java FromMatchesFilter.create方法代码示例

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


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

示例1: autoCompareMatchingServiceJid

import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
@Test
public void autoCompareMatchingServiceJid()
{
    FromMatchesFilter filter = FromMatchesFilter.create(SERVICE_JID1);
    Stanza packet = new Stanza() {
        @Override
        public String toXML() { return null; }
    };

    packet.setFrom(SERVICE_JID1);
    assertTrue(filter.accept(packet));

    packet.setFrom(SERVICE_JID2);
    assertFalse(filter.accept(packet));

    packet.setFrom(BASE_JID1);
    assertFalse(filter.accept(packet));

    packet.setFrom(FULL_JID1_R1);
    assertFalse(filter.accept(packet));

    packet.setFrom(BASE_JID3);
    assertFalse(filter.accept(packet));
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:25,代码来源:FromMatchesFilterTest.java

示例2: autoCompareMatchingFullJid

import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
@Test
public void autoCompareMatchingFullJid()
{
    FromMatchesFilter filter = FromMatchesFilter.create(FULL_JID1_R1);
    Stanza packet = new Stanza() {
        @Override
        public String toXML() { return null; }
    };

    packet.setFrom(FULL_JID1_R1);
    assertTrue(filter.accept(packet));

    packet.setFrom(BASE_JID1);
    assertFalse(filter.accept(packet));

    packet.setFrom(FULL_JID1_R2);
    assertFalse(filter.accept(packet));

    packet.setFrom(BASE_JID2);
    assertFalse(filter.accept(packet));

    packet.setFrom(FULL_JID2);
    assertFalse(filter.accept(packet));

    packet.setFrom(BASE_JID3);
    assertFalse(filter.accept(packet));
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:28,代码来源:FromMatchesFilterTest.java

示例3: autoCompareMatchingBaseJid

import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
@Test
    public void autoCompareMatchingBaseJid()
    {
        FromMatchesFilter filter = FromMatchesFilter.create(BASE_JID1);
        Stanza packet = new Stanza() {
            @Override
            public String toXML() { return null; }
        };

        packet.setFrom(BASE_JID1);
        assertTrue(filter.accept(packet));

        packet.setFrom(FULL_JID1_R1);
        assertTrue(filter.accept(packet));

        packet.setFrom(FULL_JID1_R2);
        assertTrue(filter.accept(packet));

        packet.setFrom(BASE_JID2);
        assertFalse(filter.accept(packet));

        packet.setFrom(FULL_JID2);
        assertFalse(filter.accept(packet));

        packet.setFrom(BASE_JID3);
        assertFalse(filter.accept(packet));
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:28,代码来源:FromMatchesFilterTest.java

示例4: isAvailable

import org.jivesoftware.smack.filter.FromMatchesFilter; //导入方法依赖的package包/类
/**
 * Returns true if the workgroup is available for receiving new requests. The workgroup will be
 * available only when agents are available for this workgroup.
 *
 * @return true if the workgroup is available for receiving new requests.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public boolean isAvailable() throws NoResponseException, XMPPErrorException, NotConnectedException {
    Presence directedPresence = new Presence(Presence.Type.available);
    directedPresence.setTo(workgroupJID);
    StanzaFilter typeFilter = new StanzaTypeFilter(Presence.class);
    StanzaFilter fromFilter = FromMatchesFilter.create(workgroupJID);
    PacketCollector collector = connection.createPacketCollectorAndSend(new AndFilter(fromFilter,
            typeFilter), directedPresence);

    Presence response = (Presence)collector.nextResultOrThrow();
    return Presence.Type.available == response.getType();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:21,代码来源:Workgroup.java


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