net-irc 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +9 -0
- data/Rakefile +10 -19
- data/examples/2ch.rb +225 -0
- data/examples/2ig.rb +267 -0
- data/examples/echo_bot.rb +1 -1
- data/examples/gmail.rb +2 -2
- data/examples/hatena-star-stream.rb +10 -4
- data/examples/hig.rb +9 -4
- data/examples/iig.rb +3 -3
- data/examples/ircd.rb +1 -1
- data/examples/lig.rb +551 -0
- data/examples/lingr.rb +327 -0
- data/examples/mixi.rb +2 -2
- data/examples/sig.rb +2 -2
- data/examples/tig.rb +552 -386
- data/examples/wig.rb +11 -4
- data/lib/net/irc.rb +1 -1
- data/lib/net/irc/server.rb +1 -0
- data/spec/channel_manager_spec.rb +4 -1
- data/spec/net-irc_spec.rb +4 -2
- metadata +12 -11
data/examples/wig.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# vim:
|
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"
|
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
|
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
|
|
data/lib/net/irc.rb
CHANGED
data/lib/net/irc/server.rb
CHANGED
data/spec/net-irc_spec.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
#!spec
|
2
2
|
# coding: ASCII-8BIT
|
3
|
-
#
|
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.
|
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-
|
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://
|
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:
|
91
|
-
rubygems_version: 1.3.
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 1.3.5
|
92
93
|
signing_key:
|
93
|
-
specification_version:
|
94
|
+
specification_version: 3
|
94
95
|
summary: library for implementing IRC server and client
|
95
96
|
test_files: []
|
96
97
|
|