本文整理汇总了Java中org.jivesoftware.openfire.session.ClientSession.getPresence方法的典型用法代码示例。如果您正苦于以下问题:Java ClientSession.getPresence方法的具体用法?Java ClientSession.getPresence怎么用?Java ClientSession.getPresence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.openfire.session.ClientSession
的用法示例。
在下文中一共展示了ClientSession.getPresence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPresence
import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
@Override
public Presence getPresence(User user) {
if (user == null) {
return null;
}
Presence presence = null;
for (ClientSession session : sessionManager.getSessions(user.getUsername())) {
if (presence == null) {
presence = session.getPresence();
}
else {
// Get the ordinals of the presences to compare. If no ordinal is available then
// assume a value of -1
int o1 = presence.getShow() != null ? presence.getShow().ordinal() : -1;
int o2 = session.getPresence().getShow() != null ?
session.getPresence().getShow().ordinal() : -1;
// Compare the presences' show ordinals
if (o1 > o2) {
presence = session.getPresence();
}
}
}
return presence;
}
示例2: getPresence
import org.jivesoftware.openfire.session.ClientSession; //导入方法依赖的package包/类
public Presence getPresence(User user) {
if (user == null) {
return null;
}
Presence presence = null;
for (ClientSession session : sessionManager.getSessions(user.getUsername())) {
if (presence == null) {
presence = session.getPresence();
}
else {
// Get the ordinals of the presences to compare. If no ordinal is available then
// assume a value of -1
int o1 = presence.getShow() != null ? presence.getShow().ordinal() : -1;
int o2 = session.getPresence().getShow() != null ?
session.getPresence().getShow().ordinal() : -1;
// Compare the presences' show ordinals
if (o1 > o2) {
presence = session.getPresence();
}
}
}
return presence;
}