Changeset 6478
- Timestamp:
- 02/10/08 14:36:16 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/chokan/branches/citrus/plugins/hatena.rb
r6433 r6478 6 6 class Hatena < Citrus::Plugin 7 7 def on_privmsg(prefix, channel, message) 8 re_id = /id:([a-zA-Z][\w-]{1,30}[a-zA-Z\d])/ 8 9 case message 9 when /\bg:([a-z ][a-z\d]*)(?::id:([a-z][a-z0-9_-]{1,30}[a-z0-9]))?/i10 when /\bg:([a-zA-Z][a-zA-Z\d]{2,23})(?::#{re_id})?/n 10 11 g, id = Regexp.last_match.captures 11 12 id << '/' if id 12 13 notice(channel, "http://#{g}.g.hatena.ne.jp/#{id}") 13 when /\b(? :([a-z][a-z\d]*):)?id:([a-z][a-z0-9_-]{1,30}[a-z0-9])/i14 when /\b(?i:([a-z][a-z\d]*):)?#{re_id}/n 14 15 s, id = Regexp.last_match.captures 15 16 if exist?(id) … … 25 26 end 26 27 rescue Exception 27 false28 nil 28 29 end 29 30 end … … 48 49 49 50 @socket.string = "" 50 @plugin.on_privmsg(@prefix, "#test", "d:id:jkondo --")51 @plugin.on_privmsg(@prefix, "#test", "d:id:jkondo++") 51 52 @socket.string.should == "NOTICE #test http://d.hatena.ne.jp/jkondo/\r\n" 52 53
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)