Software /
code /
prosody-modules
Diff
mod_pubsub_googlecode/mod_pubsub_googlecode.lua @ 951:ef54ae817689
mod_pubsub_googlecode: Split name and email when possible
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 03 Apr 2013 18:49:27 +0100 |
parent | 948:79b4a1db7a57 |
child | 1109:d988f2db9773 |
line wrap: on
line diff
--- 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