/* Copyright 2010, François de Metz */ /** * Disco Strophe Plugin * Implement http://xmpp.org/extensions/xep-0030.html * TODO: manage node hierarchies, and node on info request */ Strophe.addConnectionPlugin('disco', { _connection: null, _identities : [], _features : [], _items : [], /** Function: init * Plugin init * * Parameters: * (Strophe.Connection) conn - Strophe connection */ init: function(conn) { this._connection = conn; this._identities = []; this._features = []; this._items = []; // disco info conn.addHandler(this._onDiscoInfo.bind(this), Strophe.NS.DISCO_INFO, 'iq', 'get', null, null); // disco items conn.addHandler(this._onDiscoItems.bind(this), Strophe.NS.DISCO_ITEMS, 'iq', 'get', null, null); }, /** Function: addIdentity * See http://xmpp.org/registrar/disco-categories.html * Parameters: * (String) category - category of identity (like client, automation, etc ...) * (String) type - type of identity (like pc, web, bot , etc ...) * (String) name - name of identity in natural language * (String) lang - lang of name parameter * * Returns: * Boolean */ addIdentity: function(category, type, name, lang) { for (var i=0; i