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


Java RosterEntry.getType方法代码示例

本文整理汇总了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());
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:5,代码来源:MessageCenterService.java

示例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));
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:6,代码来源:PresenceListener.java

示例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;
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:51,代码来源:PresenceListener.java

示例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());
}
 
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:7,代码来源:KonRosterListener.java


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