# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1365011367 -3600
# Node ID ef54ae81768994d742e4acc12c6a4c586a2a4e9f
# Parent  bea0ef13575c6df6215ee783ad96f7b56079e1e3
mod_pubsub_googlecode: Split name and email when possible

diff -r bea0ef13575c -r ef54ae817689 mod_pubsub_googlecode/mod_pubsub_googlecode.lua
--- a/mod_pubsub_googlecode/mod_pubsub_googlecode.lua	Wed Apr 03 19:42:04 2013 +0200
+++ b/mod_pubsub_googlecode/mod_pubsub_googlecode.lua	Wed Apr 03 18:49:27 2013 +0100
@@ -49,6 +49,12 @@
 			end
 			rev.message = "wiki ("..(what or "unknown page").."): "..rev.message;
 		end
+		
+		local name = rev.author;
+		local email = name:match("<([^>]+)>$");
+		if email then
+			name = name:gsub("%s*<[^>]+>$", "");
+		end
 
 		local ok, err = pubsub_service:publish(node, true, project,
 			st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = project })
@@ -58,7 +64,8 @@
 				:tag("link", { rel = "alternate", href = rev.url }):up()
 				:tag("published"):text(datetime(rev.timestamp)):up()
 				:tag("author")
-					:tag("name"):text(rev.author):up()
+					:tag("name"):text(name):up()
+					:tag("email"):text(email):up()
 					:up()
 		);
 	end