really close #231
authorx2000habouzit <x2000habouzit>
Sat, 27 Nov 2004 16:19:28 +0000 (16:19 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 27 Nov 2004 16:19:28 +0000 (16:19 +0000)
htdocs/listes/moderate.php
scripts/mailman/mailman-rpc.py

index 27fd105..94b7ddc 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: moderate.php,v 1.23 2004-11-27 16:01:03 x2000habouzit Exp $
+        $Id: moderate.php,v 1.24 2004-11-27 16:19:28 x2000habouzit Exp $
  ***************************************************************************/
 
 if(empty($_REQUEST['liste'])) header('Location: index.php');
@@ -132,11 +132,6 @@ if(isset($_REQUEST['sid'])) {
         $page->assign_by_ref('mail', $mail);
     } else {
        if(list($subs,$mails) = $client->get_pending_ops($liste)) {
-            foreach ($subs as $key=>$val) {
-                if (preg_match('/^([^.]*\.[^.]*\.\d\d\d\d)@polytechnique.org$/', $subs['addr'], $matches)) {
-                    $subs[$key]['login'] = $matches[1];
-                }
-            }
            $page->assign_by_ref('subs', $subs);
            $page->assign_by_ref('mails', $mails);
        } else
index c764184..32caa5a 100755 (executable)
 #*  Foundation, Inc.,                                                      *
 #*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
 #***************************************************************************
-#   $Id: mailman-rpc.py,v 1.81 2004-11-18 17:39:11 x2000habouzit Exp $
+#   $Id: mailman-rpc.py,v 1.82 2004-11-27 16:19:28 x2000habouzit Exp $
 #***************************************************************************
 
-import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha, signal
+import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha, signal, re
 
 sys.path.append('/usr/lib/mailman/bin')
 
@@ -453,7 +453,11 @@ def get_pending_ops(userdesc,perms,vhost,listname):
                 dosave = True
                 continue
             seen.append(addr)
-            subs.append({'id': id, 'name': quote(fullname), 'addr': addr })
+            try:
+                login = re.match("^[^.]*\.[^.]*\.\d\d\d\d$", addr.split('@')[0]).group()
+                subs.append({'id': id, 'name': quote(fullname), 'addr': addr, 'login': login })
+            except:
+                subs.append({'id': id, 'name': quote(fullname), 'addr': addr })
 
         helds = []
         for id in mlist.GetHeldMessageIds():