diff server.js @ 2:eb5b6d3ab09b

Better import of ns and jid; fix email and missing ns.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 13 Jul 2011 13:11:54 +0200
parents 82905edac9d8
children 2e2a2154efbb
line wrap: on
line diff
--- a/server.js
+++ b/server.js
@@ -9,8 +9,8 @@ var http = require('http');
 var fs = require('fs');
 var xmpp = require('node-xmpp');
 var Element = xmpp.Element;
-var JID = require('./jid').JID;
-var ns = require('./ns').ns;
+var JID = require('./jid');
+var ns = require('./ns');
 var forms = require('./forms');
 require('./date');
 
@@ -133,7 +133,7 @@ cl.on('stanza', function(stanza) {
 		if (payload)
 			return handlePubSub(payload, stanza.attrs.from);
 
-	} else if (stanza.is('message')) {
+	} else if (stanza.is('message', ns.j)) {
 		var type = stanza.attrs.type;
 		if (type === 'error')
 			return;
@@ -177,7 +177,7 @@ var parseAtom = function(atom, id, jid) 
 
 		try {
 			var email = author.getChild('email', ns.atom).getText();
-			footer.t(', (').c('a', {href: email}).t('email').up().t(')');
+			footer.t(' (').c('a', {href: 'mailto:' + email}).t('email').up().t(')');
 		} catch (e) { }
 		footer.up();
 	}
@@ -242,7 +242,7 @@ var makePage = function(res, jid, form, 
 		body = article + body;
 	}
 	body = '<div e:jid="' + jid.full + '">' + body;
-	
+
 	home(res, form['pubsub#title'], form['pubsub#description'], body, 'Node created the <time>' + form['pubsub#creation_date'] + '</time> by <cite>' + form['pubsub#creator'] + '</cite> with <a href="http://linkmauve.fr/dev/eldonilo/blog">Eldonilo blog</a>.', noscript);
 };