- Timestamp:
- 09/02/08 22:52:35 (4 months ago)
- Location:
- lang/ruby/net-irc/trunk/examples
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/net-irc/trunk/examples/iig.rb
r17052 r18670 133 133 134 134 def api_source 135 "iig rb"135 "iig.rb" 136 136 end 137 137 -
lang/ruby/net-irc/trunk/examples/tig.rb
r18654 r18670 95 95 Force SSL for API. 96 96 97 ## Extended commands through the CTCP ACTION 98 99 ### list (ls) 100 101 /me list NICK_or_screen_name 102 103 ### fav (favorite, favourite, unfav, unfavorite, unfavourite) 104 105 /me fav ID [ID...] 106 /me unfav ID [ID...] 107 108 ### link (ln) 109 110 /me link ID [ID...] 111 112 ### destroy (del, delete, miss, oops, remove, rm) 113 114 /me destroy ID [ID...] 115 116 ### in (location) 117 118 /me in Tokyo, Japan 119 120 ### reply (re) 121 122 /me reply ID blah, blah... 123 124 ### utf7 125 126 /me utf7 127 97 128 ## License 98 129 … … 327 358 require "iconv" 328 359 @utf7 = !@utf7 329 log " utf7 mode: #{@utf7 ? 'on' : 'off'}"360 log "UTF-7 mode: #{@utf7 ? 'on' : 'off'}" 330 361 rescue LoadError => e 331 362 log "Can't load iconv." … … 397 428 location = location.empty? ? "nowhere" : "in #{location}" 398 429 post server_name, NOTICE, main_channel, "You are #{location} now." 399 when "re"430 when /^re(?:ply)?$/ 400 431 tid = args.first 401 432 st = @tmap[tid] … … 722 753 723 754 q["source"] ||= api_source 724 q = q.inject([]) {|r,(k,v)| v ? r << "#{k}=#{URI.escape(v, /[^-.!~*'()\w]/n)}" : r }.join("&")725 755 726 756 path = path.sub(%r{^/+}, "") … … 731 761 end 732 762 uri.path += "#{path}.json" 763 uri.query = q.inject([]) {|r,(k,v)| v ? r << "#{k}=#{URI.escape(v, /[^-.!~*'()\w]/n)}" : r }.join("&") 733 764 if require_post? path 734 req = Net::HTTP::Post.new(uri. request_uri, headers)735 req.body = q765 req = Net::HTTP::Post.new(uri.path, headers) 766 req.body = uri.query 736 767 else 737 uri.query = q738 768 req = Net::HTTP::Get.new(uri.request_uri, headers) 739 769 end … … 780 810 781 811 def untinyurl(text) 782 text.gsub(%r"http://(?:( ?:preview\.)?tinyurl\.com|rubyurl\.com)/[0-9a-z=]+"i) {|m|812 text.gsub(%r"http://(?:(preview\.)?tin|rub)yurl\.com)/[0-9a-z=]+"i) {|m| 783 813 uri = URI(m) 784 814 uri.host = uri.host.sub($1, "") if $1
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)