zoukankan      html  css  js  c++  java
  • Handles XMPP URI Mappings CVT

    /**
         * Handles XMPP URI Mappings.
         *
         * @param arguments the arguments passed into Spark.
         */
        public void handleURIMapping(String arguments) {
            if(arguments == null){
                return;
            }
            
            if (arguments.indexOf("xmpp") == -1) {
                return;
            }
    
            if (arguments.indexOf(UriManager.uritypes.message.getXML()) != -1) {
                try {
                    _uriManager.handleMessage(arguments);
                }
                catch (Exception e) {
                    Log.error("error with ?message URI",e);
                }
            }
            else if (arguments.indexOf(UriManager.uritypes.join.getXML()) != -1) {
                try {
                    _uriManager.handleConference(arguments);
                }
                catch (Exception e) {
                    Log.error("error with ?join URI",e);
                }
            }
            else if (arguments.contains(UriManager.uritypes.subscribe.getXML())) {
            try {
            _uriManager.handleSubscribe(arguments);
            } catch (Exception e) {
            Log.error("error with ?subscribe URI", e);
            }
        } 
            else if (arguments.contains(UriManager.uritypes.unsubscribe.getXML())) {
            try {
            _uriManager.handleUnsubscribe(arguments);
            } catch (Exception e) {
            Log.error("error with ?subscribe URI", e);
            }
        }
            else if(arguments.contains(UriManager.uritypes.roster.getXML()))
            {
            try {
            _uriManager.handleRoster(arguments);
            } catch (Exception e) {
            Log.error("error with ?subscribe URI", e);
            }
            }
            else if (arguments.contains(UriManager.uritypes.remove.getXML()))
            {
            try {
            _uriManager.handleRemove(arguments);
            } catch (Exception e) {
            Log.error("error with ?subscribe URI", e);
            }
            }
            else if (arguments.indexOf("?") == -1) {
                // Then use the direct jid
                int index = arguments.indexOf(":");
                if (index != -1) {
                    String jid = arguments.substring(index + 1);
    
                    UserManager userManager = SparkManager.getUserManager();
                    String nickname = userManager.getUserNicknameFromJID(jid);
                    if (nickname == null) {
                        nickname = jid;
                    }
    
                    ChatManager chatManager = SparkManager.getChatManager();
                    ChatRoom chatRoom = chatManager.createChatRoom(jid, nickname, nickname);
                    chatManager.getChatContainer().activateChatRoom(chatRoom);
                }
            }
    
        }
  • 相关阅读:
    Apache的Order Allow,Deny 详解
    apache的AllowOverride以及Options使用详解
    安装启动apache2.4后报Invalid command 'order', perhaps misspelled or defined by a module not included
    前端常见跨域解决方案(全)
    php面试宝典
    php面试题2018
    nginx负载均衡的5种策略
    多台服务器共享session问题
    小程序定义并使用类
    微信小程序真机预览接口不到数据,打开调试确能请求到
  • 原文地址:https://www.cnblogs.com/openfire/p/3097420.html
Copyright © 2011-2022 走看看