Index: trunk/mixiComment/plugins/mixiComment/mixiComment.pl
===================================================================
--- trunk/mixiComment/plugins/mixiComment/mixiComment.pl (revision 971)
+++ trunk/mixiComment/plugins/mixiComment/mixiComment.pl (revision 1480)
@@ -13,5 +13,5 @@
     author_url => 'http://www.movabletype.jp/',
     description => '<MT_TRANS phrase="Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.">',
-    version => '1.0',
+    version => '1.1',
     settings => new MT::PluginSettings([
         ['mixi_id', { Scope => 'blog' }],
@@ -69,24 +69,6 @@
 </__trans_section>
 EOT
-                login_form_params => sub {
-                    my ($key, $blog_id, $entry_id, $static) = @_;
-
-                    my %param;
-                    $plugin->load_config(\%param, "blog:$blog_id");
-                    my $url;
-                    if ( my $mixi_id = $param{mixi_id} ) {
-                        $url = "https://id.mixi.jp/$mixi_id/friends";
-                    }
-                    else {
-                        $url = "http://mixi.jp/";
-                    }
-                    my $params = {
-                        blog_id => $blog_id,
-                        static  => $static,
-                        url     => $url,
-                    };
-                    $params->{entry_id} = $entry_id if defined $entry_id;
-                    return $params;
-                },
+                condition => '$mixicomment::mixiComment::App::openid_commenter_condition',
+                login_form_params => '$mixicomment::mixiComment::App::commenter_auth_params',
                 logo => 'plugins/mixiComment/images/signin_mixi.png',
                 logo_small => 'plugins/mixiComment/images/signin_mixi_small.gif'
Index: trunk/mixiComment/plugins/mixiComment/lib/mixiComment/Auth/mixi.pm
===================================================================
--- trunk/mixiComment/plugins/mixiComment/lib/mixiComment/Auth/mixi.pm (revision 1066)
+++ trunk/mixiComment/plugins/mixiComment/lib/mixiComment/Auth/mixi.pm (revision 1480)
@@ -15,8 +15,10 @@
         my $return_to = $path . '?__mode=mixicomment_verify_blog_owner'
             . '&blog_id='  . $blog->id;
-        return ( trust_root => $path, return_to => $return_to );
+        return ( trust_root => $path, return_to => $return_to, delayed_return => 1 );
     }
     else {
-        return $class->SUPER::check_url_params(@_);
+        my %params = $class->SUPER::check_url_params(@_);
+        $params{delayed_return} = 1;
+        return %params;
     }
 }
@@ -33,48 +35,11 @@
 }
 
-# TODO: remove these once core code supports SREG - BugID:71011
-sub NS_OPENID_SREG { "http://openid.net/extensions/sreg/1.1" }
+sub set_extension_args {
+    my $class = shift;
+    my ( $claimed_identity ) = @_;
 
-sub login {
-    my $class = shift;
-    my ($app) = @_;
-    my $q = $app->{query};
-    return $app->errtrans("Invalid request.")
-        unless $q->param('blog_id');
-    my $blog = MT::Blog->load(scalar $q->param('blog_id'));
-    my %param = $app->param_hash;
-    my $csr = MT::Auth::OpenID::_get_csr(\%param, $blog) or return;
-    my $identity = $q->param('openid_url');
-    if (!$identity &&
-        (my $u = $q->param('openid_userid')) && $class->can('url_for_userid')) {
-        $identity = $class->url_for_userid($u);
-    }
-    my $claimed_identity = $csr->claimed_identity($identity);
-    if (!$claimed_identity) {
-        my ($err_code, $err_msg) = ($csr->errcode, $csr->errtext);
-        if ($err_code eq 'no_head_tag' || $err_code eq 'no_identity_server' || $err_code eq 'url_gone') {
-            $err_msg = $app->translate('The address entered does not appear to be an OpenID');
-        }
-        elsif ($err_code eq 'empty_url' || $err_code eq 'bogus_url') {
-            $err_msg = $app->translate('The text entered does not appear to be a web address');
-        }
-        elsif ($err_code eq 'url_fetch_error') {
-            $err_msg =~ s{ \A Error \s fetching \s URL: \s }{}xms;
-            $err_msg = $app->translate('Unable to connect to [_1]: [_2]', $identity, $err_msg);
-        }
-        return $app->error($app->translate("Could not verify the OpenID provided: [_1]", $err_msg));
-    }
-
-    my %params = $class->check_url_params( $app, $blog );
-
-    $claimed_identity->set_extension_args(NS_OPENID_SREG(), {
+    $claimed_identity->set_extension_args(MT::Auth::OpenID::NS_OPENID_SREG(), {
         optional => join(",", qw/email nickname fullname/)
     });
-
-    my $check_url = $claimed_identity->check_url(
-        ( %params, delayed_return => 1 )
-    );
-
-    return $app->redirect($check_url);
 }
 
@@ -84,5 +49,5 @@
 
     # Try SREG extension first
-    my $fields = $vident->extension_fields(NS_OPENID_SREG);
+    my $fields = $vident->extension_fields(MT::Auth::OpenID::NS_OPENID_SREG());
     my $nick = $fields->{nickname} if exists $fields->{nickname};
     $nick ||= $fields->{fullname} if exists $fields->{fullname};
Index: trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/es.pm
===================================================================
--- trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/es.pm (revision 1480)
+++ trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/es.pm (revision 1480)
@@ -0,0 +1,24 @@
+package mixiComment::L10N::es;
+
+use strict;
+use base 'mixiComment::L10N::en_us';
+use vars qw( %Lexicon );
+
+%Lexicon = (
+
+## plugins/mixiComment/mixiComment.pl
+	'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'Permite a los comentaristas identificarse en Movable Type 4 usando su propio usuario y contraseÃ±a de mixi vÃ­a OpenID.',
+	'Sign in using your mixi ID' => 'IdentifÃ­quese usando su ID de mixi ID',
+	'Click the button to sign in using your mixi ID' => 'Click the button to sign in using your mixi ID',
+	'mixi' => 'mixi',
+
+## plugins/mixiComment/lib/mixiComment/App.pm
+	'mixi reported that you failed to login.  Try again.' => 'mixi informÃ³ que fallÃ³ la identificaciÃ³n. IntÃ©ntelo de nuevo.',
+
+## plugins/mixiComment/tmpl/config.tmpl
+	'A mixi ID has already been registered in this blog.  If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account.  If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'Ya se ha registrado un ID de mixi en este blog. Si desea modificar el ID de mixi del blog, <a href="[_1]">haga clic aquÃ­</a> para identificarse en su cuenta de mixi. Si desea que todos los usuarios de mixi puedan comentar en el blog (no solo sus usuarios de my mixi), haga clic en el botÃ³n de reiniciar para eliminar la configuraciÃ³n.',
+	'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'Si desea restringir los comentarios a sus usuarios de my mixi, <a href="[_1]">haga clic aquÃ­</a> para identificarse en su cuenta de mixi.',
+
+);
+
+1;
Index: trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/fr.pm
===================================================================
--- trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/fr.pm (revision 1480)
+++ trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/fr.pm (revision 1480)
@@ -0,0 +1,24 @@
+package mixiComment::L10N::fr;
+
+use strict;
+use base 'mixiComment::L10N::en_us';
+use vars qw( %Lexicon );
+
+%Lexicon = (
+
+## plugins/mixiComment/mixiComment.pl
+	'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'Permet aux auteurs de commentaires de s\'identifier sur Movable Type en utilisant leur nom d\'utilisateur mixi via OpenID.', # Translate - New
+	'Sign in using your mixi ID' => 'S\'identifier en utilisant votre identifiant mixi', # Translate - New
+	'Click the button to sign in using your mixi ID' => 'Cliquez sur le bouton pour vous identifier en utilisant votre identifiant mixi.', # Translate - New
+	'mixi' => 'mixi', # Translate - New
+
+## plugins/mixiComment/lib/mixiComment/App.pm
+	'mixi reported that you failed to login.  Try again.' => 'mixi n\'a pas rÃ©ussi Ã  vous identifier. Veuillez rÃ©essayer.', # Translate - New
+
+## plugins/mixiComment/tmpl/config.tmpl
+	'A mixi ID has already been registered in this blog.  If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account.  If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'Un ID mixi est dÃ©jÃ  enregistrÃ© sur ce blog. Si vous souhaitez modifier l\'ID mixi, <a href="[_1]">cliquez ici</a> pour vous identifier en utilisant votre compte mixi. Si vous souhaitez permettre Ã  tous les utilisateurs mixi de commenter sur votre blog (et pas uniquement vos utilisateurs mixi), cliquez sur le bouton de rÃ©initialisation pour retirer les paramÃštres.', # Translate - New
+	'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'Si vous souhaitez restreindre les commentaires Ã  uniquement vos utilisateurs mixi, <a href="[_1]">cliquez ici</a> pour vous identifier en utilisant votre compte mixi.', # Translate - New
+
+);
+
+1;
Index: trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/de.pm
===================================================================
--- trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/de.pm (revision 1480)
+++ trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/de.pm (revision 1480)
@@ -0,0 +1,24 @@
+package mixiComment::L10N::de;
+
+use strict;
+use base 'mixiComment::L10N::en_us';
+use vars qw( %Lexicon );
+
+%Lexicon = (
+
+## plugins/mixiComment/mixiComment.pl
+	'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'ErmÃ¶glicht es Kommentarautoren, sich per OpenID mit ihrem mixi-Benutzernamen und -Passwort bei Movable Type 4 anzumelden',
+	'Sign in using your mixi ID' => 'Mit Ihrer mixi-ID anmelden',
+	'Click the button to sign in using your mixi ID' => 'Klicken Sie den Knopf an, um sich mit Ihrer mixi-ID anzumelden',
+	'mixi' => 'mixi',
+
+## plugins/mixiComment/lib/mixiComment/App.pm
+	'mixi reported that you failed to login.  Try again.' => 'Ihre Anmeldung ÃŒber mixi ist fehlgeschlagen. Bitte versuchen Sie es erneut.',
+
+## plugins/mixiComment/tmpl/config.tmpl
+	'A mixi ID has already been registered in this blog.  If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account.  If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'Es ist bereits eine mixi-ID fÃŒr Ihr Blog registriert. <a href="[_1]">Klicken Sie hier</a>, um die mixi-ID dieses Blogs zu Ã€ndern. Klicken Sie auf ZurÃŒcksetzen, um alle mixi-Benutzer kommentieren zu lassen. Derzeit kÃ¶nnen nur Ihre my mixi-Benutzer kommentieren.',
+	'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'Wenn Sie nur Ihre my mixi-Benutzer kommentieren lassen wollen, <a href="[_1]">klicken Sie hier</a>, um sich mit Ihrer mixi-ID anzumelden.',
+
+);
+
+1;
Index: trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/nl.pm
===================================================================
--- trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/nl.pm (revision 1480)
+++ trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/nl.pm (revision 1480)
@@ -0,0 +1,24 @@
+package mixiComment::L10N::nl;
+
+use strict;
+use base 'mixiComment::L10N::en_us';
+use vars qw( %Lexicon );
+
+%Lexicon = (
+
+## plugins/mixiComment/mixiComment.pl
+	'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'Laat reageerders zich aanmelden op Movable Type met hun eigen mixi gebruikersnaam en wachtwoord via OpenID.',
+	'Sign in using your mixi ID' => 'Aanmelden met uw mixi ID',
+	'Click the button to sign in using your mixi ID' => 'Klik op de knop om aan te melden met uw mixi ID',
+	'mixi' => 'mixi',
+
+## plugins/mixiComment/lib/mixiComment/App.pm
+	'mixi reported that you failed to login.  Try again.' => 'mixi meldde dat het aanmelden mislukte.  Probeer opnieuw.',
+
+## plugins/mixiComment/tmpl/config.tmpl
+	'A mixi ID has already been registered in this blog.  If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account.  If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'Er werd reeds een mixi ID geregistreerd voor deze blog.  Als u de mixi ID voor de blog wenst aan te passen, <a href="[_1]">klik dan hier</a> om u aan te melden met uw mixi account.  Als u alle mixi gebruikers toestemming wenst te geven op uw blog te reageren (en niet enkel uw eigen mixi gebruikers), klik dan op de resetknop om deze instelling te verwijderen.',
+	'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'Als u reacties wenst te beperken tot uw eigen mixi gebruikers, <a href="[_1]">klik dan hier</a> om u aan te melden met uw mixi account.',
+
+);
+
+1;
Index: trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/ja.pm
===================================================================
--- trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/ja.pm (revision 971)
+++ trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/ja.pm (revision 1480)
@@ -6,10 +6,18 @@
 
 %Lexicon = (
-    'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'mixiã®ã¢ã«ãŠã³ããäœ¿ã£ãŠMovable Type 4ã«ã³ã¡ã³ãããããšãã§ããããã«ããŸãã',
-    'mixi reported that you failed to login.  Try again.' => 'ã­ã°ã€ã³ã«å€±æããŸããã',
-    'A mixi ID has already been registered in this blog.  If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account.  If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'ãã§ã«mixiã®IDãç»é²ããŠãããŸãããã­ã°ã«é¢é£ä»ããmixiã®IDãå€ãããå Žåã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠmixiã«ã­ã°ã€ã³</a>ããŠãã ããããã€ãã¯ã ãã§ãªããã¹ãŠã®mixiãŠãŒã¶ãŒããã®ã³ã¡ã³ããåãä»ããããšãã¯ãåæåãã¿ã³ãã¯ãªãã¯ããŠèš­å®ãæ¶å»ããŠãã ããã',
-    'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'ãã€ãã¯ããã®ã¿ã³ã¡ã³ããåãä»ããèš­å®ã«ããã«ã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠãŸãmixiã«ã­ã°ã€ã³</a>ããŠãã ããã',
-    'Click the button to sign in using your mixi ID' => 'ãã¿ã³ãã¯ãªãã¯ããŠmixiã«ã­ã°ã€ã³ããŠãã ããã',
-    'Sign in using your mixi ID' => 'mixiã®IDã§ã­ã°ã€ã³ãã',
+
+## plugins/mixiComment/mixiComment.pl
+	'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'mixiã®ã¢ã«ãŠã³ããäœ¿ã£ãŠMovable Type 4ã«ã³ã¡ã³ãããããšãã§ããããã«ããŸãã',
+	'Sign in using your mixi ID' => 'mixiã®IDã§ã­ã°ã€ã³ãã',
+	'Click the button to sign in using your mixi ID' => 'ãã¿ã³ãã¯ãªãã¯ããŠmixiã«ã­ã°ã€ã³ããŠãã ããã',
+	'mixi' => 'ãã¯ã·ã£',
+
+## plugins/mixiComment/lib/mixiComment/App.pm
+	'mixi reported that you failed to login.  Try again.' => 'ã­ã°ã€ã³ã«å€±æããŸããã',
+
+## plugins/mixiComment/tmpl/config.tmpl
+	'A mixi ID has already been registered in this blog.  If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account.  If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'ãã§ã«mixiã®IDãç»é²ããŠãããŸãããã­ã°ã«é¢é£ä»ããmixiã®IDãå€ãããå Žåã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠmixiã«ã­ã°ã€ã³</a>ããŠãã ããããã€ãã¯ã ãã§ãªããã¹ãŠã®mixiãŠãŒã¶ãŒããã®ã³ã¡ã³ããåãä»ããããšãã¯ãåæåãã¿ã³ãã¯ãªãã¯ããŠèš­å®ãæ¶å»ããŠãã ããã',
+	'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'ãã€ãã¯ããã®ã¿ã³ã¡ã³ããåãä»ããèš­å®ã«ããã«ã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠãŸãmixiã«ã­ã°ã€ã³</a>ããŠãã ããã',
+
 );
 
Index: trunk/mixiComment/plugins/mixiComment/lib/mixiComment/App.pm
===================================================================
--- trunk/mixiComment/plugins/mixiComment/lib/mixiComment/App.pm (revision 971)
+++ trunk/mixiComment/plugins/mixiComment/lib/mixiComment/App.pm (revision 1480)
@@ -52,4 +52,34 @@
 }
 
+sub openid_commenter_condition {
+    eval "require Digest::SHA1;";
+    return 0 if $@;
+    eval "require Crypt::SSLeay;";
+    return 0 if $@;
+    return 1;
+}
+
+sub commenter_auth_params {
+    my ($key, $blog_id, $entry_id, $static) = @_;
+
+    my %param;
+    my $plugin = MT->component('mixicomment');
+    $plugin->load_config(\%param, "blog:$blog_id");
+    my $url;
+    if ( my $mixi_id = $param{mixi_id} ) {
+        $url = "https://id.mixi.jp/$mixi_id/friends";
+    }
+    else {
+        $url = "http://mixi.jp/";
+    }
+    my $params = {
+        blog_id => $blog_id,
+        static  => $static,
+        url     => $url,
+    };
+    $params->{entry_id} = $entry_id if defined $entry_id;
+    return $params;
+}
+
 1;
 __END__
Index: trunk/mixiComment/plugins/mixiComment/php/init.mixiComment.php
===================================================================
--- trunk/mixiComment/plugins/mixiComment/php/init.mixiComment.php (revision 1480)
+++ trunk/mixiComment/plugins/mixiComment/php/init.mixiComment.php (revision 1480)
@@ -0,0 +1,23 @@
+<?php
+require_once('commenter_auth_lib.php');
+
+class MixiCommenterAuth extends BaseCommenterAuthProvider {
+    function get_key() {
+        return 'mixicomment';
+    }
+    function get_label() {
+        return 'mixi Commenter Authenticator';
+    }
+    function get_logo() {
+        return 'plugins/mixiComment/images/signin_mixi.png';
+    }
+    function get_logo_small() {
+        return 'plugins/mixiComment/images/signin_mixi_small.gif';
+    }
+}
+
+global $_commenter_auths;
+$provider = new MixiCommenterAuth();
+$_commenter_auths[$provider->get_key()] = $provider;
+
+?>
