本文整理汇总了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);
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}