Revision d57fd602
Added by Marc Dequènes over 13 years ago
- ID d57fd602139e64243c0192e0db3c39bfddbf943f
lib/cyborghood/cyborg/conversation.rb | ||
---|---|---|
|
||
attr_reader :bot
|
||
|
||
def initialize(bot)
|
||
def initialize(bot, &block)
|
||
@bot = bot
|
||
@comm_logic_block = block
|
||
|
||
super
|
||
|
||
... | ... | |
@bot.register_communication @peer_id, self
|
||
end
|
||
|
||
def set_comm_ready
|
||
@comm_logic_block.call self
|
||
end
|
||
|
||
def set_error_status(fatal = false)
|
||
# fatal status is conservative, it cannot be canceled
|
||
@reveive_fatal_error = @reveive_fatal_error || fatal
|
||
... | ... | |
end
|
||
|
||
def send_line(msg)
|
||
return if error?
|
||
|
||
logger.debug "Sending data [#{identifier}]: #{msg}"
|
||
send_data "#{msg}\n"
|
||
end
|
||
... | ... | |
|
||
unless msg_quit.nil?
|
||
send_quit_decline msg_quit
|
||
@comm_logic_block.call false
|
||
close_connection_after_writing
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] add client support to BotNet