Mercurial > psgxs
comparison storage.js @ 12:9a6b8b3357c6
Use new functions like console.log instead of sys.puts, and aerate a bit.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 27 Aug 2010 01:14:40 +0200 |
parents | 44889cfb2f8c |
children | f2e9365bc8ec |
comparison
equal
deleted
inserted
replaced
11:0ed3c06c5191 | 12:9a6b8b3357c6 |
---|---|
15 * | 15 * |
16 * You should have received a copy of the GNU Affero General Public License | 16 * You should have received a copy of the GNU Affero General Public License |
17 * along with PSĜS. If not, see <http://www.gnu.org/licenses/>. | 17 * along with PSĜS. If not, see <http://www.gnu.org/licenses/>. |
18 */ | 18 */ |
19 | 19 |
20 var sys = require('sys'); | |
21 var sha1hex = require('sha1').hex; | 20 var sha1hex = require('sha1').hex; |
22 require('./iso8601'); | 21 require('./iso8601'); |
23 var errors = require('./errors'); | 22 var errors = require('./errors'); |
24 var config = require('./configuration'); | 23 var config = require('./configuration'); |
25 var service_configuration = config.service_configuration; | 24 var service_configuration = config.service_configuration; |
510 var data = sanitize(list); | 509 var data = sanitize(list); |
511 | 510 |
512 if (!file) | 511 if (!file) |
513 file = 'save.json'; | 512 file = 'save.json'; |
514 | 513 |
515 fs.writeFile(file, sys.inspect(data, null, null)); | 514 fs.writeFile(file, require('sys').inspect(data, null, null)); |
516 } | 515 } |
517 | 516 |
518 storage.load = function(file) { | 517 storage.load = function(file) { |
519 var xmpp = require('xmpp'); | 518 var xmpp = require('xmpp'); |
520 function parseStanza(path, content) { | 519 function parseStanza(path, content) { |
554 for (var j in Node.prototype) | 553 for (var j in Node.prototype) |
555 list[i][j] = Node.prototype[j]; | 554 list[i][j] = Node.prototype[j]; |
556 } | 555 } |
557 | 556 |
558 storage.debug = function() { | 557 storage.debug = function() { |
559 sys.puts('\033[1;33m' + sys.inspect(list, null, null) + '\033[0m'); | 558 console.log('\033[1;33m' + require('sys').inspect(list, null, null) + '\033[0m'); |
560 }; | 559 }; |