Index: buddylist/buddylist.module
===================================================================
--- buddylist/buddylist.module	(revision 583)
+++ buddylist/buddylist.module	(working copy)
@@ -805,10 +805,57 @@
 
   $output .= theme('pager', NULL, $buddies_per_page);
 
+  if ($viewing_own_account) {
+    $output .= '<br />' . drupal_get_form('buddylist_add_buddy_form');
+  }
+  
   return $output;
 }
 
 /**
+ * Provides the Add Buddy form to drupal_get_form().
+ */
+function buddylist_add_buddy_form() {
+  return array(
+    'add_buddy' => array(
+    	'#type' => 'fieldset',
+    	'#title' => t('Add New @Buddy', buddylist_translation()),
+    	'#description' => t('Use this form to quickly add a @buddy if you already know their name.', buddylist_translation()),
+    	'#collapsible' => TRUE,
+    	'#collapsed' => FALSE,
+    	'buddy_name' => array(
+    	  '#type' => 'textfield',
+    	  '#title' => t('@Buddy Name', buddylist_translation()),
+    	  '#autocomplete_path' => 'user/autocomplete',
+    	),
+    	'submit' => array(
+    		'#type' => 'submit',
+    		'#value' => t('Add @Buddy', buddylist_translation()),
+    	),
+    ),
+  );
+}
+
+/**
+ * Implementation of hook_validate().
+ */
+function buddylist_add_buddy_form_validate($form_id, $form_values) {
+  if ($form_values['buddy_name'] == '') {
+    form_set_error('', t('You must provide the name of the buddy you wish to add.'));
+  } else if (!user_load(array('name' => $form_values['buddy_name']))) {
+    form_set_error('', t('The name of the buddy you provided does not exist.'));
+  }
+}
+
+/**
+ * Implementation of hook_submit().
+ */
+function buddylist_add_buddy_form_submit($form_id, $form_values) {
+  $user = user_load(array('name' => $form_values['buddy_name']));
+  buddylist_addbuddy_submit('buddylist_addbuddy', array('uid' => $user->uid));
+}
+
+/**
  * Returns a list of people who've requested to be added to the given user's buddylist
  * and a list of people who this given user has requested to be buddies with.
  */
