소스 검색

Use strophejs-plugins from NPM

JC Brand 8 년 전
부모
커밋
2712bcb7cc
5개의 변경된 파일11개의 추가작업 그리고 183개의 파일을 삭제
  1. 6 8
      bower.json
  2. 4 4
      config.js
  3. 1 0
      package.json
  4. 0 100
      src/strophe.ping.js
  5. 0 71
      src/strophe.vcard.js

+ 6 - 8
bower.json

@@ -4,17 +4,15 @@
   "version": "2.0.0",
   "license": "MPL-2.0",
   "devDependencies": {
-    "jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x",
-    "sinon": "^1.17.3"
-  },
-  "dependencies": {
-    "crypto-js-evanvosberg": "https://github.com/evanvosberg/crypto-js.git#release-3.1.2-5",
     "bootstrap": "~3.2.0",
+    "bourbon": "~4.2.6",
+    "crypto-js-evanvosberg": "https://github.com/evanvosberg/crypto-js.git#release-3.1.2-5",
     "fontawesome": "~4.1.0",
-    "typeahead.js": "https://raw.githubusercontent.com/jcbrand/typeahead.js/eedfb10505dd3a20123d1fafc07c1352d83f0ab3/dist/typeahead.jquery.js",
-    "strophejs-plugins": "https://github.com/strophe/strophejs-plugins.git#amd",
-    "bourbon": "~4.2.6"
+    "jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x",
+    "sinon": "^1.17.3",
+    "typeahead.js": "https://raw.githubusercontent.com/jcbrand/typeahead.js/eedfb10505dd3a20123d1fafc07c1352d83f0ab3/dist/typeahead.jquery.js"
   },
+  "dependencies": {},
   "exportsOverride": {},
   "ignore": [
     "docs",

+ 4 - 4
config.js

@@ -34,10 +34,10 @@ require.config({
         "strophe-sha1":             "node_modules/strophe.js/src/sha1",
         "strophe-utils":            "node_modules/strophe.js/src/utils",
         "strophe-websocket":        "node_modules/strophe.js/src/websocket",
-        "strophe.disco":            "components/strophejs-plugins/disco/strophe.disco",
-        "strophe.ping":             "src/strophe.ping",
-        "strophe.rsm":              "components/strophejs-plugins/rsm/strophe.rsm",
-        "strophe.vcard":            "src/strophe.vcard",
+        "strophe.disco":            "node_modules/strophejs-plugins/disco/strophe.disco",
+        "strophe.ping":             "node_modules/strophejs-plugins/ping/strophe.ping",
+        "strophe.rsm":              "node_modules/strophejs-plugins/rsm/strophe.rsm",
+        "strophe.vcard":            "node_modules/strophejs-plugins/vcard/strophe.vcard",
         "text":                     "node_modules/text/text",
         "tpl":                      "node_modules/requirejs-undertemplate/tpl",
         "typeahead":                "components/typeahead.js/index",

+ 1 - 0
package.json

@@ -61,6 +61,7 @@
     "otr": "0.2.16",
     "pluggable.js": "0.0.2",
     "strophe.js": "1.2.8",
+    "strophejs-plugins": "0.0.7",
     "underscore": "~1.8.3"
   }
 }

+ 0 - 100
src/strophe.ping.js

@@ -1,100 +0,0 @@
-/*
-* Based on Ping Strophejs plugins (https://github.com/metajack/strophejs-plugins/tree/master/ping)
-* This plugin is distributed under the terms of the MIT licence.
-* Please see the LICENCE file for details.
-*
-* Copyright (c) Markus Kohlhase, 2010
-* Refactored by Pavel Lang, 2011
-*/
-/**
-* File: strophe.ping.js
-* A Strophe plugin for XMPP Ping ( http://xmpp.org/extensions/xep-0199.html )
-*/
-/* 
-* AMD Support added by Thierry
-* 
-*/
-
-(function (root, factory) {
-    if (typeof define === 'function' && define.amd) {
-        // AMD. Register as an anonymous module.
-        define([
-            "strophe"
-        ], function (Strophe) {
-            factory(
-                Strophe.Strophe,
-                Strophe.$build,
-                Strophe.$iq ,
-                Strophe.$msg,
-                Strophe.$pres
-            );
-            return Strophe;
-        });
-    } else {
-        // Browser globals
-        factory(
-            root.Strophe,
-            root.$build,
-            root.$iq ,
-            root.$msg,
-            root.$pres
-        );
-    }
-}(this, function (Strophe, $build, $iq, $msg, $pres) {
-Strophe.addConnectionPlugin('ping', {
-        _c: null,
-
-        // called by the Strophe.Connection constructor
-        init: function(conn)
-        {
-                this._c = conn;
-                Strophe.addNamespace('PING', "urn:xmpp:ping");
-        },
-
-        /**
-         * Function: ping
-         *
-         * Parameters:
-         * (String) to - The JID you want to ping
-         * (Function) success - Callback function on success
-         * (Function) error - Callback function on error
-         * (Integer) timeout - Timeout in milliseconds
-         */
-        ping: function(jid, success, error, timeout)
-        {
-                var id = this._c.getUniqueId('ping');
-                var iq = $iq({type: 'get', to: jid, id: id}).c(
-                                'ping', {xmlns: Strophe.NS.PING});
-                this._c.sendIQ(iq, success, error, timeout);
-        },
-
-        /**
-         * Function: pong
-         *
-         * Parameters:
-         * (Object) ping - The ping stanza from the server.
-         */
-        pong: function(ping)
-        {
-                var from = ping.getAttribute('from');
-                var id = ping.getAttribute('id');
-                var iq = $iq({type: 'result', to: from,id: id});
-                this._c.sendIQ(iq);
-        },
-
-        /**
-         * Function: addPingHandler
-         *
-         * Parameters:
-         * (Function) handler - Ping handler
-         *
-         * Returns:
-         * A reference to the handler that can be used to remove it.
-         */
-        addPingHandler: function(handler)
-        {
-                return this._c.addHandler(handler, Strophe.NS.PING, "iq", "get");
-        }
-});
-
-}));

+ 0 - 71
src/strophe.vcard.js

@@ -1,71 +0,0 @@
-/* Plugin to implement the vCard extension.
- *  http://xmpp.org/extensions/xep-0054.html
- *
- *  Author: Nathan Zorn (nathan.zorn@gmail.com)
- *  AMD support by JC Brand
- */
-
-(function (root, factory) {
-    if (typeof define === 'function' && define.amd) {
-        // AMD. Register as an anonymous module.
-        define([
-            "strophe"
-        ], function (Strophe) {
-            factory(
-                Strophe.Strophe,
-                Strophe.$build,
-                Strophe.$iq ,
-                Strophe.$msg,
-                Strophe.$pres
-            );
-            return Strophe;
-        });
-    } else {
-        // Browser globals
-        factory(
-            root.Strophe,
-            root.$build,
-            root.$iq ,
-            root.$msg,
-            root.$pres
-        );
-    }
-}(this, function (Strophe, $build, $iq, $msg, $pres) {
-
-    var buildIq = function(type, jid, vCardEl) {
-        var iq = $iq(jid ? {type: type, to: jid} : {type: type});
-        iq.c("vCard", {xmlns: Strophe.NS.VCARD});
-        if (vCardEl) {
-            iq.cnode(vCardEl);
-        }
-        return iq;
-    };
-
-    Strophe.addConnectionPlugin('vcard', {
-        _connection: null,
-        init: function(conn) {
-            this._connection = conn;
-            return Strophe.addNamespace('VCARD', 'vcard-temp');
-        },
-
-        /*Function
-        Retrieve a vCard for a JID/Entity
-        Parameters:
-        (Function) handler_cb - The callback function used to handle the request.
-        (String) jid - optional - The name of the entity to request the vCard
-            If no jid is given, this function retrieves the current user's vcard.
-        */
-        get: function(handler_cb, jid, error_cb) {
-            var iq = buildIq("get", jid);
-            return this._connection.sendIQ(iq, handler_cb, error_cb);
-        },
-
-        /* Function
-            Set an entity's vCard.
-        */
-        set: function(handler_cb, vCardEl, jid, error_cb) {
-            var iq = buildIq("set", jid, vCardEl);
-            return this._connection.sendIQ(iq, handler_cb, error_cb);
-        }
-    });
-}));