--- wlw_blogapi.module.original	2008-12-11 14:14:27.201576976 -0800
+++ wlw_blogapi.module	2008-12-12 22:56:59.400208302 -0800
@@ -279,7 +279,10 @@
   if (is_array($content)) {
     $node->title = $content['title'];
     $node->body = $content['description'];
-    _wlw_blogapi_mt_extra($node, $content);
+    $extra_error = _wlw_blogapi_mt_extra($node, $content);
+    if ($extra_error) {
+      return wlw_blogapi_error($extra_error);
+    }
   }
   else {
     $node->title = blogapi_blogger_title($content);
@@ -445,6 +448,10 @@
  * associated with a blog node.
  */
 function wlw_blogapi_metaweblog_get_category_list($blogid, $username, $password) {
+  $user = wlw_blogapi_validate_user($username, $password);
+  if (!$user->uid) {
+    return wlw_blogapi_error($user);
+  }
   $type = _wlw_blogapi_blogid($blogid);
   $vocabularies = module_invoke('taxonomy', 'get_vocabularies', $type, 'vid');
   $categories = array();
@@ -837,7 +844,11 @@
   // that allows free tagging that is assigned to the node type
   $vocabs = taxonomy_get_vocabularies($node->type);
   $vocab_to_use_for_tags = 0;
+  $required_vocabs = array();
   foreach ($vocabs as $vocab) {
+    if ($vocab->required) {
+      $required_vocabs[$vocab->vid] = $vocab->name;
+    }
     if ($vocab_to_use_for_tags) {
       continue;
     }
@@ -845,13 +856,35 @@
       $vocab_to_use_for_tags = $vocab->vid;
     }
   }
-  if ($vocab_to_use_for_tags) {
-    $tags = array();
-    foreach ($struct['categories'] as $tag) {
-      $tags[$vocab_to_use_for_tags] .= $tag .', ';
+  $tags = array();
+  $tids = array();
+  foreach ($struct['categories'] as $term) {
+    $matches = module_invoke('taxonomy', 'get_term_by_name', $term);
+    $found_matching_tid = 0;
+    foreach ($matches as $match) {
+      foreach ($vocabs as $vocab) {
+        if ($match->vid == $vocab->vid) {
+          $tids[] = $match->tid;
+          $found_matching_tid = 1;
+          if (array_key_exists($match->vid, $required_vocabs)) {
+            unset($required_vocabs[$match->vid]);
+          }
+        }
+      }
+    }
+    if (!$found_matching_tid) {
+      if ($vocab_to_use_for_tags) {
+        $tags[$vocab_to_use_for_tags] .= $term .', ';
+      }
+      else {
+        return t('No free-tagging vocabulary available for term: ') . $term;
+      }
     }
   }
-  $node->taxonomy = array('tags' => $tags);
+  if (count($required_vocabs) != 0) {
+    return t('No terms were specified in a required vocabulary: ') . implode(', ', array_values($required_vocabs));
+  }
+  $node->taxonomy = array('tags' => $tags, $tids);
   
   
   // set the nodewords variable, if the nodewords (Meta Tags) module
@@ -1037,4 +1070,4 @@
 </manifest>
 __manifest__;
   print $output;
-}
\ No newline at end of file
+}
