Java 类org.jivesoftware.smackx.carbons.CarbonManager 实例源码

项目:XmppTest    文件:SmackImpl.java   
@Override
public void setStatusFromConfig() {// 设置自己的当前状态,供外部服务调用
    boolean messageCarbons = PreferenceUtils.getPrefBoolean(mService,
            PreferenceConstants.MESSAGE_CARBONS, true);
    String statusMode = PreferenceUtils.getPrefString(mService,
            PreferenceConstants.STATUS_MODE, PreferenceConstants.AVAILABLE);
    String statusMessage = PreferenceUtils.getPrefString(mService,
            PreferenceConstants.STATUS_MESSAGE,
            mService.getString(R.string.status_online));
    int priority = PreferenceUtils.getPrefInt(mService,
            PreferenceConstants.PRIORITY, 0);
    if (messageCarbons)
        CarbonManager.getInstanceFor(mXMPPConnection).sendCarbonsEnabled(
                true);

    Presence presence = new Presence(Presence.Type.available);
    Mode mode = Mode.valueOf(statusMode);
    presence.setMode(mode);
    presence.setStatus(statusMessage);
    presence.setPriority(priority);
    mXMPPConnection.sendPacket(presence);
}
项目:smartedu    文件:SmackImpl.java   
@Override
public void setStatusFromConfig() {// 设置自己的当前状态,供外部服务调用
    boolean messageCarbons = PreferenceUtils.getPrefBoolean(mService,
            PreferenceConstants.MESSAGE_CARBONS, true);
    String statusMode = PreferenceUtils.getPrefString(mService,
            PreferenceConstants.STATUS_MODE, PreferenceConstants.AVAILABLE);
    String statusMessage = PreferenceUtils.getPrefString(mService,
            PreferenceConstants.STATUS_MESSAGE,
            mService.getString(R.string.status_online));
    int priority = PreferenceUtils.getPrefInt(mService,
            PreferenceConstants.PRIORITY, 0);
    if (messageCarbons)
        CarbonManager.getInstanceFor(mXMPPConnection).sendCarbonsEnabled(
                true);

    Presence presence = new Presence(Presence.Type.available);
    Mode mode = Mode.valueOf(statusMode);
    presence.setMode(mode);
    presence.setStatus(statusMessage);
    presence.setPriority(priority);
    mXMPPConnection.sendPacket(presence);
}
项目:maven-yaxim    文件:SmackableImp.java   
public void setStatusFromConfig() {
    // TODO: only call this when carbons changed, not on every presence change
    CarbonManager.getInstanceFor(mXMPPConnection).sendCarbonsEnabled(mConfig.messageCarbons);

    Presence presence = new Presence(Presence.Type.available);
    Mode mode = Mode.valueOf(mConfig.statusMode);
    presence.setMode(mode);
    presence.setStatus(mConfig.statusMessage);
    presence.setPriority(mConfig.priority);
    mXMPPConnection.sendPacket(presence);
    mConfig.presence_required = false;
}