Class: Fluent::IRCOutput::IRCConnection
- Inherits:
-
Cool.io::TCPSocket
- Object
- Cool.io::TCPSocket
- Fluent::IRCOutput::IRCConnection
- Defined in:
- lib/fluent/plugin/out_irc.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#nick ⇒ Object
Returns the value of attribute nick.
-
#password ⇒ Object
Returns the value of attribute password.
-
#real ⇒ Object
Returns the value of attribute real.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
98 99 100 |
# File 'lib/fluent/plugin/out_irc.rb', line 98 def channel @channel end |
#nick ⇒ Object
Returns the value of attribute nick.
98 99 100 |
# File 'lib/fluent/plugin/out_irc.rb', line 98 def nick @nick end |
#password ⇒ Object
Returns the value of attribute password.
98 99 100 |
# File 'lib/fluent/plugin/out_irc.rb', line 98 def password @password end |
#real ⇒ Object
Returns the value of attribute real.
98 99 100 |
# File 'lib/fluent/plugin/out_irc.rb', line 98 def real @real end |
#user ⇒ Object
Returns the value of attribute user.
98 99 100 |
# File 'lib/fluent/plugin/out_irc.rb', line 98 def user @user end |
Instance Method Details
#on_connect ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/fluent/plugin/out_irc.rb', line 100 def on_connect if @password IRCParser.(:pass) do |m| m.password = @password write m end end IRCParser.(:nick) do |m| m.nick = @nick write m end IRCParser.(:user) do |m| m.user = @user m.postfix = @real write m end end |
#on_read(data) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/fluent/plugin/out_irc.rb', line 118 def on_read(data) data.each_line do |line| begin msg = IRCParser.parse(line) case msg.class.to_sym when :rpl_welcome IRCParser.(:join) do |m| m.channels = @channel write m end when :ping IRCParser.(:pong) do |m| m.target = msg.target m.body = msg.body write m end when :error $log.warn "out_irc: an error occured. \"#{msg.}\"" end rescue #TODO end end end |
#send_message(msg) ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/fluent/plugin/out_irc.rb', line 143 def (msg) IRCParser.(:priv_msg) do |m| m.target = @channel m.body = msg write m end end |