diff -rupN role_expire_orig/role_expire.module role_expire/role_expire.module
--- role_expire.module	2010-06-20 22:47:16.000000000 +0200
+++ role_expire.module	2010-06-22 14:55:29.437500000 +0200
@@ -155,6 +155,15 @@ function role_expire_get_expired($time =
  ******************************************************************************/
 
 /**
+ * Implementation of hook_init().
+ */
+function role_expire_init() {
+  if (module_exists('token')) {
+    require_once dirname(__FILE__).'/role_expire.token.inc';
+  }
+}
+
+/**
  * Implementation of hook_views_api().
  */
 function role_expire_views_api() {
@@ -356,6 +365,7 @@ function role_expire_user($op, &$edit, &
  * Implementation of hook_cron().
  */
 function role_expire_cron() {
+  $rules_exists = module_exists('rules');
   if ($expires = role_expire_get_expired()) {
     $roles = _role_expire_get_role();
     foreach ($expires as $expire) {
@@ -363,6 +373,7 @@ function role_expire_cron() {
       // Remove the role from the user.
       $account = user_load($expire['uid']);
       $edit = $account->roles;
+      $trigger = array_key_exists($expire['rid'], $edit);
       unset($edit[$expire['rid']]);
       // In the documentation for the role_expire implementation of hook_user we
       // state to use $category = 'account'.  We don't do that here because
@@ -372,11 +383,17 @@ function role_expire_cron() {
       // Remove the role expiration record.
       role_expire_delete_record($expire['uid'], $expire['rid']);
       watchdog('role expire', 'Remove role @role from user @account.', array('@role' => $roles[$expire['rid']], '@account' => $account->name));
+
+      if ($rules_exists && $trigger) {
+        rules_invoke_event('role_expire_role_expired', array(
+          'account' => &$account,
+          'role' => (object)array('rid' => $expire['rid'], 'name' => $roles[$expire['rid']]),
+        ));
+      }
     }
   }
 }
 
-
 /**
  * Add form element that accepts the role expiration time.
  *
diff -rupN role_expire_orig/role_expire.rules.inc role_expire/role_expire.rules.inc
--- role_expire.rules.inc	2010-03-07 20:23:52.000000000 +0100
+++ role_expire.rules.inc	2010-06-22 14:55:51.937500000 +0200
@@ -7,6 +7,50 @@
  */
 
 /**
+ * Implementation of hook_rules_event_info().
+ */
+function role_expire_rules_event_info() {
+  return array(
+    'role_expire_role_expired' => array(
+      'label' => t('Role has expired'),
+      'module' => 'Role Expire',
+      'arguments' => array(
+        'account' => array('type' => 'user', 'label' => t('user whose role has expired')),
+        'role' => array('type' => 'role_expire_role', 'label' => t('expired role')),
+      ),
+    ),
+  );
+}
+
+/**
+ * Implementation of hook_rules_data_type_info().
+ */
+function role_expire_rules_data_type_info() {
+  return array(
+    'role_expire_role' => array(
+      'label' => t('role'),
+      'class' => 'role_expire_rules_data_type_role',
+      'savable' => FALSE,
+      'identifiable' => TRUE,
+    ),
+  );
+}
+
+/**
+ * Defines the role data type
+ */
+class role_expire_rules_data_type_role extends rules_data_type {
+  function load($rid) {
+    return db_fetch_object(db_query('SELECT rid, name FROM {role} WHERE rid = %d', $rid));
+  }
+
+  function get_identifier() {
+    $role = $this->get();
+    return $role->rid;
+  }
+}
+
+/**
  * Implementation of hook_rules_action_info().
  */
 function role_expire_rules_action_info() {
diff -rupN role_expire_orig/role_expire.token.inc role_expire/role_expire.token.inc
--- role_expire.token.inc	1970-01-01 01:00:00.000000000 +0100
+++ role_expire.token.inc	2010-06-22 15:02:19.968750000 +0200
@@ -0,0 +1,30 @@
+<?php
+//$Id$
+
+/**
+ * @file
+ * Token module integration.
+ */
+
+/**
+ * Implementation of hook_token_values().
+ */
+function role_expire_token_values($type, $object = NULL) {
+  $values = array();
+  if ($type == 'role_expire_role') {
+    $values['rid']  = $object->rid;
+    $values['name'] = $object->name;
+  }
+  return $values;
+}
+
+/**
+ * Implementation of hook_token_list().
+ */
+function role_expire_token_list($type = 'all') {
+  if ($type == 'role_expire_role' || $type == 'all') {
+    $tokens['role_expire_role']['rid']  = t('Role ID');
+    $tokens['role_expire_role']['name'] = t('Role name');
+  }
+  return $tokens;
+}
\ No newline at end of file
