本文整理汇总了Java中org.xmpp.packet.Presence.Show方法的典型用法代码示例。如果您正苦于以下问题:Java Presence.Show方法的具体用法?Java Presence.Show怎么用?Java Presence.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xmpp.packet.Presence
的用法示例。
在下文中一共展示了Presence.Show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: list
import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public ModelAndView list(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ClientSession[] sessions = new ClientSession[0];
sessions = SessionManager.getInstance().getSessions().toArray(sessions);
List<SessionVO> voList = new ArrayList<SessionVO>();
for (ClientSession sess : sessions) {
SessionVO vo = new SessionVO();
vo.setUsername(sess.getUsername());
vo.setResource(sess.getAddress().getResource());
// Status
if (sess.getStatus() == Session.STATUS_CONNECTED) {
vo.setStatus("CONNECTED");
} else if (sess.getStatus() == Session.STATUS_AUTHENTICATED) {
vo.setStatus("AUTHENTICATED");
} else if (sess.getStatus() == Session.STATUS_CLOSED) {
vo.setStatus("CLOSED");
} else {
vo.setStatus("UNKNOWN");
}
// Presence
if (!sess.getPresence().isAvailable()) {
vo.setPresence("Offline");// 离线
} else {
Presence.Show show = sess.getPresence().getShow();
if (show == null) {
vo.setPresence("Online");// 在线的
} else if (show == Presence.Show.away) {
vo.setPresence("Away");// 离开
} else if (show == Presence.Show.chat) {
vo.setPresence("Chat");// 聊天
} else if (show == Presence.Show.dnd) {
vo.setPresence("Do Not Disturb");// 请勿打扰
} else if (show == Presence.Show.xa) {
vo.setPresence("eXtended Away");// 忙碌
} else {
vo.setPresence("Unknown");// 未知
}
}
vo.setClientIP(sess.getHostAddress());
vo.setCreatedDate(sess.getCreationDate());
voList.add(vo);
}
ModelAndView mav = new ModelAndView();
mav.addObject("sessionList", voList);
mav.setViewName("session/list");
return mav;
}
示例2: list
import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public ModelAndView list(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ClientSession[] sessions = new ClientSession[0];
sessions = SessionManager.getInstance().getSessions().toArray(sessions);
List<SessionVO> voList = new ArrayList<SessionVO>();
for (ClientSession sess : sessions) {
SessionVO vo = new SessionVO();
vo.setUsername(sess.getUsername());
vo.setResource(sess.getAddress().getResource());
// Status
if (sess.getStatus() == Session.STATUS_CONNECTED) {
vo.setStatus("CONNECTED");
} else if (sess.getStatus() == Session.STATUS_AUTHENTICATED) {
vo.setStatus("AUTHENTICATED");
} else if (sess.getStatus() == Session.STATUS_CLOSED) {
vo.setStatus("CLOSED");
} else {
vo.setStatus("UNKNOWN");
}
// Presence
if (!sess.getPresence().isAvailable()) {
vo.setPresence("Offline");
} else {
Presence.Show show = sess.getPresence().getShow();
if (show == null) {
vo.setPresence("Online");
} else if (show == Presence.Show.away) {
vo.setPresence("Away");
} else if (show == Presence.Show.chat) {
vo.setPresence("Chat");
} else if (show == Presence.Show.dnd) {
vo.setPresence("Do Not Disturb");
} else if (show == Presence.Show.xa) {
vo.setPresence("eXtended Away");
} else {
vo.setPresence("Unknown");
}
}
vo.setClientIP(sess.getHostAddress());
vo.setCreatedDate(sess.getCreationDate());
voList.add(vo);
}
ModelAndView mav = new ModelAndView();
mav.addObject("sessionList", voList);
mav.setViewName("session/list");
return mav;
}