net-irc 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # vim:fileencoding=UTF-8:
2
+ # vim:encoding=UTF-8:
3
3
  =begin
4
4
 
5
5
  # wig.rb
@@ -93,7 +93,7 @@ Ruby's by cho45
93
93
  $LOAD_PATH << "lib"
94
94
  $LOAD_PATH << "../lib"
95
95
 
96
- $KCODE = "u" if RUBY_VERSION < "1.9" # json use this
96
+ $KCODE = "u" unless defined? ::Encoding # json use this
97
97
 
98
98
  require "rubygems"
99
99
  require "net/irc"
@@ -250,7 +250,7 @@ class WassrIrcGateway < Net::IRC::Server::Session
250
250
  end
251
251
 
252
252
  def on_privmsg(m)
253
- return m[1].ctcps.each {|ctcp| on_ctcp(m[0], ctcp) } if m.ctcp?
253
+ return m.ctcps.each {|ctcp| on_ctcp(m[0], ctcp) } if m.ctcp?
254
254
  retry_count = 3
255
255
  ret = nil
256
256
  target, message = *m.params
@@ -258,6 +258,7 @@ class WassrIrcGateway < Net::IRC::Server::Session
258
258
  if target =~ /^#(.+)/
259
259
  channel = Regexp.last_match[1]
260
260
  reply = message[/\s+>(.+)$/, 1]
261
+ reply = reply.force_encoding("UTF-8") if reply && reply.respond_to?(:force_encoding)
261
262
  if @utf7
262
263
  message = Iconv.iconv("UTF-7", "UTF-8", message).join
263
264
  message = message.force_encoding("ASCII-8BIT") if message.respond_to?(:force_encoding)
@@ -678,7 +679,7 @@ class WassrIrcGateway < Net::IRC::Server::Session
678
679
  text.gsub(%r|http://(preview\.)?tinyurl\.com/[0-9a-z=]+|i) {|m|
679
680
  uri = URI(m)
680
681
  uri.host = uri.host.sub($1, "") if $1
681
- Net::HTTP.start(uri.host, uri.port) {|http|
682
+ expanded = Net::HTTP.start(uri.host, uri.port) {|http|
682
683
  http.open_timeout = 3
683
684
  begin
684
685
  http.head(uri.request_uri, { "User-Agent" => @user_agent })["Location"] || m
@@ -686,6 +687,12 @@ class WassrIrcGateway < Net::IRC::Server::Session
686
687
  m
687
688
  end
688
689
  }
690
+ expanded = URI(expanded)
691
+ if %w|http https|.include? expanded.scheme
692
+ expanded.to_s
693
+ else
694
+ "#{expanded.scheme}: #{uri}"
695
+ end
689
696
  }
690
697
  end
691
698
 
@@ -8,7 +8,7 @@ require "monitor"
8
8
  module Net; end
9
9
 
10
10
  module Net::IRC
11
- VERSION = "0.0.8".freeze
11
+ VERSION = "0.0.9".freeze
12
12
  class IRCException < StandardError; end
13
13
 
14
14
  require "net/irc/constants"
@@ -1,6 +1,7 @@
1
1
  class Net::IRC::Server
2
2
  # Server global state for accessing Server::Session
3
3
  attr_accessor :state
4
+ attr_accessor :sessions
4
5
 
5
6
  def initialize(host, port, session_class, opts={})
6
7
  @host = host
@@ -1,8 +1,11 @@
1
- #!/usr/bin/env ruby
1
+ #!spec
2
2
 
3
3
  $LOAD_PATH << "lib"
4
4
  $LOAD_PATH << "../lib"
5
5
 
6
+ require "rubygems"
7
+ require "spec"
8
+ require "thread"
6
9
  require "net/irc"
7
10
  require "net/irc/client/channel_manager"
8
11
  include Net::IRC
@@ -1,10 +1,12 @@
1
- #!/usr/bin/env ruby
1
+ #!spec
2
2
  # coding: ASCII-8BIT
3
- # :vim:fileencoding=utf-8:
3
+ # vim:encoding=UTF-8:
4
4
 
5
5
  $LOAD_PATH << "lib"
6
6
  $LOAD_PATH << "../lib"
7
7
 
8
+ require "rubygems"
9
+ require "spec"
8
10
  require "net/irc"
9
11
  include Net::IRC
10
12
  include Constants
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-irc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - cho45
@@ -9,7 +9,7 @@ autorequire: ""
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-08 00:00:00 +09:00
12
+ date: 2009-10-11 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -30,20 +30,17 @@ files:
30
30
  - spec/modeparser_spec.rb
31
31
  - spec/net-irc_spec.rb
32
32
  - spec/spec.opts
33
- - lib/net
34
- - lib/net/irc
35
- - lib/net/irc/client
36
33
  - lib/net/irc/client/channel_manager.rb
37
34
  - lib/net/irc/client.rb
38
35
  - lib/net/irc/constants.rb
39
- - lib/net/irc/message
40
- - lib/net/irc/message/modeparser
41
36
  - lib/net/irc/message/modeparser.rb
42
37
  - lib/net/irc/message/serverconfig.rb
43
38
  - lib/net/irc/message.rb
44
39
  - lib/net/irc/pattern.rb
45
40
  - lib/net/irc/server.rb
46
41
  - lib/net/irc.rb
42
+ - examples/2ch.rb
43
+ - examples/2ig.rb
47
44
  - examples/client.rb
48
45
  - examples/echo_bot.rb
49
46
  - examples/gmail.rb
@@ -51,12 +48,16 @@ files:
51
48
  - examples/hig.rb
52
49
  - examples/iig.rb
53
50
  - examples/ircd.rb
51
+ - examples/lig.rb
52
+ - examples/lingr.rb
54
53
  - examples/mixi.rb
55
54
  - examples/sig.rb
56
55
  - examples/tig.rb
57
56
  - examples/wig.rb
58
57
  has_rdoc: true
59
- homepage: http://lowreal.rubyforge.org
58
+ homepage: http://cho45.stfuawsc.com/net-irc/
59
+ licenses: []
60
+
60
61
  post_install_message:
61
62
  rdoc_options:
62
63
  - --title
@@ -87,10 +88,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  version:
88
89
  requirements: []
89
90
 
90
- rubyforge_project: lowreal
91
- rubygems_version: 1.3.1
91
+ rubyforge_project:
92
+ rubygems_version: 1.3.5
92
93
  signing_key:
93
- specification_version: 2
94
+ specification_version: 3
94
95
  summary: library for implementing IRC server and client
95
96
  test_files: []
96
97