Index: talk.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/talk/talk.module,v
retrieving revision 1.6.2.14
diff -u -p -r1.6.2.14 talk.module
--- talk.module	19 Aug 2009 02:39:11 -0000	1.6.2.14
+++ talk.module	5 Mar 2010 08:24:25 -0000
@@ -78,6 +78,14 @@ function talk_admin_form() {
     '#default_value' => variable_get('talk_page_no_comments', TRUE),
     '#description' => t('If the talk page is shown when there are no comments, users will be able to add new comments from the talk page even when there are no comments; otherwise, comments will have to be added in a different method, such as via the "add new comment" link on nodes.'),
   );
+  if (module_exists('path')) {
+    $form['talk_pathauto_integration'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Generate an alias version of bla bla'),
+      '#default_value' => variable_get('talk_pathauto', FALSE),
+      '#description' => t('BLA BLA.'),
+    );
+  }
 
   return system_settings_form($form);
 }
@@ -113,6 +121,7 @@ function talk_handle($node) {
  * Implementation of hook_nodeapi().
  */
 function talk_nodeapi(&$node, $op) {
+  $language = isset($node->language) ? $node->language : '';
   switch ($op) {
     case 'load':
       if (talk_activated($node->type) && arg(0) == 'node' && !arg(2)) {
@@ -123,6 +132,23 @@ function talk_nodeapi(&$node, $op) {
         return $output;
       }
       break;
+    // Code for insert/update/delete heavvily borrowed from path.module
+    case 'insert':
+      if (isset($node->path)) {
+        path_set_alias('node/'. $node->nid . '/talk', $node->path . '/talk', NULL, $language);
+      }
+      break;
+
+    case 'update':
+      path_set_alias('node/'. $node->nid . '/talk', isset($node->path) ? $node->path . '/talk' : NULL, isset($node->talk_pid) ? $node->talk_pid : NULL, $language);
+      break;
+
+    case 'delete':
+      $path = 'node/'. $node->nid . '/talk';
+      if (drupal_get_path_alias($path) != $path) {
+        path_set_alias($path);
+      }
+      break;
   }
 }
 
@@ -195,6 +221,17 @@ function talk_form_alter(&$form, $form_s
       '#default_value' => talk_activated($form['#node_type']->type),
     );
   }
+  // Copied and adapted from path_form_alter: we need to pass the alias pid along in order to track
+  // changes to it and update/delete it accordingly.
+  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
+    $path = isset($form['#node']->path) ? $form['#node']->path .'/talk' : NULL;
+    if ($path) {
+      $form['path']['talk_pid'] = array(
+        '#type' => 'value',
+        '#value' => db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s' AND language = '%s'", $path, $form['#node']->language))
+      );
+    }
+  }
 }
 
 /**
Index: talk.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/talk/Attic/talk.test,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 talk.test
--- talk.test	19 Aug 2009 01:43:31 -0000	1.1.2.2
+++ talk.test	5 Mar 2010 08:24:26 -0000
@@ -66,4 +66,23 @@ class TalkTests extends DrupalWebTestCas
     $this->assertText($comment, t('Make sure the body of the comment appears'));
     $this->assertText($this->talkTitle, t('Make sure the talk title appears @title', array('@title' => str_replace('!count', 1, $this->talkTitle))));
   }
+
+  function testTalkPathSpecificSettingsAreNotVisibleIfPathModuleNotEnabled() {
+    $this->assertNoFieldById('#edit-talk-pathauto-integration');
+  }
+  function testTalkPathauto() {
+    parent::setUp('path');
+    // Create a node to test with.
+    $settings = array();
+    $settings['type'] = $this->talkType;
+    $settings['path[alias]'] = $path = $this->randomName(6);
+    $this->assertFieldById('#edit-path');
+    $node = $this->drupalCreateNode($settings);
+
+    $talk_path = $path . '/talk';
+    // Navigate to the node talk page.
+    $this->drupalGet($talk_path);
+    $this->assertStatus(200);
+//    $this->assertFieldByXPath('//a[href="'.$path.'/talk"]', NULL, "Found correct link");
+  }
 }
\ No newline at end of file
