本文整理汇总了Java中org.jivesoftware.smack.roster.RosterEntry.getType方法的典型用法代码示例。如果您正苦于以下问题:Java RosterEntry.getType方法的具体用法?Java RosterEntry.getType怎么用?Java RosterEntry.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.roster.RosterEntry
的用法示例。
在下文中一共展示了RosterEntry.getType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRosterEntrySubscribed
import org.jivesoftware.smack.roster.RosterEntry; //导入方法依赖的package包/类
private boolean isRosterEntrySubscribed(RosterEntry entry) {
return (entry != null && (entry.getType() == RosterPacket.ItemType.to || entry.getType() == RosterPacket.ItemType.both) &&
!entry.isSubscriptionPending());
}
示例2: isAlreadyTrusted
import org.jivesoftware.smack.roster.RosterEntry; //导入方法依赖的package包/类
private boolean isAlreadyTrusted(Presence p) {
RosterEntry entry = getRosterEntry(p.getFrom());
return (entry != null && (entry.getType() == RosterPacket.ItemType.to ||
entry.getType() == RosterPacket.ItemType.both));
}
示例3: createIntent
import org.jivesoftware.smack.roster.RosterEntry; //导入方法依赖的package包/类
public static Intent createIntent(Context ctx, Presence p, RosterEntry entry) {
Intent i = new Intent(ACTION_PRESENCE);
Presence.Type type = p.getType();
i.putExtra(EXTRA_TYPE, type != null ? type.name() : Presence.Type.available.name());
i.putExtra(EXTRA_PACKET_ID, p.getStanzaId());
i.putExtra(EXTRA_FROM, StringUtils.maybeToString(p.getFrom().toString()));
i.putExtra(EXTRA_TO, StringUtils.maybeToString(p.getTo()));
i.putExtra(EXTRA_STATUS, p.getStatus());
Presence.Mode mode = p.getMode();
i.putExtra(EXTRA_SHOW, mode != null ? mode.name() : Presence.Mode.available.name());
i.putExtra(EXTRA_PRIORITY, p.getPriority());
String jid = p.getFrom().asBareJid().toString();
long timestamp;
DelayInformation delay = p.getExtension(DelayInformation.ELEMENT, DelayInformation.NAMESPACE);
if (delay != null) {
timestamp = delay.getStamp().getTime();
}
else {
// try last seen from database
timestamp = UsersProvider.getLastSeen(ctx, jid);
if (timestamp < 0)
timestamp = System.currentTimeMillis();
}
i.putExtra(EXTRA_STAMP, timestamp);
// public key fingerprint
String fingerprint = PublicKeyPresence.getFingerprint(p);
if (fingerprint == null) {
// try untrusted fingerprint from database
fingerprint = Keyring.getFingerprint(ctx, jid, MyUsers.Keys.TRUST_UNKNOWN);
}
i.putExtra(EXTRA_FINGERPRINT, fingerprint);
// subscription information
if (entry != null) {
i.putExtra(EXTRA_ROSTER_NAME, entry.getName());
RosterPacket.ItemType subscriptionType = entry.getType();
i.putExtra(EXTRA_SUBSCRIBED_FROM, subscriptionType == RosterPacket.ItemType.both ||
subscriptionType == RosterPacket.ItemType.from);
i.putExtra(EXTRA_SUBSCRIBED_TO, subscriptionType == RosterPacket.ItemType.both ||
subscriptionType == RosterPacket.ItemType.to);
}
return i;
}
示例4: clientToModel
import org.jivesoftware.smack.roster.RosterEntry; //导入方法依赖的package包/类
private static ClientUtils.KonRosterEntry clientToModel(RosterEntry entry) {
return new ClientUtils.KonRosterEntry(JID.fromSmack(entry.getJid()),
StringUtils.defaultString(entry.getName()),
entry.getType(),
entry.isSubscriptionPending());
}