module Net::IRC

Constants

VERSION

Public Class Methods

ctcp_decode(str) click to toggle source

Decode from CTCP message delimited with x01.

   # File lib/net/irc.rb
48 def ctcp_decode(str)
49         ctcp_dequote(str.delete("\x01"))
50 end
ctcp_dequote(str) click to toggle source
   # File lib/net/irc.rb
59 def ctcp_dequote(str)
60         low_dequote(str).gsub("\\a", "\x01").gsub(/\\(.|\z)/m, "\\1")
61 end
ctcp_encode(str) click to toggle source

Encode to CTCP message. Prefix and postfix x01.

   # File lib/net/irc.rb
41 def ctcp_encode(str)
42         "\x01#{ctcp_quote(str)}\x01"
43 end
ctcp_quote(str) click to toggle source

alias :ctcp_decoding :ctcp_decode

   # File lib/net/irc.rb
54 def ctcp_quote(str)
55         low_quote(str.gsub("\\", "\\\\\\\\").gsub("\x01", "\\a"))
56 end

Private Instance Methods

ctcp_decode(str) click to toggle source

Decode from CTCP message delimited with x01.

   # File lib/net/irc.rb
48 def ctcp_decode(str)
49         ctcp_dequote(str.delete("\x01"))
50 end
ctcp_dequote(str) click to toggle source
   # File lib/net/irc.rb
59 def ctcp_dequote(str)
60         low_dequote(str).gsub("\\a", "\x01").gsub(/\\(.|\z)/m, "\\1")
61 end
ctcp_encode(str) click to toggle source

Encode to CTCP message. Prefix and postfix x01.

   # File lib/net/irc.rb
41 def ctcp_encode(str)
42         "\x01#{ctcp_quote(str)}\x01"
43 end
ctcp_quote(str) click to toggle source

alias :ctcp_decoding :ctcp_decode

   # File lib/net/irc.rb
54 def ctcp_quote(str)
55         low_quote(str.gsub("\\", "\\\\\\\\").gsub("\x01", "\\a"))
56 end
low_dequote(str) click to toggle source
   # File lib/net/irc.rb
69 def low_dequote(str)
70         str.gsub("\x10n", "\n").gsub("\x10r", "\r").gsub("\x10\x30", "\x00").gsub("\x10\x10", "\x10")
71 end
low_quote(str) click to toggle source
   # File lib/net/irc.rb
65 def low_quote(str)
66         str.gsub("\x10", "\x10\x10").gsub("\x00", "\x10\x30").gsub("\r", "\x10r").gsub("\n", "\x10n")
67 end