Skip to content

Instantly share code, notes, and snippets.

@legastero
legastero / fis_examples.xml
Created January 24, 2013 23:50
Experiment with cleaning up the XML in the new FIS XEP.
<!-- Notes:
The <offer />, and <request /> wrappers aren't needed, since that
information is provided by the IQ type.
The node attribute is the path of a file or directory in these
examples, but its not really required that the two match. There
could be a mapping of UUIDs to paths, with the node being the UUID.
Using the term node would make it easier conceptually for
future XEPs that tie in pubsub updates for new/changed/removed
@legastero
legastero / fis_disco.xml
Created January 25, 2013 00:14
Ponder options in exposing FIS data over disco.
<iq type="get" id="disco1">
<query xmlns="http://jabber.org/protocol/disco#items" node="urn:xmpp:fis:0" />
</iq>
<iq type="result" id="disco1">
<query xmlns="http://jabber.org/protocol/disco#items" node="urn:xmpp:fis:0">
<item jid="a@b" node="test1.txt" name="test1.txt" />
<item jid="a@b" node="test2.txt" name="test2.txt" />
<item jid="a@b" node="pics" name="pics" />
</query>
@legastero
legastero / gist:4964296
Last active December 13, 2015 19:38
Experimenting with simplest ways to deal with XMPP streams over websockets, in JS.
var MAGIC_START_TOKEN = "<stream:stream ";
var ALT_MAGIC_START_TOKEN = "<stream ";
var MAGIC_END_TOKEN = "</stream:stream>";
var ALT_MAGIC_END_TOKEN = "</stream>";
var STREAM_START_TAG, STREAM_END_TAG;
if (frame == MAGIC_END_TOKEN || frame == ALT_MAGIC_END_TOKEN) {
onStreamEnd();
} else {
var doc;
@legastero
legastero / search.xml
Created February 28, 2013 23:16
Thought experiments on generalized XMPP searching.
<iq type="get">
<query xmlns="X">
<search xmlns="urn:xmpp:search:0">
<x xmlns="jabber:x:data" type="submit">
...
</x>
</search>
<rsm xmlns="http://jabber.org/protocol/rsm">
<limit>10</limit>
</rsm>
@legastero
legastero / pubsub_fis.xml
Created April 23, 2013 22:47
Thoughts on using Pubsub with FIS
<iq type="get" to="[email protected]/fis">
<query xmlns="http://jabber.org/protocol/disco#items" node="urn:xmpp:fis:shares:0">
<item jid="pubsub.example.com" node="file_share_1" name="Pictures" />
<item jid="pubsub.example.com" node="file_share_2" name="Music" />
</query>
</iq>
<iq type="get" to="pubsub.example.com">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="file_share_1" />
@legastero
legastero / prosody-setup.lua
Last active February 24, 2019 12:11
Set up a Prosody server to work with stanza.io/otalk (with websockets, mam, etc)
-- 1. apt-get install prosody-trunk
-- 2. Checkout prosody-modules on Google Code
-- 3. Move all modules to /usr/lib/prosody/modules
-- 4. Move the mod_smacks module to mod_smacks2 and copy it to mod_smacks3
-- 5. Move the files in mod_smacks* to match the new names
-- 6. In mod_smacks3/mod_smacks3.lua s/urn:xmpp:sm:2/urn:xmpp:sm:3/g
-- 7. Set the Prosody configuration to:
admins = { "ADMIN@HOST" }
daemonize = true
@legastero
legastero / gist:7127532
Last active December 26, 2015 09:09
Where to find XMPP/Jingle in JS resources
@legastero
legastero / mod_extdisco.lua
Created December 3, 2013 04:29
Combine the Prosody extdisco modules.
local st = require "util.stanza";
local hmac_sha1 = require "util.hashes".hmac_sha1;
local base64 = require "util.encodings".base64;
local os_time = os.time;
local services = module:get_option("external_services");
local xmlns_extdisco = "urn:xmpp:extdisco:1";
/*! stanzaio 2014-04-21!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.XMPP=e()}}(function(){var e,f,n;return function o(e,f,n){function d(t,l){if(!f[t]){if(!e[t]){var u="function"==typeof require&&require;if(!l&&u)return u(t,!0);if(i)return i(t,!0);throw new Error("Cannot find module '"+t+"'")}var p=f[t]={exports:{}};e[t][0].call(p.exports,function(f){var n=e[t][1][f];return d(n?n:f)},p,p.exports,o,e,f,n)}return f[t].exports}for(var i="function"==typeof require&&require,t=0;t<n.length;t++)d(n[t]);return d}({1:[function(e,f,n){"use strict";n.Stream=e("./lib/stanza/stream"),n.BOSH=e("./lib/stanza/bosh"),n.Message=e("./lib/stanza/message"),n.Presence=e("./lib/stanza/presence"),n.Iq=e("./lib/stanza/iq"),n.PubsubEvent=e("./lib/stanza/pubsub").EventItem,n.PubsubItem=e("./lib/stanza/pubsub").Item,n.JID=e("./lib/jid"),n.Client=e(".
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.XMPP=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
exports.Stream = _dereq_('./lib/stanza/stream');
exports.BOSH = _dereq_('./lib/stanza/bosh');
exports.Message = _dereq_('./lib/stanza/message');
exports.Presence = _dereq_('./lib/stanza/presence');
exports.Iq = _dereq_('./lib/stanza/iq');
exports.PubsubEvent = _dereq_('