--- inline.module.cvs	2006-05-04 03:03:00.000000000 +0200
+++ inline.module	2006-07-27 14:37:35.054592100 +0200
@@ -143,10 +143,10 @@ function _inline_fileobj(&$node, $id) {
 }
 
 function theme_inline_as_link($file) {
-  return l(($file->description ? $file->description : $file->name),
-    file_create_url($file->filepath),
-    array('title' => t('Download: %name (%size)',
-      array('%name' => $file->filename, '%size' => format_size($file->filesize)))));
+  // prepare link text with title or filename
+  $linktext = ($file->title ? $file->title : $file->name);
+  
+  return l($linktext, file_create_url($file->filepath), array('title' => t('Download: %name (%size)', array('%name' => $file->filename, '%size' => format_size($file->filesize)))));
 }
 
 function theme_inline_img($file) {
@@ -154,7 +154,7 @@ function theme_inline_img($file) {
     $html .= '<a href="'. file_create_url($file->filepath) . '" title="'.t("View").': '. $file->name .'">';
   }
 
-  $title = ( $file->description ? $file->description : $file->name );
+  $title = ( $file->title ? $file->title : $file->name );
 
   $html .= '<img style="width: '.$file->width.'px; height:'.$file->height.'px;" src="'. file_create_url($file->filepath). '" class="inline" alt="'. $title .'" title="'. $title.'" />';
 
@@ -220,10 +220,13 @@ function _inline_auto_add($node) {
 function _inline_substitute_tags(&$node, $field) {
   if (preg_match_all("/\[(inline|file|attachment):([^=\\]]+)=?([^\\]]*)?\]/i", $node->$field, $match)) {
     foreach ($match[2] as $key => $value) {
-      $map[$value] = $key;
-      $titl = $match[3][$key];
-      $ytype = $match[1][$key];
+      // fetch file object
       $file = _inline_fileobj($node, $value);
+      // deal file title
+      $title = $match[3][$key];
+      if (!empty( $title )) {
+        $file->title = $title;
+      }
       $replace = "";
       if ($file->fid != NULL) {
         //decide if we should show a link or an img tag
