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


Java Presence.getShow方法代码示例

本文整理汇总了Java中org.xmpp.packet.Presence.getShow方法的典型用法代码示例。如果您正苦于以下问题:Java Presence.getShow方法的具体用法?Java Presence.getShow怎么用?Java Presence.getShow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xmpp.packet.Presence的用法示例。


在下文中一共展示了Presence.getShow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPresence

import org.xmpp.packet.Presence; //导入方法依赖的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;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:26,代码来源:PresenceManagerImpl.java

示例2: sendInfo

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
@Override
public void sendInfo(HttpServletRequest request,
        HttpServletResponse response, Presence presence) throws IOException {
    if (presence == null) {
        writeImageContent(request, response, "offline", servlet.offline);
    }
    else if (presence.getShow() == null) {
        writeImageContent(request, response, "available", servlet.available);
    }
    else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.away)) {
        writeImageContent(request, response, "away", servlet.away);
    }
    else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.chat)) {
        writeImageContent(request, response, "chat", servlet.chat);
    }
    else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.dnd)) {
        writeImageContent(request, response, "dnd", servlet.dnd);
    }
    else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.xa)) {
        writeImageContent(request, response, "xa", servlet.xa);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:23,代码来源:ImagePresenceProvider.java

示例3: getPresence

import org.xmpp.packet.Presence; //导入方法依赖的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;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:25,代码来源:PresenceManagerImpl.java

示例4: sendInfo

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
@Override
public void sendInfo(HttpServletRequest request,
           HttpServletResponse response, Presence presence) throws IOException {
       if (presence == null) {
           writeImageContent(request, response, "offline", servlet.offline);
       }
       else if (presence.getShow() == null) {
           writeImageContent(request, response, "available", servlet.available);
       }
       else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.away)) {
           writeImageContent(request, response, "away", servlet.away);
       }
       else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.chat)) {
           writeImageContent(request, response, "chat", servlet.chat);
       }
       else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.dnd)) {
           writeImageContent(request, response, "dnd", servlet.dnd);
       }
       else if (presence.getShow().equals(org.xmpp.packet.Presence.Show.xa)) {
           writeImageContent(request, response, "xa", servlet.xa);
       }
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:23,代码来源:ImagePresenceProvider.java

示例5: updatePresence

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
private void updatePresence(ClientSession session, Presence presence)
{
    Connection con = null;
    PreparedStatement pstmt = null;
    final String presenceText;

    if (!XMPPServer.getInstance().getUserManager().isRegisteredUser(session.getAddress()))
    {
        return;
    }

    if (Presence.Type.unavailable.equals(presence.getType()))
    {
        presenceText = presence.getType().toString();
    }
    else if (presence.getShow() != null)
    {
        presenceText = presence.getShow().toString();
    }
    else if (presence.isAvailable())
    {
        presenceText = "available";
    }
    else
    {
        return;
    }

    setPresence(session, presenceText);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:31,代码来源:UserStatusPlugin.java

示例6: sendNotify

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public void sendNotify(Dialog dialog) throws ParseException, SipException, InvalidArgumentException {
    Request notifyRequest = prepareNotifyRequest(dialog);
    
    try {
        User     me         = XMPPServer.getInstance().getUserManager().getUser(getJID().getNode());
        Presence myPresence = XMPPServer.getInstance().getPresenceManager().getPresence(me);
        
        String         presenceContent;
        SimplePresence simplePresence  = new SimplePresence();
        simplePresence.setEntity("pres:" + registration.getUsername() + "@" + sipHost);
        simplePresence.setDmNote(myPresence.getStatus());
        
        if (myPresence.getStatus() != null && myPresence.getStatus().equalsIgnoreCase("Offline"))
            simplePresence.setTupleStatus(SimplePresence.TupleStatus.CLOSED);
        else {
            simplePresence.setTupleStatus(SimplePresence.TupleStatus.OPEN);
            
            if (myPresence.getShow() != null) {
                switch (myPresence.getShow()) {
                    case away:
                        simplePresence.setRpid(SimplePresence.Rpid.AWAY);
                        break;
                    case dnd:
                        simplePresence.setRpid(SimplePresence.Rpid.BUSY);
                        break;
                    case xa:
                        simplePresence.setRpid(SimplePresence.Rpid.AWAY);
                        break;
                    default:
                        break;
                }
            }
        }
        
        presenceContent = simplePresence.toXML();
        
        ContentTypeHeader contentTypeHeader = headerFactory.createContentTypeHeader("application", "pidf+xml");
        notifyRequest.setContent(presenceContent, contentTypeHeader);
    }
    catch (Exception e) {
        Log.debug("Unable to include presence details in the packet.", e);
    }
    
    sendRequest(notifyRequest, ListeningPoint.UDP, dialog);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:46,代码来源:SimpleSession.java

示例7: sendNotify

import org.xmpp.packet.Presence; //导入方法依赖的package包/类
public void sendNotify(Dialog dialog) throws ParseException, SipException, InvalidArgumentException {
	Request notifyRequest = prepareNotifyRequest(dialog);
	
	try {
		User     me         = XMPPServer.getInstance().getUserManager().getUser(getJID().getNode());
		Presence myPresence = XMPPServer.getInstance().getPresenceManager().getPresence(me);
		
		String         presenceContent;
		SimplePresence simplePresence  = new SimplePresence();
		simplePresence.setEntity("pres:" + registration.getUsername() + "@" + sipHost);
		simplePresence.setDmNote(myPresence.getStatus());
		
		if (myPresence.getStatus() != null && myPresence.getStatus().equalsIgnoreCase("Offline"))
			simplePresence.setTupleStatus(SimplePresence.TupleStatus.CLOSED);
		else {
			simplePresence.setTupleStatus(SimplePresence.TupleStatus.OPEN);
			
			if (myPresence.getShow() != null) {
				switch (myPresence.getShow()) {
					case away:
						simplePresence.setRpid(SimplePresence.Rpid.AWAY);
						break;
					case dnd:
						simplePresence.setRpid(SimplePresence.Rpid.BUSY);
						break;
					case xa:
						simplePresence.setRpid(SimplePresence.Rpid.AWAY);
						break;
					default:
						break;
				}
			}
		}
		
		presenceContent = simplePresence.toXML();
		
		ContentTypeHeader contentTypeHeader = headerFactory.createContentTypeHeader("application", "pidf+xml");
		notifyRequest.setContent(presenceContent, contentTypeHeader);
	}
	catch (Exception e) {
		Log.debug("Unable to include presence details in the packet.", e);
	}
	
	sendRequest(notifyRequest, ListeningPoint.UDP, dialog);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:46,代码来源:SimpleSession.java


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