Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] r12664 - in branches/sympa-6.2-branch: default/mail_tt2 default/web_tt2 src/cgi src/lib/Sympa src/lib/Sympa/Request src/lib/Sympa/Spindle

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: David Verdin <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] r12664 - in branches/sympa-6.2-branch: default/mail_tt2 default/web_tt2 src/cgi src/lib/Sympa src/lib/Sympa/Request src/lib/Sympa/Spindle
  • Date: Fri, 5 Feb 2016 08:16:51 +0900

Hi David and developers,

2016/02/04 18:32、David Verdin <address@concealed> のメッセージ:

Thanks for this Soji!

I'll tag a new version pretty soon. Sorry it took so long between 6.2.12 and 6.2.13. I'm revewing/testing right now.

I synced the i18n catalogues in Pootle, so if you want to update your Japanese translation, Now might be agood time to do it.

Okey, I'll stop changing codes by next one commit today.  Remainder of changes will be done after release of 6.1.13. (I'll write what I really wanted to do by detour refactoring in these weeks).

Regards,

--- Soji

Best regards!

David

Le 04/02/2016 04:15, address@concealed a écrit :
Author: sikeda
Date: 2016-02-04 03:15:16 +0000 (Thu, 04 Feb 2016)
New Revision: 12664

Modified:
   branches/sympa-6.2-branch/default/mail_tt2/command_report.tt2
   branches/sympa-6.2-branch/default/web_tt2/error.tt2
   branches/sympa-6.2-branch/src/cgi/wwsympa.fcgi.in
   branches/sympa-6.2-branch/src/lib/Sympa/CommandDef.pm
   branches/sympa-6.2-branch/src/lib/Sympa/Request/Message.pm
   branches/sympa-6.2-branch/src/lib/Sympa/Spindle/AuthorizeRequest.pm
   branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DispatchRequest.pm
   branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DoCommand.pm
Log:
[-dev] Copyedit.  Sync tt2 entry names in code to process requests with those in WWSympa. 


Modified: branches/sympa-6.2-branch/default/mail_tt2/command_report.tt2
===================================================================
--- branches/sympa-6.2-branch/default/mail_tt2/command_report.tt2	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/default/mail_tt2/command_report.tt2	2016-02-04 03:15:16 UTC (rev 12664)
@@ -89,7 +89,7 @@
 [%- FOREACH u_err = user_errors -%]
 > [% u_err.cmd -%]
 
-[% IF u_err.entry == 'not_understood' -%]
+[% IF u_err.entry == 'unknown_action' -%]
   [%|loc%]Command not understood: ignoring end of message.[%END%]
 
 [% ELSIF u_err.entry == 'no_verify_sign' -%]
@@ -96,20 +96,19 @@
   [%|loc%]Your message was not a multipart/signed message or Sympa could not verify the signature 
 (be aware that Sympa can't check signature if you use the subject header to write a command).[%END-%]
 
-[% ELSIF u_err.entry == 'error_syntax' -%]
+[% ELSIF u_err.entry == 'syntax_errors' -%]
   [%|loc%]Command syntax error.[%END%]
 
-[% ELSIF u_err.entry == 'no_existing_list' -%]
+[% ELSIF u_err.entry == 'unknown_list' -%]
   [%|loc(u_err.listname)%]List '%1' does not exist.[%END%]
 
 [% ELSIF u_err.entry == 'no_subscriber_preference' -%]
   [%|loc(u_err.listname)%]%1 mailing list does not provide subscriber preferences.[%END%]
 
-[% ELSIF u_err.entry == 'your_email_not_found' -%]
-  [%|loc(u_err.email,u_err.listname)%]Your e-mail address %1 has not been found in the list %2. Maybe
-you subscribed from a different e-mail address ?[%END-%]
+[% ELSIF u_err.entry == 'not_subscriber' -%]
+  [%|loc(u_err.email,u_err.listname)%]Your e-mail address %1 has not been found in the list %2. Maybe you subscribed from a different e-mail address?[%END-%]
 
-[% ELSIF u_err.entry == 'email_not_found' -%]
+[% ELSIF u_err.entry == 'user_not_subscriber' -%]
   [%|loc(u_err.email,u_err.listname)%]E-mail address %1 has not been found in the list %2.[%END%]
 
 [% ELSIF u_err.entry == 'no_digest' -%]
@@ -116,7 +115,7 @@
   [%|loc(u_err.listname)%]List %1 does not accept the DIGEST mode. 
 Your configuration regarding this command has not been updated.[%END-%]
 
-[% ELSIF u_err.entry == 'available_reception_mode' -%]
+[% ELSIF u_err.entry == 'not_available_reception_mode' -%]
   [%|loc(u_err.listname)%]List %1 allows only these reception modes: [%END -%]
 [%- FOREACH m = u_err.reception_modes -%]
 [%- IF loop.size >= 2 && loop.count == loop.size -%]
@@ -158,11 +157,11 @@
   [%|loc(u_err.command)%]The authentication process failed. You probably confirmed your "%1" command using a different email address. Please try using your canonical address.[%END-%]
 [% END -%]
 
-[% ELSIF u_err.entry == 'unfound_message' -%]
+[% ELSIF u_err.entry == 'already_moderated' -%]
   [%|loc(u_err.listname,u_err.key)%]Unable to access the message on list %1 with  key %2.
 Warning: this message may already have been sent by one of the list's editor.[%END%]
 
-[% ELSIF u_err.entry == 'unfound_file_message' -%]
+[% ELSIF u_err.entry == 'already_confirmed' -%]
   [%|loc(u_err.key)%]Unable to access the message authenticated with key %1. The message may already been confirmed.[%END%]
 
 [% ELSE %]

Modified: branches/sympa-6.2-branch/default/web_tt2/error.tt2
===================================================================
--- branches/sympa-6.2-branch/default/web_tt2/error.tt2	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/default/web_tt2/error.tt2	2016-02-04 03:15:16 UTC (rev 12664)
@@ -70,10 +70,10 @@
   [% ELSIF u_err.msg == 'no_subscriber' %][%|loc%]List has no subscribers[%END%]
   [% ELSIF u_err.msg == 'no_page' %][%|loc(u_err.page)%]No page %1[%END%]
   [% ELSIF u_err.msg == 'no_filter' %][%|loc%]Missing filter[%END%]
-  [% ELSIF u_err.msg == 'not_subscriber' %]
-    [% IF u_err.email %]  [%|loc(u_err.email)%]Not subscribed: %1[%END%]
-    [% ELSE %][%|loc(u_err.list)%]You are not subscribed to list %1[%END%]
-    [% END %]
+  [% ELSIF u_err.msg == 'user_not_subscriber' ~%]
+    [%|loc(u_err.email)%]Not subscribed: %1[%END%]
+  [% ELSIF u_err.msg == 'not_subscriber' ~%]
+    [%|loc(u_err.list)%]You are not subscribed to list %1[%END%]
   [% ELSIF u_err.msg == 'custom_attribute' %][%|loc%]Check the additional information[%END%]
   [% ELSIF u_err.msg == 'not_available_reception_mode' %][%|loc(u_err.reception_mode)%]%1 is not an available reception mode[%END%]
   [% ELSIF u_err.msg == 'file_not_editable' %][%|loc(u_err.file)%]%1: file not editable[%END%]

Modified: branches/sympa-6.2-branch/src/cgi/wwsympa.fcgi.in
===================================================================
--- branches/sympa-6.2-branch/src/cgi/wwsympa.fcgi.in	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/src/cgi/wwsympa.fcgi.in	2016-02-04 03:15:16 UTC (rev 12664)
@@ -8402,7 +8402,7 @@
         my $user_entry = $list->get_list_member($email);
 
         unless (defined($user_entry)) {
-            Sympa::Report::reject_report_web('user', 'not_subscriber',
+            Sympa::Report::reject_report_web('user', 'user_not_subscriber',
                 {'email' => $email},
                 $param->{'action'}, $list);
 
@@ -11808,7 +11808,7 @@
         my $escaped_email = tools::escape_chars($email);
 
         unless ($list->is_list_member($email)) {
-            Sympa::Report::reject_report_web('user', 'not_subscriber',
+            Sympa::Report::reject_report_web('user', 'user_not_subscriber',
                 {'email' => $email},
                 $param->{'action'}, $list);
             wwslog('info', '%s not subscribed', $email);

Modified: branches/sympa-6.2-branch/src/lib/Sympa/CommandDef.pm
===================================================================
--- branches/sympa-6.2-branch/src/lib/Sympa/CommandDef.pm	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/src/lib/Sympa/CommandDef.pm	2016-02-04 03:15:16 UTC (rev 12664)
@@ -143,16 +143,22 @@
     set => {
         cmd_regexp => qr'set'i,
         arg_regexp =>
-            qr'(\S+)\s+(digest|digestplain|nomail|normal|not_me|each|mail|conceal|noconceal|summary|notice|txt|html|urlize)\s*\z'i,
-        arg_keys => [qw(localpart mode)],
+            qr'(\S+)\s+(?:(digest|digestplain|nomail|normal|not_me|each|mail|summary|notice|txt|html|urlize)|(conceal|noconceal))\s*\z'i,
+        arg_keys => [qw(localpart reception visibility)],
         filter   => sub {
             my $r = shift;
 
-            $r->{mode} = lc($r->{mode} || '');
-            # SET EACH is a synonym for SET MAIL.
-            $r->{mode} = 'mail'
-                if grep { $r->{mode} eq $_ }
-                    qw(each eachmail nodigest normal);
+            $r->{email} = $r->{sender};
+            if ($r->{reception}) {
+                $r->{reception} = lc $r->{reception};
+                # SET EACH is a synonym for SET MAIL.
+                $r->{reception} = 'mail'
+                    if grep { $r->{reception} eq $_ }
+                        qw(each eachmail nodigest normal);
+            }
+            if ($r->{visibility}) {
+                $r->{visibility} = lc $r->{visibility};
+            }
             $r;
         },
         # No scenario.  Only list members are allowed.
@@ -160,16 +166,22 @@
     global_set => {
         cmd_regexp => qr'set\s+[*]'i,
         arg_regexp =>
-            qr'(digest|digestplain|nomail|normal|not_me|each|mail|conceal|noconceal|summary|notice|txt|html|urlize)\s*\z'i,
-        arg_keys => [qw(mode)],
+            qr'(?:(digest|digestplain|nomail|normal|not_me|each|mail|summary|notice|txt|html|urlize)|(conceal|noconceal))\s*\z'i,
+        arg_keys => [qw(reception visibility)],
         filter   => sub {
             my $r = shift;
 
-            $r->{mode} = lc($r->{mode} || '');
-            # SET EACH is a synonym for SET MAIL.
-            $r->{mode} = 'mail'
-                if grep { $r->{mode} eq $_ }
-                    qw(each eachmail nodigest normal);
+            $r->{email} = $r->{sender};
+            if ($r->{reception}) {
+                $r->{reception} = lc $r->{reception};
+                # SET EACH is a synonym for SET MAIL.
+                $r->{reception} = 'mail'
+                    if grep { $r->{reception} eq $_ }
+                        qw(each eachmail nodigest normal);
+            }
+            if ($r->{visibility}) {
+                $r->{visibility} = lc $r->{visibility};
+            }
             $r;
         },
     },

Modified: branches/sympa-6.2-branch/src/lib/Sympa/Request/Message.pm
===================================================================
--- branches/sympa-6.2-branch/src/lib/Sympa/Request/Message.pm	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/src/lib/Sympa/Request/Message.pm	2016-02-04 03:15:16 UTC (rev 12664)
@@ -204,7 +204,7 @@
                 auth     => $auth,
                 cmd_line => $line,
                 context  => $robot,
-                error    => 'syntax_error',
+                error    => 'syntax_errors',
                 quiet    => $quiet,
                 (   map { ($_ => $message->{$_}) }
                         qw(date sender dkim_pass smime_signed)
@@ -228,7 +228,7 @@
             # Reject the command if this list is unknown to us.
             $request->{error} = 'unknown_list';
         } elsif ($filter and not $filter->($request)) {
-            $request->{error} = 'syntax_error';
+            $request->{error} = 'syntax_errors';
         }
 
         return $request;

Modified: branches/sympa-6.2-branch/src/lib/Sympa/Spindle/AuthorizeRequest.pm
===================================================================
--- branches/sympa-6.2-branch/src/lib/Sympa/Spindle/AuthorizeRequest.pm	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/src/lib/Sympa/Spindle/AuthorizeRequest.pm	2016-02-04 03:15:16 UTC (rev 12664)
@@ -144,10 +144,29 @@
             $that, $sender
         );
         return 'not_allowed';
-    } else {
-        #NOTREACHED
-        die 'bug in logic. Ask developer';
     }
+
+    $log->syslog(
+        'info',
+        '%s for %s from %s aborted, unknown requested action "%s" in scenario "%s"',
+        uc $request->{action},
+        $that,
+        $sender,
+        $action,
+        $scenario
+    );
+    my $error = sprintf 'Unknown requested action in scenario: %s',
+        $request->{action};
+    Sympa::send_notify_to_listmaster(
+        $request->{context},
+        'mail_intern_error',
+        {   error  => $error,
+            who    => $sender,
+            action =">" 'Command process',
+        }
+    );
+    $self->add_stash($request, 'intern');
+    return undef;
 }
 
 # Checks the authentication and return method

Modified: branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DispatchRequest.pm
===================================================================
--- branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DispatchRequest.pm	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DispatchRequest.pm	2016-02-04 03:15:16 UTC (rev 12664)
@@ -74,23 +74,18 @@
     my $self    = shift;
     my $request = shift;
 
-    my $robot =
-        (ref $request->{context} eq 'Sympa::List')
-        ? $request->{context}->{'domain'}
-        : ($request->{context} || '*');
     my $entry = $request->{error};
 
-    if ($entry eq 'syntax_error') {
-        $self->add_stash($request, 'user', 'error_syntax');
+    if ($entry eq 'syntax_errors') {
+        $self->add_stash($request, 'user', 'syntax_errors');
         $log->syslog('notice', 'Command syntax error');
     } elsif ($entry eq 'unknown_list') {
-        $self->add_stash($request, 'user', 'no_existing_list',
-            {'listname' => $request->{localpart}});
+        $self->add_stash($request, 'user', 'unknown_list');
         $log->syslog(
             'info',
             '%s from %s refused, unknown list for robot %s',
             uc $request->{action},
-            $request->{sender}, $robot
+            $request->{sender}, $request->{context}
         );
     } else {
         Sympa::send_notify_to_listmaster(
@@ -114,7 +109,7 @@
     my $request = shift;
 
     $log->syslog('notice', 'Unknown command found: %s', $request->{cmd_line});
-    $self->add_stash($request, 'user', 'not_understood');
+    $self->add_stash($request, 'user', 'unknown_action');
     return undef;
 }
 
@@ -275,8 +270,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list     = $request->{context};
     my $listname = $list->{'name'};
@@ -328,8 +329,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list   = $request->{context};
     my $which  = $list->{'name'};
@@ -427,8 +434,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list   = $request->{context};
     my $which  = $list->{'name'};
@@ -520,8 +533,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list   = $request->{context};
     my $which  = $list->{'name'};
@@ -589,8 +608,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list     = $request->{context};
     my $listname = $list->{'name'};
@@ -659,8 +684,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list     = $request->{context};
     my $listname = $list->{'name'};
@@ -707,8 +738,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list    = $request->{context};
     my $which   = $list->{'name'};
@@ -827,8 +864,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list     = $request->{context};
     my $listname = $list->{'name'};
@@ -959,8 +1002,14 @@
     my $email  = $request->{email};
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list  = $request->{context};
     my $which = $list->{'name'};
@@ -972,10 +1021,13 @@
     # command.
     my $user_entry = $list->get_list_member($email);
     unless (defined $user_entry) {
-        $self->add_stash($request, 'user', 'your_email_not_found',
-            {'email' => $email});
-        $log->syslog('info', 'SIG %s from %s refused, not on list',
-            $which, $email);
+        unless ($email eq $sender) {    # Request from other user?
+            $self->add_stash($request, 'user', 'user_not_subscriber');
+        } else {
+            $self->add_stash($request, 'user', 'not_subscriber');
+        }
+        $log->syslog('info', 'SIG %s from %s refused, %s not on list',
+            $which, $sender, $email);
 
         # Tell the owner somebody tried to unsubscribe.
         if ($request->{notify}) {
@@ -1061,8 +1113,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list    = $request->{context};
     my $which   = $list->{'name'};
@@ -1184,8 +1242,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list    = $request->{context};
     my $which   = $list->{'name'};
@@ -1442,8 +1506,14 @@
     my $sender = $request->{sender};
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list     = $request->{context};
     my $listname = $list->{'name'};
@@ -1509,8 +1579,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list   = $request->{context};
     my $which  = $list->{'name'};
@@ -1524,9 +1600,8 @@
     # just reject the message.
     my $user_entry = $list->get_list_member($who);
 
-    unless ((defined $user_entry)) {
-        $self->add_stash($request, 'user', 'your_email_not_found',
-            {'email' => $who});
+    unless (defined $user_entry) {
+        $self->add_stash($request, 'user', 'user_not_subscriber');
         $log->syslog('info', 'DEL %s %s from %s refused, not on list',
             $which, $who, $sender);
         return 'not_allowed';
@@ -1618,7 +1693,6 @@
     my $request = shift;
 
     my $sender = $request->{sender};
-    my $mode   = $request->{mode};
 
     my $auth_method =
           $request->{smime_signed} ? 'smime'
@@ -1672,12 +1746,20 @@
     my $self    = shift;
     my $request = shift;
 
-    my $sender = $request->{sender};
-    my $mode   = $request->{mode};
+    my $sender     = $request->{sender};
+    my $email      = $request->{email};
+    my $reception  = $request->{reception};
+    my $visibility = $request->{visibility};
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list  = $request->{context};
     my $which = $list->{'name'};
@@ -1684,53 +1766,57 @@
 
     $language->set_lang($list->{'admin'}{'lang'});
 
-    ## Check if we know this email on the list and remove it. Otherwise
-    ## just reject the message.
-    unless ($list->is_list_member($sender)) {
-        $self->add_stash($request, 'user', 'email_not_found',
-            {'email' => $sender});
-        $log->syslog('info', 'SET %s %s from %s refused, not on list',
-            $which, $mode, $sender);
+    # Check if we know this email on the list and remove it. Otherwise
+    # just reject the message.
+    unless ($list->is_list_member($email)) {
+        unless ($email eq $sender) {    # Request from owner?
+            $self->add_stash($request, 'user', 'user_not_subscriber');
+        } else {
+            $self->add_stash($request, 'user', 'not_subscriber');
+        }
+        $log->syslog('info', 'SET %s %s%s from %s refused, %s not on list',
+            $which, $reception, $visibility, $sender, $email);
         return 'not allowed';
     }
 
-    ## May set to DIGEST
-    if ($mode =~ /^(digest|digestplain|summary)/ and !$list->is_digest()) {
+    # May set to DIGEST.
+    if (    $reception
+        and grep { $reception eq $_ } qw(digest digestplain summary)
+        and not $list->is_digest) {
         $self->add_stash($request, 'user', 'no_digest');
-        $log->syslog('info', 'SET %s DIGEST from %s refused, no digest mode',
-            $which, $sender);
+        $log->syslog('info', 'SET %s %s from %s refused, no digest mode',
+            $which, $reception, $sender);
         return 'not_allowed';
     }
 
-    if ($mode =~
-        /^(mail|nomail|digest|digestplain|summary|notice|txt|html|urlize|not_me)/
-        ) {
-        # Verify that the mode is allowed
-        if (!$list->is_available_reception_mode($mode)) {
-            $self->add_stash(
-                $request, 'user',
-                'available_reception_mode',
-                {   'modes' => join(' ', $list->available_reception_mode()),
-                    'reception_modes' => [$list->available_reception_mode()]
-                }
-            );
-            $log->syslog('info',
-                'SET %s %s from %s refused, mode not available',
-                $which, $mode, $sender);
-            return 'not_allowed';
-        }
+    # Verify that the mode is allowed.
+    if ($reception and not $list->is_available_reception_mode($reception)) {
+        $self->add_stash(
+            $request, 'user',
+            'not_available_reception_mode',
+            {   modes => join(' ', $list->available_reception_mode),
+                reception_modes => [$list->available_reception_mode],
+                reception_mode  => $reception,
+            }
+        );
+        $log->syslog('info', 'SET %s %s from %s refused, mode not available',
+            $which, $reception, $sender);
+        return 'not_allowed';
+    }
 
-        my $update_mode = $mode;
-        $update_mode = '' if $update_mode eq 'mail';
+    if ($reception or $visibility) {
         unless (
             $list->update_list_member(
-                $sender,
-                reception   => $update_mode,
+                $email,
+                ($reception  ? (reception  => $reception)  : ()),
+                ($visibility ? (visibility => $visibility) : ()),
                 update_date => time
             )
             ) {
             my $error =
-                "Failed to change subscriber '$sender' options for list $which";
+                sprintf
+                'Failed to change subscriber "%s" options for list %s',
+                $email, $list->get_id;
             Sympa::send_notify_to_listmaster(
                 $list,
                 'mail_intern_error',
@@ -1740,47 +1826,15 @@
                 }
             );
             $self->add_stash($request, 'intern');
-            $log->syslog('info', 'SET %s %s from %s refused, update failed',
-                $which, $mode, $sender);
+            $log->syslog('info', 'SET %s %s%s from %s refused, update failed',
+                $which, $reception, $visibility, $sender);
             return 'failed';
         }
-
-        $self->add_stash($request, 'notice', 'config_updated');
-
-        $log->syslog('info', 'SET %s %s from %s accepted (%.2f seconds)',
-            $which, $mode, $sender,
-            Time::HiRes::time() - $self->{start_time});
     }
 
-    if ($mode =~ /^(conceal|noconceal)/) {
-        unless (
-            $list->update_list_member(
-                $sender,
-                visibility  => $mode,
-                update_date => time
-            )
-            ) {
-            my $error =
-                "Failed to change subscriber '$sender' options for list $which";
-            Sympa::send_notify_to_listmaster(
-                $list,
-                'mail_intern_error',
-                {   error  => $error,
-                    who    => $sender,
-                    action =">" 'Command process',
-                }
-            );
-            $self->add_stash($request, 'intern');
-            $log->syslog('info', 'SET %s %s from %s refused, update failed',
-                $which, $mode, $sender);
-            return 'failed';
-        }
-
-        $self->add_stash($request, 'notice', 'config_updated');
-        $log->syslog('info', 'SET %s %s from %s accepted (%.2f seconds)',
-            $which, $mode, $sender,
-            Time::HiRes::time() - $self->{start_time});
-    }
+    $self->add_stash($request, 'notice', 'config_updated');
+    $log->syslog('info', 'SET %s from %s accepted (%.2f seconds)',
+        $which, $sender, Time::HiRes::time() - $self->{start_time});
     return 1;
 }
 
@@ -1801,8 +1855,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list   = $request->{context};
     my $which  = $list->{'name'};
@@ -1822,7 +1882,8 @@
         $log->syslog('err',
             'Unable to find message with key <%s> for list %s',
             $key, $list);
-        $self->add_stash($request, 'user', 'unfound_message', {key => $key});
+        $self->add_stash($request, 'user', 'already_moderated',
+            {key => $key});
         return 'msg_not_found';
     } elsif ($spindle->{finish} and $spindle->{finish} eq 'success') {
         $log->syslog(
@@ -1873,7 +1934,7 @@
     unless ($spindle and $spindle->spin) {    # No message.
         $log->syslog('info', 'CONFIRM %s from %s refused, auth failed',
             $key, $sender);
-        $self->add_stash($request, 'user', 'unfound_file_message',
+        $self->add_stash($request, 'user', 'already_confirmed',
             {'key' => $key});
         return 'wrong_auth';
     } elsif ($spindle->{finish} and $spindle->{finish} eq 'success') {
@@ -1904,8 +1965,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list   = $request->{context};
     my $which  = $list->{'name'};
@@ -1924,7 +1991,8 @@
     unless ($spindle and $spindle->spin) {    # No message
         $log->syslog('info', 'REJECT %s %s from %s refused, auth failed',
             $list->{'name'}, $key, $sender);
-        $self->add_stash($request, 'user', 'unfound_message', {key => $key});
+        $self->add_stash($request, 'user', 'already_moderated',
+            {key => $key});
         return 'wrong_auth';
     } elsif ($spindle->{finish} and $spindle->{finish} eq 'success') {
         $log->syslog(
@@ -1957,8 +2025,14 @@
     my $request = shift;
 
     unless (ref $request->{context} eq 'Sympa::List') {
-        $request->{error} = 'unknown_list';
-        return _error($self, $request);
+        $self->add_stash($request, 'user', 'unknown_list');
+        $log->syslog(
+            'info',
+            '%s from %s refused, unknown list for robot %s',
+            uc $request->{action},
+            $request->{sender}, $request->{context}
+        );
+        return 1;
     }
     my $list   = $request->{context};
     my $name   = $list->{'name'};

Modified: branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DoCommand.pm
===================================================================
--- branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DoCommand.pm	2016-01-31 07:26:17 UTC (rev 12663)
+++ branches/sympa-6.2-branch/src/lib/Sympa/Spindle/DoCommand.pm	2016-02-04 03:15:16 UTC (rev 12664)
@@ -165,7 +165,7 @@
 
         # Send the reply message.
         my $reports = $spindle->{stash};
-        if (grep { $_ and $_->[1] eq 'user' and $_->[2] eq 'not_understood' }
+        if (grep { $_ and $_->[1] eq 'user' and $_->[2] eq 'unknown_action' }
             @{$spindle->{stash} || []}) {
             $log->db_log(
                 'robot' => $robot,
@@ -227,6 +227,8 @@
         my $that = $request->{context};
         if (ref $that eq 'Sympa::List') {
             $data{listname} = $that->{'name'};
+        } elsif ($request->{localpart}) {
+            $data{listname} = $request->{localpart};
         }
 
         push @reports, \%data;


--
A bug in Sympa? Quick! To the bug tracker!
<iacbhadc.png>
 
David Verdin
Études et projets applicatifs
 
Tél : +33 2 23 23 69 71
Fax : +33 2 23 23 71 21
 
www.renater.fr
RENATER
263 Avenue du Gal Leclerc
35042 Rennes Cedex






Archive powered by MHonArc 2.6.19+.

Top of Page