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


Java Stanza.setFrom方法代码示例

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


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

示例1: sendStanza

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的package包/类
@Override
public void sendStanza(Stanza packet) throws NotConnectedException {
    Objects.requireNonNull(packet, "Packet must not be null");

    throwNotConnectedExceptionIfAppropriate();
    switch (fromMode) {
    case OMITTED:
        packet.setFrom(null);
        break;
    case USER:
        packet.setFrom(getUser());
        break;
    case UNCHANGED:
    default:
        break;
    }
    // Invoke interceptors for the new packet that is about to be sent. Interceptors may modify
    // the content of the packet.
    firePacketInterceptors(packet);
    sendStanzaInternal(packet);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:22,代码来源:AbstractXMPPConnection.java

示例2: autoCompareMatchingServiceJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的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

示例3: bareCompareMatchingServiceJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的package包/类
@Test
public void bareCompareMatchingServiceJid()
{
    FromMatchesFilter filter = FromMatchesFilter.createBare(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

示例4: fullCompareMatchingServiceJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的package包/类
@Test
public void fullCompareMatchingServiceJid()
{
    FromMatchesFilter filter = FromMatchesFilter.createFull(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

示例5: autoCompareMatchingFullJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的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

示例6: autoCompareMatchingBaseJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的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

示例7: bareCompareMatchingFullJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的package包/类
@Test
public void bareCompareMatchingFullJid()
{
    FromMatchesFilter filter = FromMatchesFilter.createBare(FULL_JID1_R1);
    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

示例8: bareCompareMatchingBaseJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的package包/类
@Test
    public void bareCompareMatchingBaseJid()
    {
        FromMatchesFilter filter = FromMatchesFilter.createBare(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

示例9: fullCompareMatchingFullJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的package包/类
@Test
public void fullCompareMatchingFullJid()
{
    FromMatchesFilter filter = FromMatchesFilter.createFull(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

示例10: fullCompareMatchingBaseJid

import org.jivesoftware.smack.packet.Stanza; //导入方法依赖的package包/类
@Test
public void fullCompareMatchingBaseJid()
{
    FromMatchesFilter filter = FromMatchesFilter.createFull(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);
    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


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