Class: Cinch::IRC
- Inherits:
-
Object
- Object
- Cinch::IRC
- Defined in:
- lib/cinch/plugins/encinch/extend.rb
Instance Method Summary collapse
-
#encinch_send ⇒ Object
alias instead of modify directly.
-
#send(msg) ⇒ void
Send a message to the server.
Instance Method Details
#encinch_send ⇒ Object
alias instead of modify directly
6 |
# File 'lib/cinch/plugins/encinch/extend.rb', line 6 alias :encinch_send :send |
#send(msg) ⇒ void
This method returns an undefined value.
Send a message to the server.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cinch/plugins/encinch/extend.rb', line 11 def send(msg) if msg.match(/(PRIVMSG|NOTICE)/) && !msg.match(/\+OK (\S+)/) _, _, target, = *msg.match(/(\S+) (\S+) :(.*)/m) target.downcase! unless .empty? # retrieve bot options = @bot.config.shared[:encinch].storage.data # ignore if target is in the 'uncrypted' array unless [:uncrypted].include?(target) # match ctcp? and action messages if matched = .match(/\001ACTION\s(.+)\001/) = matched[-1] elsif =~ /\001.+\001/ return encinch_send(msg) end # key exists if key = ([:encrypt][target] || [:encrypt][:default]) encrypted = Cinch::Plugins::EnCinch::Encryption.new(key).encrypt() msg.sub!(, encrypted) else return if [:drop] end end end end encinch_send(msg) end |