Example #1
0
var NS = 'http://jabber.org/protocol/rsm';


module.exports = stanza.define({
    name: 'rsm',
    namespace: NS,
    element: 'set',
    fields: {
        after: stanza.subText(NS, 'after'),
        before: {
            get: function () {
                return stanza.getSubText(this.xml, this._NS, 'before');
            },
            set: function (value) {
                if (value === true) {
                    stanza.findOrCreate(this.xml, this._NS, 'before');
                } else {
                    stanza.setSubText(this.xml, this._NS, 'before', value);
                }
            }
        },
        count: stanza.numberSub(NS, 'count', false, 0),
        first: stanza.subText(NS, 'first'),
        firstIndex: stanza.subAttribute(NS, 'first', 'index'),
        index: stanza.subText(NS, 'index'),
        last: stanza.subText(NS, 'last'),
        max: stanza.subText(NS, 'max')
    }
});
Example #2
0
'use strict';
var stanza = require('jxt');

var Item = require('./pubsub').Item;
var EventItem = require('./pubsubEvents').EventItem;
var Message = require('./message');


var NS = 'http://jabber.org/protocol/tune';


var Tune = module.exports = stanza.define({
    name: 'tune',
    namespace: NS,
    element: 'tune',
    fields: {
        artist: stanza.subText(NS, 'artist'),
        length: stanza.numberSub(NS, 'length'),
        rating: stanza.numberSub(NS, 'rating'),
        source: stanza.subText(NS, 'source'),
        title: stanza.subText(NS, 'title'),
        track: stanza.subText(NS, 'track'),
        uri: stanza.subText(NS, 'uri')
    }
});


stanza.extend(Item, Tune);
stanza.extend(EventItem, Tune);
stanza.extend(Message, Tune);
Example #3
0
var util = require('./util');
var jingle = require('./jingle');
var Hash = require('./hash');


var NS = 'urn:xmpp:jingle:apps:file-transfer:3';


exports.File = stanza.define({
    name: '_file',
    namespace: NS,
    element: 'file',
    fields: {
        name: stanza.subText(NS, 'name'),
        desc: stanza.subText(NS, 'desc'),
        size: stanza.numberSub(NS, 'size'),
        date: stanza.dateSub(NS, 'date')
    }
});

exports.Range = stanza.define({
    name: 'range',
    namespace: NS,
    element: 'range',
    fields: {
        offset: stanza.numberAttribute('offset')
    }
});

exports.FileTransfer = stanza.define({
    name: '_filetransfer',
Example #4
0
var stanza = require('jxt');
var util = require('./util');


module.exports = stanza.define({
    name: 'presence',
    namespace: 'jabber:client',
    element: 'presence',
    topLevel: true,
    fields: {
        lang: stanza.langAttribute(),
        id: stanza.attribute('id'),
        to: util.jidAttribute('to'),
        from: util.jidAttribute('from'),
        priority: stanza.numberSub('jabber:client', 'priority'),
        show: stanza.subText('jabber:client', 'show'),
        type: {
            get: function () {
                return stanza.getAttribute(this.xml, 'type', 'available');
            },
            set: function (value) {
                if (value === 'available') {
                    value = false;
                }
                stanza.setAttribute(this.xml, 'type', value);
            }
        },
        $status: {
            get: function () {
                return stanza.getSubLangText(this.xml, this._NS, 'status', this.lang);
Example #5
0
var stanza = require('jxt');
var util = require('./util');


module.exports = stanza.define({
    name: 'presence',
    namespace: 'jabber:client',
    element: 'presence',
    topLevel: true,
    fields: {
        lang: stanza.langAttribute(),
        id: stanza.attribute('id'),
        to: util.jidAttribute('to'),
        from: util.jidAttribute('from'),
        priority: stanza.numberSub('jabber:client', 'priority', false, 0),
        show: stanza.subText('jabber:client', 'show'),
        type: {
            get: function () {
                return stanza.getAttribute(this.xml, 'type', 'available');
            },
            set: function (value) {
                if (value === 'available') {
                    value = false;
                }
                stanza.setAttribute(this.xml, 'type', value);
            }
        },
        $status: {
            get: function () {
                return stanza.getSubLangText(this.xml, this._NS, 'status', this.lang);