Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Wiki Markup
{rate}
{excerpt}
{status:implemented|Forum 2.0}Provides synchronization of Magnolia-based forums with other means of communication, such as mailing-lists. See [MGNLFORUM-130@jira].{status}
{excerpt}* Primary target: our own forum with our own nntp-archived mailing lists.

h2. Observation (exporter) and scheduled task (importer)

By observing creation of new {{mgnl:message}} nodes, we should be able to push those to the mailing list.

By polling the mailing list archive (or an account that is subscribed to the list), we should be able to add {{mgnl:message}} nodes to the forum.

Other suggestion: setup a mail server, get mails delivered to it and have a listener process those mails. (probably could be done with [maillets|http://james.apache.org/mailet/])

Mail clients do not (necessarily) keep custom headers, so we can't rely on using custom headers to mark forum threads etc.

When sending a message to the mailing-list, we keep track of the mail's Message-Id, so we can match responses to the thread.

When fetching new messages from the list, we check if there is a forum:message with the same Message-Id (in which case it means the message was already exported); if this email has an In-Reply-To field with a known Message-Id, we know which thread to attach this message to,

h3. User matching

We need to be able to find users by email. This is currently not possible via the UserManager API.

h3. Proposed custom mail headers

Email clients dont propagate such headers (when responding), but we could still want to send email with custom headers:
* {{X-Magnolia-Forum-ThreadID}}: the UUID of the thread
* {{X-Magnolia-Forum-ServerID}}: a unique identifier to make sure we're pushing data to/from the correct Magnolia instance ?
** how to generate such a server id? (Jira has such an id for example, when registering a license)

h2. Configuration

* One forum <-> one list
** nntp host, credentials etc
** our mailing lists nntp-group-names are in the form of {{com.magnolia-cms.test1-list}}
* Possibility certain email senders (typically Jira or Hudson)
* filter email signatures and quotes (some regex work should help, but what do we do with inlined quotes?)


h2. Libs

I've had some reasonable success at using Kerio's NNTP with commons-net: [http://commons.apache.org/net/]
Still looking for alternatives as commons-net's api isn't superb, and has some scary longstanding issues: [https://issues.apache.org/jira/browse/NET-298] [https://issues.apache.org/jira/browse/NET-276]

\-> will use email instead, as Kerio's NNTP implementation does not support the NEWNEWS command.

h2. Open questions

* Implement an observer/listener pattern on forum instead of relying on jcr ?
** would match the idea of having {{ForumManager}} return {{Forum}}, {{Thread}} and {{Message}} bean instances instead of exposing jcr nodes.
** jcr observation can filter per node type but it filters on the *parent* node type, ie we need to filter for {{mgnl:thread}} and {{mgnl:message}} (the latter, because messages can be nested), and thus we can't use {{ForumManager.getMessage()}} directly from the EventListener. The EventListener would have to 1) fetch the node and check its type 2) either bypass ForumManager altogether or let ForumManager re-fetch the node
** we still need deferred and buffered execution of events if possible, so I need to look into reusing {{info.magnolia.cms.util.DelayedExecutor}} or the {{java.util.concurrent}} package.
This has not been implemented yet, but is still an open option for the future.


h2. Links

* NNTP RFC: [http://tools.ietf.org/html/rfc977]
* Arpa text messages: [http://tools.ietf.org/html/rfc822]
* More human-friendly description of the protocol: [http://www.faqs.org/docs/linux_network/x-087-2-nntp.protocol.html]
* [http://www.tcpipguide.com/free/t_UsenetMessageFormatandSpecialHeaders-2.htm]