]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - data/rbot/filters/rss.rb
fix: update deprecated git option
[user/henk/code/ruby/rbot.git] / data / rbot / filters / rss.rb
1 #-- vim:sw=2:et
2 #++
3
4 rss_type :blog do |s|
5   author = s[:author] ? (s[:author] + " ") : ""
6   abt = s[:category] ? "about #{s[:category]} " : ""
7   line1 = "%{handle}%{date}%{author}blogged %{abt}at %{link}"
8   line2 = "%{handle}%{title} - %{desc}"
9   make_stream(line1, line2, s, :author => author, :abt => abt)
10 end
11
12 rss_type :forum do |s|
13   author = s[:author] ? (s[:author] + " ") : ""
14   abt = s[:category] ? "on #{s[:category]} " : ""
15   line1 = "%{handle}%{date}%{author}posted %{abt}at %{link}"
16   line2 = "%{handle}%{title} - %{desc}"
17   make_stream(line1, line2, s, :author => author, :abt => abt)
18 end
19
20 rss_type :git do |s|
21   author = s[:author].sub(/@\S+?\s*>/, "@...>") + " " if s[:author]
22   line1 = "%{handle}%{date}%{author}committed %{title}%{at}%{link}"
23   make_stream(line1, nil, s, :author => author)
24 end
25
26 rss_type :gmane do |s|
27   line1 = "%{handle}%{date}Message %{title} sent by %{author}. %{desc}"
28   make_stream(line1, nil, s)
29 end
30
31 rss_type :headlines do |s|
32   line1 = (s[:handle].empty? ? "%{date}" : "%{handle}") << "%{title}"
33   make_stream(line1, nil, s)
34 end
35
36 rss_type :news do |s|
37   line1 = "%{handle}%{date}%{title}%{at}%{link}" % s
38   line2 = "%{handle}%{date}%{desc}" % s
39   make_stream(line1, line2, s)
40 end
41
42 rss_type :photoblog do |s|
43   author = s[:author] ? (s[:author] + " ") : ""
44   abt = s[:category] ? "under #{s[:category]} " : ""
45   line1 = "%{handle}%{date}%{author}added an image %{abt}at %{link}"
46   line2 = "%{handle}%{title} - %{desc}"
47   make_stream(line1, line2, s, :author => author, :abt => abt)
48 end
49
50 rss_type :trac do |s|
51   author = s[:author].sub(/@\S+?\s*>/, "@...>") + ": " if s[:author]
52   line1 = "%{handle}%{date}%{author}%{title}%{at}%{link}"
53   line2 = nil
54   unless s[:item].title =~ /^(?:Changeset \[(?:[\da-f]+)\]|\(git commit\))/
55     line2 = "%{handle}%{date}%{desc}"
56   end
57   make_stream(line1, line2, s, :author => author)
58 end
59
60 rss_type :wiki do |s|
61   line1 = "%{handle}%{date}%{title}%{at}%{link}"
62   line1 << "has been edited by %{author}. %{desc}"
63   make_stream(line1, nil, s)
64 end
65
66 rss_type :"/." do |s|
67   dept = "(from the #{s[:item].slash_department} dept) " rescue nil
68   sec = " in section #{s[:item].slash_section}" rescue nil
69   line1 = "%{handle}%{date}%{dept}%{title}%{at}%{link} "
70   line1 << "(posted by %{author}%{sec})"
71   make_stream(line1, nil, s, :dept => dept, :sec => sec)
72 end