Mercurial > psgxs
view modules/mod_adhoc.js @ 46:3126f8d6a5e3
Typo in 3e0ca96d2dce.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 08 Mar 2011 00:58:04 +0100 |
parents | 023f767662d3 |
children |
line wrap: on
line source
/* * Copyright (C) 2010 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> * * This file is part of PSĜS, a PubSub server written in JavaScript. * * PSĜS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License. * * PSĜS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with PSĜS. If not, see <http://www.gnu.org/licenses/>. */ 'use strict'; // XEP-0050: Ad-Hoc Commands exports.adHoc = { type: 'set', child: 'command', ns: NS.COMMANDS, func: function(response, stanza, request, to) { var action = request.getAttribute('action'); if (action != 'execute') return makeError(response, errors.bad_request.n); var node = request.getAttribute('node'); if (node == 'ping') { var cmd = xmpp.stanza('command', {xmlns: NS.COMMANDS, // sessionid: 'list:20020923T213616Z-700', node: node, 'status': 'completed'}) .c('note', {type: 'info'}).t('pong'); response.cnode(cmd); } else if (node == 'reload') { storage.load(); response.c('command', {xmlns: NS.COMMANDS, node: node, 'status': 'completed'}) .c('note', {type: 'info'}).t('The server has correctly reloaded.'); } else return makeError(response, errors.bad_request.n); return response; } }