class Meshchat::Ui::Command::Whisper
Attributes
_target_node[RW]
Public Class Methods
description()
click to toggle source
# File lib/meshchat/ui/command/whisper.rb, line 8 def self.description 'sends a private message to a spepcific person' end
Public Instance Methods
find_node_and_whisper(target)
click to toggle source
# File lib/meshchat/ui/command/whisper.rb, line 42 def find_node_and_whisper(target) NodeFinder.find_by_target(target) do |node| if node send_message_to_node(node) else Display.alert "node for #{target} not found or is not online" end end end
handle()
click to toggle source
# File lib/meshchat/ui/command/whisper.rb, line 23 def handle return send_message_to_node(_target_node) if _target_node find_node_and_whisper(target) end
message()
click to toggle source
# File lib/meshchat/ui/command/whisper.rb, line 18 def message return _input if _target_node command_args[1..command_args.length].try(:join, ' ') end
send_message_to_node(node)
click to toggle source
# File lib/meshchat/ui/command/whisper.rb, line 28 def send_message_to_node(node) m = _message_factory.create( Network::Message::WHISPER, data: { message: message, to: target } ) Display.whisper m.display _message_dispatcher.send_message(node: node, message: m) end
target()
click to toggle source
# File lib/meshchat/ui/command/whisper.rb, line 12 def target # get first arg return _target_node.alias_name if _target_node command end