Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/kballard/six
Browse files Browse the repository at this point in the history
Conflicts:
	plugins-extra/textmate.rb
  • Loading branch information
jptix committed Nov 22, 2008
2 parents ad9d5c8 + 4f3b8fb commit 9f7f7ab
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins-extra/textmate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def PluginBase.help(cmd, text)

module TMHelper
BUNDLE_SOURCES = {
:main => "http://macromates.com/svn/Bundles/trunk/Bundles/",
:review => "http://macromates.com/svn/Bundles/trunk/Review/Bundles/",
:main => "http://svn.textmate.org/trunk/Bundles/",
:review => "http://svn.textmate.org/trunk/Review/Bundles/",
:github => 'http://github.com/api/v1/yaml/search/tmbundle'
}

Expand Down
28 changes: 28 additions & 0 deletions plugins/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,34 @@ def chan_seen(irc, chan, nick)
end
help :seen, "Type 'seen <nick>' and I'll tell you when I last heard something from <nick>, and what he or she was saying or doing."

def chan_willsee(irc, chan, nick)
if nick
hours = {}
open_file(chan.name + '.txt', 'r') do |log|
while line = log.gets
if line =~ /^\[(\d+):\d+\] <#{Regexp.quote nick}>/i
hours[$1.to_i] ||= 0
hours[$1.to_i] += 1
end
end
end
if hours.empty?
irc.reply "I haven't seen #{nick} before"
else
prediction = hours.sort_by { |x| x[1] rescue 0 }.last[0]
hour = Time.now.hour
if hour > prediction
prediction = 24 - (hour - prediction);
else
prediction = prediction - hour;
end
irc.reply "#{nick} is most likely to be online " + ((prediction == 0) ? 'now!' : "in #{prediction} hour#{:s if prediction > 1}.");
end
else
irc.reply 'USAGE: willsee [channel] <nick name>'
end
end
help :willsee, 'Tries to predict when a user is likely to be online'
end

# http://db.cs.helsinki.fi/~jaarnial/mt/archives/000074.html
Expand Down
4 changes: 2 additions & 2 deletions plugins/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def cmd_define(irc, line)
re = http.get("/search?ie=utf8&oe=utf8&q=site%3Awikipedia.org+#{search}",
{ 'User-Agent' => 'CyBrowser' })
if re.code == '200'
if re.body =~ /<td class="j">(.+?)<br><span class=a>(.+?) -/
desc, link = $1, $2
if re.body =~ /<h3 class=r><a href="([^"]+)".+?<div class="s">(.+?)<b>.../
link, desc = $1, $2
desc = desc.gsub('<b>', "\x02").gsub('</b>', "\x0f").gsub(/<.+?>/, '').decode_entities
link = link.gsub('<b>', "\x02").gsub('</b>', "\x0f").gsub(/<.+?>/, '').decode_entities
irc.reply desc + " ( " + link.gsub(%r[^(?!http://)], 'http://') + " )"
Expand Down

0 comments on commit 9f7f7ab

Please sign in to comment.