Class: MeshChat::Message::NodeListHash
- Defined in:
- lib/meshchat/message/node_list_hash.rb
Instance Attribute Summary
Attributes inherited from Base
#payload, #sender_location, #sender_name, #sender_uid, #time_recieved
Instance Method Summary collapse
-
#handle ⇒ NilClass
node list hash is received.
- #message ⇒ Object
- #respond ⇒ Object
Methods inherited from Base
#client, #client_version, #display, #initialize, #render, #type
Constructor Details
This class inherits a constructor from MeshChat::Message::Base
Instance Method Details
#handle ⇒ NilClass
node list hash is received
10 11 12 13 |
# File 'lib/meshchat/message/node_list_hash.rb', line 10 def handle respond return end |
#message ⇒ Object
4 5 6 |
# File 'lib/meshchat/message/node_list_hash.rb', line 4 def ||= Node.as_sha512 end |
#respond ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/meshchat/message/node_list_hash.rb', line 15 def respond if != Node.as_sha512 Display.debug 'node list hashes do not match' location = payload['sender']['location'] Display.debug 'sending a node list to ' + location node = Node.find_by_location(location) MeshChat::Net::Client.send( node: node, message: NodeList.new(message: Node.as_json) ) else Display.debug 'node list hash matches' end end |