From 4bede22e4f2189a570ea43dec3b087052ef85edc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Jan 2009 13:39:53 -0500 Subject: use short names in comittype Use mtn for monontone and hg for mercurial. The long names cause ugly formatting in recentchanges, which has CSS that only allows a few characters for the commit type column. --- IkiWiki/Plugin/mercurial.pm | 2 +- IkiWiki/Plugin/monotone.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index 82423286d..6c4855e57 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -217,7 +217,7 @@ sub rcs_recentchanges ($) { push @ret, { rev => $info->{"changeset"}, user => $user, - committype => "mercurial", + committype => "hg", when => str2time($info->{"date"}), message => [@message], pages => [@pages], diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm index 38abb9a07..bdb564a71 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -559,7 +559,7 @@ sub rcs_recentchanges ($) { if ($cert->{key} eq $config{mtnkey}) { $committype = "web"; } else { - $committype = "monotone"; + $committype = "mtn"; } } elsif ($cert->{name} eq "date") { $when = str2time($cert->{value}, 'UTC'); -- cgit v1.2.3 From cd2ddb57a5a20e308cee912e26f2383733c11b3c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Jan 2009 14:56:48 -0500 Subject: load rpc xml lib on the fly This way, enabling the plugin via websetup is safe, it can't leave ikiwiki in a broken state. --- IkiWiki/Plugin/blogspam.pm | 11 +++++++++-- t/syntax.t | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index 6e68a9856..4005e9f2a 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -4,8 +4,6 @@ package IkiWiki::Plugin::blogspam; use warnings; use strict; use IkiWiki 3.00; -require RPC::XML; -require RPC::XML::Client; my $defaulturl='http://test.blogspam.net:8888/'; @@ -47,6 +45,15 @@ sub getsetup () { sub checkcontent (@) { my %params=@_; + + eval q{ + use RPC::XML; + use RPC::XML::Client; + }; + if ($@) { + warn($@); + return undef; + } if (exists $config{blogspam_pagespec}) { return undef diff --git a/t/syntax.t b/t/syntax.t index 9d5cbc373..d09d17f7f 100755 --- a/t/syntax.t +++ b/t/syntax.t @@ -5,8 +5,8 @@ use Test::More; my @progs="ikiwiki.in"; my @libs="IkiWiki.pm"; -# monotone, external, blogspam, amazon_s3 skipped since they need perl modules -push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v blogspam.pm | grep -v amazon_s3.pm`; +# monotone, external, amazon_s3 skipped since they need perl modules +push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v amazon_s3.pm`; push @libs, 'IkiWiki/Plugin/skeleton.pm.example'; plan(tests => (@progs + @libs)); -- cgit v1.2.3 From 6b681ed299191b4b803277f56e56a16dfa9906a5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Jan 2009 15:39:08 -0500 Subject: blogspam api now supports homepage link --- IkiWiki/Plugin/blogspam.pm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index 4005e9f2a..cc6e840f0 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -83,17 +83,12 @@ sub checkcontent (@) { # and "buy". push @options, "exclude=stopwords"; - # blogspam API does not have a field for author url, so put it in - # the content to be checked. - if (exists $params{url}) { - $params{content}.="\n".$params{url}; - } - my $res = $client->send_request('testComment', { ip => $ENV{REMOTE_ADDR}, comment => $params{content}, subject => defined $params{subject} ? $params{subject} : "", name => defined $params{author} ? $params{author} : "", + link => exists $params{url} ? $params{url} : "", options => join(",", @options), site => $config{url}, version => "ikiwiki ".$IkiWiki::version, -- cgit v1.2.3