Changeset 1963

Show
Ignore:
Timestamp:
10/04/07 09:26:15 (7 months ago)
Author:
anarcat
Message:

push my "virtual mailman patch" supported in alternc

this changes the way lists are created and stored in the alternc
database to allow lists with similar names to exist on different domains
(ever wanted info@example.com and info@exemple.com be different lists?
this is it.) the stored "name" is foo-bar where the list address is
foo@bar.com

this patch therefore removes the "one list name per site" limitation
from alternc itself, but you need to patch mailman itself for it to
support that functionality.

see http://wiki.koumbit.net/VirtualMailman

this should work for both unpatched and patched mailman installations

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc-mailman/trunk/bureau/class/m_mailman.php

    r1810 r1963  
    2828 ---------------------------------------------------------------------- 
    2929*/ 
     30 
     31/* you need to set VHOST_PATCH=1 in your /etc/alternc/local.sh if you 
     32 * apply Koumbit's vhost mailman patch */ 
     33@define('L_VHOST_PATCH', 1) 
     34 
    3035class m_mailman { 
    3136 
     
    111116    global $db,$err,$quota,$mail,$cuid; 
    112117    $err->log("mailman","add_lst",$login."@".$domain." - ".$owner); 
     118    /* the list' internal name */ 
     119    if (L_VHOST_PATCH) { 
     120      $name = $login . '-' . $domain; 
     121    } else { 
     122      $name=$login; 
     123    } 
    113124 
    114125    if ($login=="") { 
     
    129140      return false; 
    130141    } 
    131     $db->query("SELECT COUNT(*) AS cnt FROM mailman WHERE list='$login';"); 
     142    $db->query("SELECT COUNT(*) AS cnt FROM mailman WHERE name='$name';"); 
    132143    $db->next_record(); 
    133144    if ($db->f("cnt")) { 
     
    154165      // Creation de la liste : 1. recherche du nom de la liste 
    155166      // CA NE MARCHE PAS ! 
    156       $name=$login; 
    157167      $db->query("INSERT INTO mailman (uid,list,domain,name) VALUES ('$cuid','$login','$domain','$name');"); 
    158168      if (!$mail->add_wrapper($login,$domain,"/var/lib/mailman/mail/mailman post $name","mailman") || 
     
    176186      } 
    177187      // Wrapper created, sql ok, now let's create the list :) 
    178       exec("/usr/lib/alternc/mailman.create \"".escapeshellcmd($name."@".$domain)."\" \"".escapeshellcmd($owner)."\" \"".escapeshellcmd($password)."\""); 
     188      exec("/usr/lib/alternc/mailman.create \"".escapeshellcmd($login."@".$domain)."\" \"".escapeshellcmd($owner)."\" \"".escapeshellcmd($password)."\""); 
    179189      return true; 
    180190    } else {