Index: pm_workflow_ng/pm_workflow_ng.module
===================================================================
RCS file: pm_workflow_ng/pm_workflow_ng.module
diff -N pm_workflow_ng/pm_workflow_ng.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pm_workflow_ng/pm_workflow_ng.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,152 @@
+<?php
+
+/**
+ * This include file implements workflow ng functionality on behalf of the
+ * privatemsg.module 
+ */
+ 
+// token support
+include_once 'pm_workflow_ng_token.inc';
+ 
+ 
+/**
+ * Implementation of hook_event_info()
+ */
+function pm_workflow_ng_event_info() {
+  return array(
+    'privatemsg_prune' => array(
+      '#label' => t('Message is permanently removed'),
+      '#module' => t('Privatemsg'),
+      '#arguments' => array(
+        'userA' => array('#entity' => 'user', '#label' => t('UserA, sender of message')),
+        'userB' => array('#entity' => 'user', '#label' => t('UserB, recipient of message')),
+        'privatemsginfo' => array('#entity' => 'privatemsginfo', '#label' => t('Message')),
+       ),
+    ),  
+    'privatemsg_delete' => array(
+      '#label' => t('Message is marked as deleted'),
+      '#module' => t('Privatemsg'),
+      '#arguments' => array(
+        'userA' => array('#entity' => 'user', '#label' => t('UserA, sender of message')),
+        'userB' => array('#entity' => 'user', '#label' => t('UserB, recipient of message')),
+        'privatemsginfo' => array('#entity' => 'privatemsginfo', '#label' => t('Message')),
+       ),
+    ),    
+    'privatemsg_view' => array(
+      '#label' => t('Message is about to be displayed for viewing'),
+      '#module' => t('Privatemsg'),
+      '#arguments' => array(
+        'userA' => array('#entity' => 'user', '#label' => t('UserA, sender of message')),
+        'userB' => array('#entity' => 'user', '#label' => t('UserB, recipient of message')),
+        'privatemsginfo' => array('#entity' => 'privatemsginfo', '#label' => t('Message')),
+       ),
+    ),    
+    'privatemsg_sent' => array(
+      '#label' => t('Message was sent'),
+      '#module' => t('Privatemsg'),
+      '#arguments' => array(
+        'userA' => array('#entity' => 'user', '#label' => t('UserA, sender of message')),
+        'userB' => array('#entity' => 'user', '#label' => t('UserB, recipient of message')),
+        'privatemsginfo' => array('#entity' => 'privatemsginfo', '#label' => t('Message')),
+       ),
+    ),
+  );
+}
+
+/**
+ * Implementation of hook_privatemsg()
+ */
+function pm_workflow_ng_privatemsg($message, $op) {  
+  if (module_exists('workflow_ng')) {    
+    $userA = user_load(array('uid' => $message->uid));
+    $userB = user_load(array('uid' => $message->recipient));
+    $privatemsginfo = array();
+    $privatemsginfo['message'] = $message->message;
+    $privatemsginfo['subject'] = $message->subject;
+    workflow_ng_invoke_event('privatemsg_'.$op, $userA, $userB, $privatemsginfo);   
+  }
+}
+
+/**
+ * Implementation of hook_configuration()
+ */
+function pm_workflow_ng_configuration() {
+  $configurations = array (
+  'cfg_1' => 
+  array (
+    '#type' => 'configuration',
+    '#altered' => false,
+    '#event' => 'privatemsg_sent',
+    '#label' => '[MAIL] UserB gets privatemsg from UserA',
+    '#active' => 1,
+    '#module' => 'workflow-ng',
+    0 => 
+    array (
+      '#type' => 'action',
+      '#name' => 'workflow_ng_action_mail_to_user',
+      '#argument map' => 
+      array (
+        'userB' => 'user',
+      ),
+      '#settings' => 
+      array (
+        'from' => '[userA:site-mail]',
+        'from_args' => 
+        array (
+          0 => 'userA',
+        ),
+        'subject' => '[userA:site-name]: new message from [userA:user]',
+        'subject_args' => 
+        array (
+          0 => 'userA',
+        ),
+        'message' => 'Hi [userB:user],
+
+you got a new private message from [userA:user].
+
+**************************
+subject: [privatemsginfo:subject]
+message:
+[privatemsginfo:message]
+**************************
+
+your
+[userA:site-name] team',
+        'message_args' => 
+        array (
+          0 => 'userA',
+          1 => 'userB',
+          2 => 'privatemsginfo',
+        ),
+      ),
+      '#label' => 'Send a mail to a user',
+    ),
+    1 => 
+    array (
+      '#type' => 'action',
+      '#name' => 'workflow_ng_action_watchdog',
+      '#settings' => 
+      array (
+        'severity' => '0',
+        'type' => 'workflow-ng',
+        'message' => '[userB:user] ([userB:uid]) got a privatemsg from [userA:user] ([userA:uid])',
+        'link' => '',
+        'message_args' => 
+        array (
+          0 => 'userA',
+          1 => 'userB',
+        ),
+        'link_args' => 
+        array (
+        ),
+      ),
+    ),
+    '#name' => 'cfg_1',
+  ),
+);
+  
+  return $configurations;	
+}
+
+
+
Index: pm_workflow_ng/pm_workflow_ng_token.inc
===================================================================
RCS file: pm_workflow_ng/pm_workflow_ng_token.inc
diff -N pm_workflow_ng/pm_workflow_ng_token.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pm_workflow_ng/pm_workflow_ng_token.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * This include file implements token functionality on behalf of the
+ * privatemsg.module 
+ */
+ 
+/**
+ * Implementation of hook_token_values()
+ */
+function pm_workflow_ng_token_values($type, $object = NULL) {
+  if ($type == 'privatemsginfo') {
+    $tokens['message'] = check_plain($object['message']);
+    $tokens['subject'] = check_plain($object['subject']);
+    return $tokens;
+  }
+}
+
+/**
+ * Implementation of hook_token_values()
+ */ 
+function pm_workflow_ng_token_list($type = 'all') {
+  if ($type == 'privatemsginfo' || $type == 'all') {
+    $tokens['privatemsginfo']['message'] = t("Message which is send by userA to userB");
+    $tokens['privatemsginfo']['subject'] = t("Subject of message");
+    return $tokens;
+  }
+}
Index: pm_workflow_ng/pm_workflow_ng.info
===================================================================
RCS file: pm_workflow_ng/pm_workflow_ng.info
diff -N pm_workflow_ng/pm_workflow_ng.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pm_workflow_ng/pm_workflow_ng.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,4 @@
+name = Private message workflow-ng 
+description = implements workflow-ng functionality 
+dependencies = token workflow_ng privatemsg
+package = Mail