diff -upr mailing_list_orig/mailing_list.admin.inc mailing_list/mailing_list.admin.inc
--- mailing_list_orig/mailing_list.admin.inc	2009-08-05 06:01:16.000000000 +0530
+++ mailing_list/mailing_list.admin.inc	2010-06-04 15:59:57.000000000 +0530
@@ -20,7 +20,7 @@ function mailing_list_lists() {
   $rows = array();
   $destination = drupal_get_destination();
   while ($list = db_fetch_object($result)) {
-    $row = array(l(check_plain($list->name), "admin/build/mailing-list/$list->mlid"), l(t('list e-mails'), "admin/build/mailing-list/$list->mlid"), l(t('import e-mails'), "admin/build/mailing-list/$list->mlid/import", array('query' => $destination)), l(t('export list'), "admin/build/mailing-list/$list->mlid/export", array('query' => $destination)), l(t('rename list'), "admin/build/mailing-list/$list->mlid/edit", array('query' => $destination)), l(t('delete list'), "admin/build/mailing-list/$list->mlid/delete", array('query' => $destination)));
+    $row = array(l($list->name, "admin/build/mailing-list/$list->mlid"), l(t('Members list'), "admin/build/mailing-list/$list->mlid"), l(t('Import e-mails'), "admin/build/mailing-list/$list->mlid/import", array('query' => $destination)), l(t('Export list'), "admin/build/mailing-list/$list->mlid/export", array('query' => $destination)), l(t('Edit list'), "admin/build/mailing-list/$list->mlid/edit", array('query' => $destination)), l(t('Delete list'), "admin/build/mailing-list/$list->mlid/delete", array('query' => $destination)));
     $rows[] = $row;
   }
 
@@ -52,7 +52,7 @@ function mailing_list_emails($list = NUL
   $header = array(
     array('data' => t('E-mail'), 'field' => 'mail', 'sort' => 'asc'),
     array('data' => t('Name'), 'field' => 'name'),
-    array('data' => t('Operations'), 'colspan' => '2')
+    array('data' => t('Operations'), 'colspan' => '1')
   );
   $sql .= tablesort_sql($header);
   $result = pager_query($sql, 50, 0 , NULL, array($list->mlid));
@@ -60,7 +60,7 @@ function mailing_list_emails($list = NUL
   $rows = array();
   $destination = drupal_get_destination();
   while ($data = db_fetch_object($result)) {
-    $row = array(check_plain($data->mail), (!empty($data->name) ? check_plain($data->name) : theme('placeholder', t('none'))), l(t('edit'), "admin/build/mailing-list/$list->mlid/$data->eid", array('query' => $destination)), l(t('delete'), "admin/build/mailing-list/$list->mlid/$data->eid/delete", array('query' => $destination)));
+    $row = array(check_plain($data->mail), (!empty($data->name) ? check_plain($data->name) : theme('placeholder', t('none'))), l(t('Unsubscribe'), "admin/build/mailing-list/$list->mlid/$data->eid/delete", array('query' => $destination)));
     $rows[] = $row;
   }
 
@@ -78,7 +78,7 @@ function mailing_list_emails($list = NUL
 /**
  * Form for adding / renaming a mailing list.
  */
-function mailing_list_form(&$form_state, $list = null) {
+function mailing_list_form(&$form_state, $list = NULL) {
   if (empty($list)) {
     drupal_set_title(t('Add mailing list'));
   }
@@ -90,7 +90,7 @@ function mailing_list_form(&$form_state,
   if (isset($form_state['values']['mlid']) || isset($list)) {
     $form['mlid'] = array(
       '#type' => 'hidden',
-      '#value' => isset($form_state['values']['mlid']) ? $form_state['values']['mlid'] : isset($list) ? $list->mlid: null,
+      '#value' => isset($form_state['values']['mlid']) ? $form_state['values']['mlid'] : isset($list) ? $list->mlid: NULL,
     );
   }
 
@@ -98,7 +98,38 @@ function mailing_list_form(&$form_state,
     '#title' => t('List name'),
     '#type' => 'textfield',
     '#required' => TRUE,
-    '#default_value'=> isset($form_state['values']['name']) ? $form_state['values']['name']: isset($list)?$list->name : '',
+    '#default_value'=> isset($form_state['values']['name']) ? $form_state['values']['name'] : isset($list) ? $list->name : '',
+  );
+  $form['webadmin'] = array(
+    '#title' => t('Admin web page'),
+    '#type' => 'textfield',
+    '#required' => TRUE,
+    '#description' => t("Mailman admin web page. The url has to be avaiable from your drupal web server ip. It's highly recommended to use the https protocol if your server supports it. Set empty to disable this list. Example: https://www.mysite.com/cgi-bin/mailman/admin/mylist."),
+    '#default_value'=> isset($form_state['values']['webadmin']) ? $form_state['values']['webadmin'] : isset($list) ? $list->webadmin : '',
+  );
+  $form['webpass'] = array(
+    '#title' => t('Admin web password'),
+    '#description' => t('Mailman administrator web password.'),
+    '#type' => 'password_confirm',
+    '#size' => 15,
+  );
+  $form['user_invite'] = array(
+    '#title' => t('Only invite users'),
+    '#default_value' => isset($form_state['values']['user_invite']) ? $form_state['values']['user_invite'] : isset($list) ? $list->user_invite : 0,
+    '#description' => t('Just invite new users instead of subscribing them?'),
+    '#type' => 'checkbox',
+  );
+  $form['user_notify'] = array(
+    '#title' => t('Notify users'),
+    '#default_value' => isset($form_state['values']['user_notify']) ? $form_state['values']['user_notify'] : isset($list) ? $list->user_notify : 1,
+    '#description' => t('Send welcome messages to the new subscribee?'),
+    '#type' => 'checkbox',
+  );
+  $form['user_admin_notify'] = array(
+    '#title' => t('Notify mailman administrators'),
+    '#default_value' => isset($form_state['values']['user_admin_notify']) ? $form_state['values']['user_admin_notify'] : isset($list) ? $list->user_admin_notify : 1,
+    '#description' => t('Send notifications of new subscription to the list owner?'),
+    '#type' => 'checkbox',
   );
   $form['submit'] = array(
     '#value' => t('Save'),
@@ -116,12 +147,29 @@ function mailing_list_form(&$form_state,
 function mailing_list_form_submit($form, &$form_state) {
 //    drupal_set_message('<pre>'. print_r($form_state['values'],1 ) . '</pre>');
   if (isset($form_state['values']['mlid'])) {
+    $values = array(
+      $form_state['values']['name'],
+      $form_state['values']['webadmin'],
+      $form_state['values']['user_invite'],
+      $form_state['values']['user_notify'],
+      $form_state['values']['user_admin_notify'],
+      $form_state['values']['mlid'],
+    );
+    $query = 'UPDATE {mailing_list} SET ';
+    if (!empty($form_state['values']['webpass'])) {
+      $query .= "webpass = '%s', ";
+      array_unshift($values, $form_state['values']['webpass']);
+    } 
+    $query .= "name ='%s', webadmin = '%s', user_invite = %d, user_notify = %d, user_admin_notify =%d WHERE mlid = %d";
+    $result = db_query($query, $values);
+    
+    
     $query = "UPDATE {mailing_list} SET name = '%s' WHERE mlid = %d";
     $result = db_query($query, $form_state['values']['name'], $form_state['values']['mlid']);
   }
   else {
-    $query = "INSERT INTO {mailing_list} (name) VALUES ('%s')";
-    $result = db_query($query, $form_state['values']['name']);
+    $query = "INSERT INTO {mailing_list} (name, webadmin, webpass, user_invite, user_notify, user_admin_notify) VALUES ('%s', '%s', '%s', %d, %d, %d)";
+    $result = db_query($query, $form_state['values']['name'], $form_state['values']['webadmin'], $form_state['values']['webpass'], $form_state['values']['user_invite'], $form_state['values']['user_notify'], $form_state['values']['user_admin_notify']);
   }
 
   if ($result) {
@@ -147,7 +195,7 @@ function mailing_list_form_submit($form,
 /**
  * Form to add / edit an e-mail in a mailing list.
  */
-function mailing_list_email_form(&$form_state, $list = null, $email = null) {
+function mailing_list_email_form(&$form_state, $list = NULL, $email = NULL) {
   if (empty($list)) {
     return;
   }
@@ -163,19 +211,19 @@ function mailing_list_email_form(&$form_
   if (isset($form_state['values']['mlid']) || isset($list)) {
     $form['mlid']   = array(
       '#type' => 'hidden',
-      '#value' => isset($form_state['values']['mlid']) ? $form_state['values']['mlid'] : isset($list) ? $list->mlid: null,
+      '#value' => isset($form_state['values']['mlid']) ? $form_state['values']['mlid'] : isset($list) ? $list->mlid: NULL,
     );
   }
   if (isset($form_state['values']['ml_name']) || isset($list)) {
     $form['ml_name']   = array(
       '#type' => 'hidden',
-      '#value' => isset($form_state['values']['ml_name']) ? $form_state['values']['ml_name'] : isset($list) ? $list->name: null,
+      '#value' => isset($form_state['values']['ml_name']) ? $form_state['values']['ml_name'] : isset($list) ? $list->name: NULL,
     );
   }
   if (isset($form_state['values']['eid']) || isset($email)) {
     $form['eid'] = array(
       '#type' => 'hidden',
-      '#value' => isset($form_state['values']['eid']) ? $form_state['values']['eid'] : isset($email) ? $email->eid: null,
+      '#value' => isset($form_state['values']['eid']) ? $form_state['values']['eid'] : isset($email) ? $email->eid: NULL,
     );
   }
   $form['mail'] = array(
@@ -204,12 +252,17 @@ function mailing_list_email_form(&$form_
  */
 function mailing_list_email_form_submit($form, &$form_state) {
   if (isset($form_state['values']['eid'])) {
-    $query = "UPDATE {mailing_list_emails} SET name = '%s', mail = '%s' WHERE eid = %d";
-    $result = db_query($query, $form_state['values']['name'], $form_state['values']['mail'], $form_state['values']['eid']);
+    // todo need to add unsubscribe function and then subscribe
+   // $query = "UPDATE {mailing_list_emails} SET name = '%s', mail = '%s' WHERE eid = %d";
+   // $result = db_query($query, $form_state['values']['name'], $form_state['values']['mail'], $form_state['values']['eid']);
   }
   else {
-    $query = "INSERT INTO {mailing_list_emails} (mlid, name, mail) VALUES (%d, '%s', '%s')";
-    $result = db_query($query, $form_state['values']['mlid'], $form_state['values']['name'], $form_state['values']['mail']);
+    $s_status = 1; //1 subscribe  2 unsubscribe 
+    $mail_su_st = mailing_list_subscription($form_state['values']['mlid'], $form_state['values']['name'], $form_state['values']['mail'], $s_status);
+    if ($mail_su_st==1) {
+      $query = "INSERT INTO {mailing_list_emails} (mlid, name, mail) VALUES (%d, '%s', '%s')";
+      $result = db_query($query, $form_state['values']['mlid'], $form_state['values']['name'], $form_state['values']['mail']);
+    }
   }
 
   $name = mailing_list_email_get_name($form_state['values']);
@@ -219,7 +272,7 @@ function mailing_list_email_form_submit(
       watchdog('mailing_list', 'Mailing list: updated e-mail for %name.', array('%name' => $name), WATCHDOG_NOTICE, l(t('view'), 'admin/build/mailing-list/'. $form_state['values']['mlid'] .'/'. $form_state['values']['eid']));
     }
     else {
-      drupal_set_message(t('Added e-mail for %name', array('%name' => $name)));
+      drupal_set_message(t('%name successfully subscribed to the mailing list', array('%name' => $name)));
       watchdog('mailing_list', 'Mailing list: added e-mail for %name.', array('%name' => $name));
     }
   }
@@ -228,7 +281,9 @@ function mailing_list_email_form_submit(
       drupal_set_message(t('Failed to update e-mail for %name', array('%name' => $name)), 'error');
     }
     else {
-      drupal_set_message(t('Failed to add e-mail for %name', array('%name' => $name)), 'error');
+      
+      drupal_set_message(t('Unable to subscribe, e-mail for %name to the mailing list', array('%name' => $name)), 'error');
+
     }
   }
 }
@@ -241,7 +296,7 @@ function mailing_list_delete_confirm($fo
     $form['mlid'] = array('#type' => 'value', '#value' => $list->mlid);
     $form['name'] = array('#type' => 'value', '#value' => $list->name);
     $output = confirm_form($form,
-      t('Are you sure you want to delete mailing list %name? All e-mails in this list will be deleted too.', array('%name' => $list->name)),
+      t('Are you sure you want to delete mailing list %name? All e-mails in this list will be unsubscribed too.', array('%name' => $list->name)),
       isset($_GET['destination']) ? $_GET['destination'] : 'admin/build/mailing-list');
   }
   return $output;
@@ -269,8 +324,9 @@ function mailing_list_email_delete_confi
     $form['mlid'] = array('#type' => 'value', '#value' => $list->mlid);
     $form['eid'] = array('#type' => 'value', '#value' => $email->eid);
     $form['name'] = array('#type' => 'value', '#value' => $name);
+    $form['mail'] = array('#type' => 'value', '#value' => $email->mail);
     $output = confirm_form($form,
-      t('Are you sure you want to delete the e-mail for %name?', array('%name' => $name)),
+      t('Are you sure you want to unsubscribe %name?', array('%name' => $name)),
       isset($_GET['destination']) ? $_GET['destination'] : 'admin/build/mailing-list/'. $list->mlid);
   }
   return $output;
@@ -281,8 +337,10 @@ function mailing_list_email_delete_confi
  */
 function mailing_list_email_delete_confirm_submit($form, &$form_state) {
   if ($form_state['values']['confirm']) {
+    $s_status = 2; //1 subscribe  2 unsubscribe
+    mailing_list_subscription($form_state['values']['mlid'], $form_state['values']['name'], $form_state['values']['mail'], $s_status);
     mailing_list_email_delete($form_state['values']['eid']);
-    drupal_set_message(t('E-mail deleted for %name', array('%name' => $form_state['values']['name'])));
+    drupal_set_message(t('%name successfully unsubscribed to the mailing list', array('%name' => $form_state['values']['name'])));
     $form_state['redirect'] = 'admin/build/mailing-list/'. $form_state['values']['mlid'];
     watchdog('mailing list', 'Mailing list: deleted e-mail %name.', array('%name' => $form_state['values']['name']));
     return;
@@ -296,6 +354,12 @@ function mailing_list_email_delete_confi
  *   The ID of the mailing list.
  */
 function mailing_list_delete($mlid) {
+  //Unsubscribe all users from the mailing list
+  $result = db_query('SELECT * FROM {mailing_list_emails} WHERE mlid = %d', $mlid);
+  $s_status = 2; //1 subscribe  2 unsubscribe
+  while ($list = db_fetch_array($result)) {
+    mailing_list_subscription($mlid, $list['name'], $list['mail'], $s_status);
+  }
   db_query('DELETE FROM {mailing_list_emails} WHERE mlid = %d', $mlid);
   db_query('DELETE FROM {mailing_list} WHERE mlid = %d', $mlid);
 }
@@ -325,13 +389,13 @@ function mailing_list_import_form($form_
   if ( isset($form_state['values']['mlid']) || isset($list) ) {
     $form['mlid']   = array(
       '#type'       => 'hidden',
-      '#value'      => isset($form_state['values']['mlid']) ? $form_state['values']['mlid'] : isset($list) ? $list->mlid: null,
+      '#value'      => isset($form_state['values']['mlid']) ? $form_state['values']['mlid'] : isset($list) ? $list->mlid: NULL,
     );
   }
   if ( isset($form_state['values']['name']) || isset($list) ) {
     $form['name']   = array(
       '#type'       => 'hidden',
-      '#value'      => isset($form_state['values']['name']) ? $form_state['values']['name'] : isset($list) ? $list->name: null,
+      '#value'      => isset($form_state['values']['name']) ? $form_state['values']['name'] : isset($list) ? $list->name: NULL,
     );
   }
   $form['file_upload'] = array(
@@ -352,21 +416,29 @@ function mailing_list_import_form_submit
   $num_imported = 0;
 
   if ($file = file_save_upload('file_upload', array('file_validate_extensions' => array('csv')))) {
-    ini_set('auto_detect_line_endings',TRUE);
+    ini_set('auto_detect_line_endings', TRUE);
+    $s_status = 1; //1 subscribe  2 unsubscribe 
+    $un_name = NULL;
     $handle = @fopen($file->filepath, 'r');
-
     while (($data = fgetcsv($handle)) !== FALSE) {
       $num_fields = count($data);
       $is_existing = db_fetch_object(db_query("SELECT * from {mailing_list_emails} WHERE mlid = %d AND mail = '%s'", $form_state['values']['mlid'], $data[0]));
       if (!$is_existing && $num_fields == 2) {
-        db_query("INSERT INTO {mailing_list_emails} (mlid, mail, name) VALUES (%d, '%s', '%s')", $form_state['values']['mlid'], $data[0], $data[1]);
-        $num_imported++;
+        $mail_su_st = mailing_list_subscription($form_state['values']['mlid'], $data[1], $data[0], $s_status);
+        if ($mail_su_st ==1) {
+          db_query("INSERT INTO {mailing_list_emails} (mlid, mail, name) VALUES (%d, '%s', '%s')", $form_state['values']['mlid'], $data[0], $data[1]);
+          $num_imported++;
+        }
+        else {
+           $un_name .= $data[0] .', ';
+        }
       }
     }
-
     fclose($handle);
-
     if ($num_imported) {
+      if ($un_name) {
+        drupal_set_message(t('Unable to subscribe these emails %name. Please try again', array('%name' => $un_name)));
+      }
       drupal_set_message(t('Import complete: %num-imported added to mailing list %name.', array('%num-imported' => format_plural($num_imported, '1 e-mail', '@count e-mails'), '%name' => $form_state['values']['name'])));
     }
   }
@@ -384,32 +456,95 @@ function mailing_list_import_form_submit
  * Menu callback; exports a mailing list directly to the user as a CSV file.
  */
 function mailing_list_export($list) {
-	$path = file_directory_path();
+  $path = file_directory_path();
+
+  // create file to hold email list
+  $filename = drupal_strtolower(str_replace(' ', '_', $list->name)) . '. csv';
+  $full_path = $path .'/'. $filename;
+
+  $query = "SELECT * FROM {mailing_list_emails} WHERE mlid = '%d'";
+  $result = db_query($query, $list->mlid);
 
-	// create file to hold email list
-	$filename = drupal_strtolower(str_replace(' ', '_', $list->name)). '.csv';
-	$full_path = $path.'/'.$filename;
-
-	$query = "SELECT * FROM {mailing_list_emails} WHERE mlid = '%d'";
-	$result = db_query($query, $list->mlid);
-
-	// create string with all the emails
-	$emails = array();
-	while ($row = db_fetch_object($result)) {
-		$emails[] = '"'. trim($row->mail) .'","'. trim($row->name) .'"';
-	}
-
-	$emails = implode("\n", $emails) ."\n";
-
-	// write resultant string to file
-	file_save_data($emails, $full_path, FILE_EXISTS_REPLACE);
-
-	// set headers for file transfer
-	$headers = array(
-		'Content-Type: application/octet-stream',
-		'Content-Disposition: attachment; filename="' . basename($full_path) . '";',
-		'Content-Length: ' . sprintf('%u', filesize($full_path)),
-	);
+  // create string with all the emails
+  $emails = array();
+  while ($row = db_fetch_object($result)) {
+    $emails[] = '"'. trim($row->mail) .'","'. trim($row->name) .'"';
+  }
+
+  $emails = implode("\n", $emails) ."\n";
+
+  // write resultant string to file
+  file_save_data($emails, $full_path, FILE_EXISTS_REPLACE);
+
+  // set headers for file transfer
+  $headers = array(
+    'Content-Type: application/octet-stream',
+    'Content-Disposition: attachment; filename="' . basename($full_path) . '";',
+    'Content-Length: ' . sprintf('%u', filesize($full_path)),
+  );
 
-	file_transfer($full_path, $headers);
+  file_transfer($full_path, $headers);
 }
+/**
+* function for mailing list subscription 
+*/
+function mailing_list_subscription($listid, $s_name, $s_mail, $sb_status) {
+  $result = db_query("SELECT * FROM {mailing_list} WHERE mlid=%d", $listid);
+  $list = db_fetch_array($result);
+  $msg      = '';
+  $email    = urlencode($s_mail);
+  $regurl   = rtrim($list['webadmin'], '/') .'/members';
+  $action   = t('successfully completed for');
+  switch ($sb_status) {
+    //subscribe
+    case 1:
+      if (!empty($s_name)) {
+        $email = urlencode($s_name .' <'. $s_mail .'>');
+      }
+      $regurl .= '/add?subscribe_or_invite='. $list['user_invite'];
+      $regurl .= '&send_welcome_msg_to_this_batch='. $list['user_notify'];
+      $regurl .= '&notification_to_list_owner='. $list['user_admin_notify'];
+      $regurl .= '&subscribees_upload='. $email;
+      break;
+    //unsubscribe  
+    case 2:
+      $regurl .= '/remove?send_unsub_ack_to_this_batch='. $list['user_notify'];
+      $regurl .= '&send_unsub_notifications_to_list_owner='. $list['user_admin_notify'];
+      $regurl .= '&unsubscribees_upload='. $email;
+      $msg .= t('Unsubscription to ');
+      break;  
+    default:
+      drupal_set_message(t('Unknown list subscription request.'), 'error');
+      return FALSE;  
+  }
+  $regurl .= '&adminpw='. urlencode($list['webpass']);
+  $httpreq = _mailinglist_register_parse_http($regurl, $s_name);
+  if ($httpreq->umr_ok) {
+    return TRUE;
+  }
+  else {
+    return FALSE;
+  }
+}
+  /**
+  *parse http request
+  */
+function _mailinglist_register_parse_http($regurl, $list) {
+  //Debug
+  //  drupal_set_message($regurl);
+  $httpobj = drupal_http_request($regurl);
+  $httpobj->umr_ok = 1;
+  $httpobj->umr_msg = "";
+  if ($httpobj->code <> 200 || !preg_match('/INPUT .*name="(findmember|setmemberopts)_btn"/i', $httpobj->data)) {
+    $httpobj->umr_ok = 0;
+    $httpobj->umr_usrmsg = t('Sorry, %name mailing list registration is currently unavailable. Please, try again shortly.', array('%name' => $list));
+    if (preg_match('/<input type="password".* name="adminpw"/i', $httpobj->data)) {
+      $httpobj->umr_admmsg = t('The administrator web password for !name list is invalid.', array('!name' => $list));
+    }
+    else {
+      $httpobj->umr_admmsg = t('No mailman web interface for !name list.', array('!name' => $list));
+    }
+  }
+  return $httpobj;
+}
+
diff -upr mailing_list_orig/mailing_list.install mailing_list/mailing_list.install
--- mailing_list_orig/mailing_list.install	2010-05-12 13:42:46.000000000 +0530
+++ mailing_list/mailing_list.install	2010-06-03 16:38:10.000000000 +0530
@@ -18,7 +18,7 @@ function mailing_list_install() {
  */
 function mailing_list_uninstall() {
   drupal_uninstall_schema('mailing_list');
-  db_query("DELETE FROM {block} WHERE module = 'mailing_list'");
+  db_query("DELETE FROM {blocks} WHERE module = 'mailing_list'");
 }
 
 /**
@@ -41,10 +41,48 @@ function mailing_list_schema() {
         'length' => 255,
         'not null' => TRUE,
       ),
+      'webadmin' => array(
+        'description' => t('Web url of mailing list.'),
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+      ),
+      'webpass' => array(
+        'description' => t('Mailman admin password.'),
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+      ),
+      'user_invite' => array(
+        'type' => 'int',
+        'size' => 'tiny', 
+        'not null' => TRUE, 
+        'default' => 0, 
+        'description' => t("Mailman 'user invite' option")
+      ),
+      'user_notify' => array(
+        'type' => 'int', 
+        'size' => 'tiny', 
+        'not null' => TRUE, 
+        'default' => 1, 
+        'description' => t("Mailman 'user notify' option")
+      ),
+      'user_admin_notify' => array(
+        'type' => 'int', 
+        'size' => 'tiny', 
+        'not null' => TRUE, 
+        'default' => 0, 
+        'description' => t("Mailman 'admin notify' option")
+      ),
     ),
     'primary key' => array('mlid'),
     'indexes' => array(
       'name' => array('name'),
+      'webadmin' => array('webadmin'),
+      'webpass' => array('webpass'),
+      'user_invite' => array('user_invite'),
+      'user_notify' => array('user_notify'),
+      'user_admin_notify' => array('user_admin_notify'),
     ),
   );
   $schema['mailing_list_emails'] = array(
@@ -57,10 +95,10 @@ function mailing_list_schema() {
         'not null' => TRUE,
       ),
       'mlid' => array(
-      	'description' => t('The {mailing_list} this e-mail belongs to.'),
-      	'type' => 'int',
+        'description' => t('The {mailing_list} this e-mail belongs to.'),
+        'type' => 'int',
         'unsigned' => TRUE,
-      	'not null' => TRUE,
+        'not null' => TRUE,
         'default' => 0,
       ),
       'mail' => array(
@@ -167,3 +205,13 @@ function mailing_list_update_6000() {
 
   return $ret;
 }
+
+function mailing_list_update_6001() {
+  $ret = array();
+  db_add_field($ret, 'mailing_list', 'webadmin', array('type' => 'varchar', 'not null' => TRUE, 'length' => 255), array('indexes' => array('webadmin' => array('webadmin'))));
+  db_add_field($ret, 'mailing_list', 'webpass', array('type' => 'varchar', 'not null' => TRUE, 'length' => 255), array('indexes' => array('webpass' => array('webpass'))));
+  db_add_field($ret, 'mailman_lists', 'user_invite', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0, 'description' => t("Mailman 'user invite' option")), array('indexes' => array('user_invite' => array('user_invite'))));
+  db_add_field($ret, 'mailman_lists', 'user_notify', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 1, 'description' => t("Mailman 'user notify' option")), array('indexes' => array('user_notify' => array('user_notify'))));
+  db_add_field($ret, 'mailman_lists', 'user_admin_notify', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0, 'description' => t("Mailman 'admin notify' option")), array('indexes' => array('user_admin_notify' => array('user_admin_notify'))));
+  return $ret;
+}
diff -upr mailing_list_orig/mailing_list.module mailing_list/mailing_list.module
--- mailing_list_orig/mailing_list.module	2009-08-05 06:01:16.000000000 +0530
+++ mailing_list/mailing_list.module	2010-06-04 15:59:02.000000000 +0530
@@ -23,6 +23,13 @@ function mailing_list_perm() {
 }
 
 /**
+ * Implementation of hook_init().
+ */
+function mailing_list_init() {
+    require_once("./". drupal_get_path('module', 'mailing_list') ."/mailing_list.admin.inc");
+}
+
+/**
  * Implementation of hook_menu().
  */
 function mailing_list_menu() {
@@ -33,7 +40,6 @@ function mailing_list_menu() {
     'description' => t('Manage your mailing lists.'),
     'page callback' => 'mailing_list_lists',
     'access arguments' => array('administer mailing lists'),
-    'file' => 'mailing_list.admin.inc',
   );
   $items['admin/build/mailing-list/list'] = array(
     'title' => 'List',
@@ -41,61 +47,55 @@ function mailing_list_menu() {
     'weight' => -10,
   );
   $items['admin/build/mailing-list/add'] = array(
-    'title' => t('Add'),
+    'title' => t('Add Mailing List'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('mailing_list_form'),
     'access arguments' => array('administer mailing lists'),
     'type' => MENU_LOCAL_TASK,
-    'file' => 'mailing_list.admin.inc',
   );
   $items['admin/build/mailing-list/%mailing_list'] = array(
-    'title' => 'List e-mails',
+    'title' => 'Members list',
     'type' => MENU_CALLBACK,
     'page callback' => 'mailing_list_emails',
     'page arguments' => array(3),
     'access arguments' => array('administer mailing lists'),
-    'file' => 'mailing_list.admin.inc',
   );
   $items['admin/build/mailing-list/%mailing_list/list'] = array(
-    'title' => 'List e-mails',
+    'title' => 'Members list',
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -10,
   );
   $items['admin/build/mailing-list/%mailing_list/add'] = array(
-    'title' => t('Add e-mail'),
+    'title' => t('Subscribe'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('mailing_list_email_form', 3),
     'access arguments' => array('administer mailing lists'),
     'type' => MENU_LOCAL_TASK,
     'weight' => -5,
-    'file' => 'mailing_list.admin.inc',
   );
   $items['admin/build/mailing-list/%mailing_list/import'] = array(
-  	'title' => t('Import e-mails'),
-  	'page callback' => 'drupal_get_form',
+    'title' => t('Import e-mails'),
+    'page callback' => 'drupal_get_form',
     'page arguments' => array('mailing_list_import_form', 3),
-		'access arguments' => array('administer mailing lists'),
+    'access arguments' => array('administer mailing lists'),
     'type' => MENU_LOCAL_TASK,
     'weight' => -2,
-    'file' => 'mailing_list.admin.inc',
-	);
+  );
   $items['admin/build/mailing-list/%mailing_list/export'] = array(
-  	'title' => t('Export list'),
-  	'page callback' => 'mailing_list_export',
-		'page arguments' => array(3),
-		'access arguments' => array('administer mailing lists'),
-		'type' => MENU_LOCAL_TASK,
+    'title' => t('Export list'),
+    'page callback' => 'mailing_list_export',
+    'page arguments' => array(3),
+    'access arguments' => array('administer mailing lists'),
+    'type' => MENU_LOCAL_TASK,
     'weight' => 0,
-    'file' => 'mailing_list.admin.inc',
-	);
-	$items['admin/build/mailing-list/%mailing_list/edit'] = array(
-    'title' => t('Rename list'),
+  );
+  $items['admin/build/mailing-list/%mailing_list/edit'] = array(
+    'title' => t('Edit list'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('mailing_list_form', 3),
     'access arguments' => array('administer mailing lists'),
     'type' => MENU_LOCAL_TASK,
     'weight' => 5,
-    'file' => 'mailing_list.admin.inc',
   );
   $items['admin/build/mailing-list/%mailing_list/delete'] = array(
     'title' => 'Delete list',
@@ -104,23 +104,13 @@ function mailing_list_menu() {
     'access arguments' => array('administer mailing lists'),
     'type' => MENU_LOCAL_TASK,
     'weight' => 10,
-    'file' => 'mailing_list.admin.inc',
-  );
-  $items['admin/build/mailing-list/%mailing_list/%mailing_list_email'] = array(
-    'title' => 'Edit e-mail',
-    'type' => MENU_CALLBACK,
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('mailing_list_email_form', 3, 4),
-    'access arguments' => array('administer mailing lists'),
-    'file' => 'mailing_list.admin.inc',
   );
   $items['admin/build/mailing-list/%mailing_list/%mailing_list_email/delete'] = array(
-    'title' => 'Delete e-mail',
+    'title' => 'Unsubscribe',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('mailing_list_email_delete_confirm', 3, 4),
     'access arguments' => array('administer mailing lists'),
     'type' => MENU_CALLBACK,
-    'file' => 'mailing_list.admin.inc',
   );
 
   return $items;
@@ -156,10 +146,12 @@ function mailing_list_block($op = 'list'
 
     case 'view':
       $list = mailing_list_load($delta);
-      $block = array(
-        'subject' => check_plain($list->name),
-        'content' => drupal_get_form('mailing_list_subscription_form_'. $delta),
-      );
+      if ($list) {
+        $block = array(
+          'subject' => check_plain($list->name),
+          'content' => drupal_get_form('mailing_list_subscription_form_'. $delta),
+        );
+      }
       break;
   }
 
@@ -288,14 +280,21 @@ function mailing_list_subscription_form_
  * Submit handler for the subscription form; saves a subscription.
  */
 function mailing_list_subscription_form_submit($form, &$form_state) {
-  if ($form_state['values']['mlid'] == null) {
+  if ($form_state['values']['mlid'] == NULL) {
     drupal_set_message(t('Unable to save mailing list subscription: no mailing list specified.'), 'error');
     return;
   }
-  $query = "INSERT INTO {mailing_list_emails} (mlid, name, mail) VALUES (%d, '%s', '%s')";
-  if (db_query($query, $form_state['values']['mlid'], $form_state['values']['name'], $form_state['values']['mail'])) {
-    drupal_set_message(t('Subscription for %mail saved.', array('%mail' => $form_state['values']['mail'])));
-    watchdog('mailing_list', 'Mailing list: %name added via subscription form.', array('%name' => $form_state['values']['mail']));
+  $s_status = 1; //1 subscribe  2 unsubscribe
+  $mail_su_st = mailing_list_subscription($form_state['values']['mlid'], $form_state['values']['name'], $form_state['values']['mail'], $s_status);
+  if ($mail_su_st==1) {
+    $query = "INSERT INTO {mailing_list_emails} (mlid, name, mail) VALUES (%d, '%s', '%s')";
+    if (db_query($query, $form_state['values']['mlid'], $form_state['values']['name'], $form_state['values']['mail'])) {
+      drupal_set_message(t('Subscription for %mail saved.', array('%mail' => $form_state['values']['mail'])));
+      watchdog('mailing_list', 'Mailing list: %name added via subscription form.', array('%name' => $form_state['values']['mail']));
+    }
+    else {
+      drupal_set_message(t('Failed to subscribe to mailing list %name.', array('%name' => $form_state['values']['ml_name'])), 'error');
+    }
   }
   else {
     drupal_set_message(t('Failed to subscribe to mailing list %name.', array('%name' => $form_state['values']['ml_name'])), 'error');
