Not only the patch was missing an essential part, but Nokogiri is not
compatible enough with Hpricot anyway. Incompatibilities include
doc/"style|script" raising an "Undefined namespace prefix" error and the
non-existence of Hpricot::Elements.
If we want to support Nokogiri we'll need to write code for it on
purpose or redesign the Hpricot code so that it only uses the subset
supported by Nokogiri.
Giuseppe Bilotta [Fri, 28 Aug 2009 22:56:22 +0000 (00:56 +0200)]
search plugin: enhance 'lucky' output
'lucky' search only selects the first hit, so set hit to 1 and
enable 'single' mode. Also rework the results output, and make a custom
'title -- url' for lucky mode.
Giuseppe Bilotta [Thu, 27 Aug 2009 19:35:06 +0000 (21:35 +0200)]
url plugin: only chop non-word characters on 404
Chopping everything causes long delays for non-existing pages with
long paths. Since the purpose of the retry-with-chop is to get the
right URL when punctuation is added after it, the solution is to
only chop non-word characters. This has to be done on the
unescaped URL because otherwise non-word characters like " that
expand to %22 will not be chopped.
The plugin fallback method is now passed the list of failures.
Failures themselves are encapsulated in their own data type, making it
easier to handle failures that should inform the user with something
more detailed than the classic 'usage' pattern.
It's still up to the fallback method to make use (e.g. echo) the
relevant messages.
Giuseppe Bilotta [Mon, 29 Jun 2009 22:41:58 +0000 (00:41 +0200)]
extends: bring conjoin to Enumerable
Put #conjoin() in the Enumerable module, so that it can be shared by all
enumerables (e.g. ranges). Since #size() is not necessarily present, its
use is replaced by #count(), the result of which is cached because
it can be slow on objects missing #size().
David Gadling [Thu, 21 May 2009 18:53:19 +0000 (11:53 -0700)]
multiple plugins: Changes to remove parenthesize warnings.
All of these modules/plugins were generating warnings like this:
warning: parenthesize argument(s) for future version
This patch should fix all the warnings without affecting functionality.
Giuseppe Bilotta [Mon, 20 Apr 2009 18:48:07 +0000 (20:48 +0200)]
gettext: support version 2
GetText version 2 has some significant difference from earlier version.
* different syntax to set the default locale path
* different syntax to set non-cached mode
* different way to handle bound targets
Most of the changes are relative to significant functionality split
between the GetText submodules (LocalePath, TextDomain etc), so most of
the changes are just a matter of moving the defines where appropriate.
The bound_targets patch needed to cope with anonymous modules is not
needed with gettext >= 2.0.0
safe_exec should be less verbose when reporting problems, since the
output might end up on IRC, and it should return a non-zero error code
when failing, so that $? get set correctly.
Giuseppe Bilotta [Sat, 21 Mar 2009 23:47:36 +0000 (00:47 +0100)]
Separate gemspec from Rakefile
The benefit of this separation is that hosting services such as GitHub
will automatically build a gem every time the version in the spec is
changed. The underside of this separation is that hosting services such
as GitHub will automatically build a gem every time the version is
changed.
To allow the automatic gem generation to trigger on the release of
0.9.15, we demoted the version in the spec to 0.9.14. This gimmick is
needed because the gem spec doesn't allow non-numeric versions.
Since the gemspec is now standalone, it uses Dir instead of FileList,
which is equivalent for our use case. Moreover, the Rakefile only
defines the gem tasks if the spec is present.
Giuseppe Bilotta [Sun, 15 Mar 2009 10:04:24 +0000 (11:04 +0100)]
rss: configurable announce method
Since the RSS update announcements do not expect any form of reply,
they could be considered the typical IRC message that should use
NOTICE rather than PRIVMSG.
However, for backwards compatibility and since NOTICEs are not always
appreciated (and since their handling from clients is not always
optimal, either), we still allow rss announces to use the traditional
method, and that is in fact selected as default. Explicit rss show
request always go with PRIVMSG.
Giuseppe Bilotta [Fri, 13 Mar 2009 10:50:27 +0000 (11:50 +0100)]
rss: refactor rss types loading
Make use of the new custom filter loading procedure to move most of the
type definitions into its own file (data/rbot/filters/rss.rb) and only
define some essential ones in the plugin itself.
As an added benefit, user types can be loaded from filters/rss.rb and
rss/types.rb in the botclass directory.
reaction: fix trigger regex to work with non-alphanumeric start/end.
only match on word boundaries at an end of a trigger if the character at
that end of the trigger is a word character. In other words, the
trigger "test" should require word boundaries on each side, but the
trigger "@test" should only require one on the right side.
messagemapper: fix regexp creation for double-optional templates
When a mapping template had a double optional key such as
'something [[double] optional]'
the resuting regexp moved the spacing between the (converted)
double brackets, requiring extra spacing before the 'optional'
keyword.
Fix by moving spacing inside all consecutive brackets before converting
brackets into their regexp form.
lastfm: clean up sort order events search mappings
Put some requirements for the sort_order specification, to prevent
lastfm events at alan lomax
to map lomax as a sort order. Also make the 'in' and 'order' words
optional within the optional sord order block, rather than aside, to
prevent them from being ignored in venue names.
Try loading rubygems as soon as we're set up, since it can be needed for
gettext and a number of other things. This also allows us to get rid of
some stupid convoluted tricks in utils.
irc: monkeypatch Singleton to make _load and _dump public.
This is to fix a possible bug in newer versions of ruby where _load was
declared private in singletons. This would lead to errors where Marshal
could not restore the Singleton. This "bug" was introduced to ruby
in revisions 16659 and 17396.