--- buddylist.module.orig	2007-02-04 16:53:43.000000000 +0100
+++ buddylist.module	2007-02-07 01:55:43.000000000 +0100
@@ -311,6 +311,18 @@ function buddylist_admin_settings() {
     '#maxlength' => 128,
     '#description' => t('This will be the title for the @buddy list status block. If none is specified, "My @buddy list status" will be used.', buddylist_translation()),
   );
+  $form['block_settings']['buddylist_block_if_no_buddies'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show block even if @buddylist is empty', buddylist_translation()),
+    '#default_value' => variable_get('buddylist_block_if_no_buddies', FALSE),
+    '#description' => t('If a user has no @buddies, the @buddy block can show a message. Leaving unchecked, the block will not be displayed then.', buddylist_translation()),
+  );
+  $form['block_settings']['buddylist_empty_text'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Show this text if @buddylist is empty', buddylist_translation()),
+    '#default_value' => variable_get('buddylist_empty_text', t('This user hasn\'t added any @buddies yet.', buddylist_translation())),
+    '#description' => t('If a user has no @buddies, this message is shown instead of a list.', buddylist_translation()),
+  );
 
    $form['mail'] = array(
     '#type' => 'fieldset',
@@ -543,6 +555,7 @@ function buddylist_block($op = 'list', $
     switch ($delta) {
       case 0 : // Shows buddylist block
         if ($buddies = buddylist_get_buddies()) {
+          // we have buddies defined and generate the list
           $i = 0;
           foreach (array_keys($buddies) as $buddy) {
             $users[] = user_load(array('uid' => $buddy));
@@ -553,15 +566,25 @@ function buddylist_block($op = 'list', $
           }
 
           $block['content'] = theme('user_list', $users);
-          $block['subject'] = variable_get('buddylist_list_block_title', t('My @buddy list', buddylist_translation()));
+        } else {
+          // buddylist is empty
+          if(variable_get('buddylist_block_if_no_buddies', FALSE)) {
+            // Show a message that we have no buddies yet
+            $block['content'] = t(variable_get('buddylist_empty_text', ''), buddylist_translation());
+          } else {
+            // If no buddies defined and no message available, end 'case' without returning block.
+            break;
+          }
+        }
+        // this is the same output whether buddylist or not
+        $block['subject'] = variable_get('buddylist_list_block_title', t('My @buddy list', buddylist_translation()));
 
-          // check if a "more" link should generated by seeing if there are more buddies than the specified $upperlimit
-          if (count($buddies) > variable_get('buddylist_blocklisting_size', 5)) {
+        // check if a "more" link should generated by seeing if there are more buddies than the specified $upperlimit
+        if (count($buddies) > variable_get('buddylist_blocklisting_size', 5)) {
             $block['content'] .=  '<div class="more-link">' . l(t('more'), 'buddylist', array('title' => t('View more.'))) . '</div>';
-          }
-          return $block;
         }
-        break;
+        return $block;
+      break;
 
       case 1: // Shows my buddies recent posts block
         $buddies = buddylist_get_buddies();
@@ -732,7 +755,7 @@ function buddylist_buddylisting_page($ui
     $output .= theme('table', $header, $rows);
   }
   else {
-    $output .= t('No @buddies found.', buddylist_translation());
+    $output .= t(variable_get('buddylist_empty_text', 'No @buddies found'), buddylist_translation());
   }
 
   $output .= theme('pager', NULL, $buddies_per_page);
@@ -1550,4 +1573,13 @@ function buddylist_approval_mail_replace
     '@siteurl' => $GLOBALS["base_url"],
     '@adder_list_link' => url("buddylist/". $user->uid ."/buddies/list", NULL, NULL, TRUE),
   );
-}
\ Kein Zeilenumbruch am Dateiende.
+}
+
+function buddylist_empty_text_default() {
+  return <<<MESSAGE
+<p>You haven't made any @buddies, yet.</p>
+
+<p>You can add a buddy by visiting a user's profile page.</p>
+MESSAGE;
+}
+
