本文整理汇总了Java中org.jivesoftware.smack.packet.IQ.Type.set方法的典型用法代码示例。如果您正苦于以下问题:Java Type.set方法的具体用法?Java Type.set怎么用?Java Type.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.packet.IQ.Type
的用法示例。
在下文中一共展示了Type.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.jivesoftware.smack.packet.IQ.Type; //导入方法依赖的package包/类
public void run() {
try {
while (true) {
final Stanza packet = connection.getSentPacket();
if (packet instanceof RosterPacket && ((IQ) packet).getType() == Type.set) {
final RosterPacket rosterRequest = (RosterPacket) packet;
// Prepare and process the roster push
final RosterPacket rosterPush = new RosterPacket();
final Item item = rosterRequest.getRosterItems().iterator().next();
if (item.getItemType() != ItemType.remove) {
item.setItemType(ItemType.none);
}
rosterPush.setType(Type.set);
rosterPush.setTo(connection.getUser());
rosterPush.addRosterItem(item);
connection.processPacket(rosterPush);
// Create and process the IQ response
final IQ response = IQ.createResultIQ(rosterRequest);
connection.processPacket(response);
// Verify the roster update request
assertSame("A roster set MUST contain one and only one <item/> element.",
1,
rosterRequest.getRosterItemCount());
verifyUpdateRequest(rosterRequest);
break;
}
}
}
catch (Throwable e) {
exception = e;
fail(e.getMessage());
}
}
示例2: acceptSpecific
import org.jivesoftware.smack.packet.IQ.Type; //导入方法依赖的package包/类
@Override
protected boolean acceptSpecific(Privacy privacy) {
if (privacy.getType() != Type.set) {
return false;
}
return privacy.getActiveName() != null || privacy.isDeclineActiveList();
}
示例3: acceptSpecific
import org.jivesoftware.smack.packet.IQ.Type; //导入方法依赖的package包/类
@Override
protected boolean acceptSpecific(Privacy privacy) {
if (privacy.getType() != Type.set) {
return false;
}
return privacy.getDefaultName() != null || privacy.isDeclineDefaultList();
}
示例4: RosterPushListener
import org.jivesoftware.smack.packet.IQ.Type; //导入方法依赖的package包/类
private RosterPushListener() {
super(RosterPacket.ELEMENT, RosterPacket.NAMESPACE, Type.set, Mode.sync);
}