meshchat 0.6.1 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5671565391401b5aabfdbc5b5fbf4fd3fbb4f669
4
- data.tar.gz: c8f10685c22c6ed97b17723d5dfacac3078b1607
3
+ metadata.gz: d92a2e7b4e026335fc14b3c574cd4252a5f0dbb7
4
+ data.tar.gz: 37348ba21effad3647ef2ccd154235b371243810
5
5
  SHA512:
6
- metadata.gz: 35054ce9d7603e797f94da7f785f4e3c43d8a401e4523c915e1614d048bcdfbe671c3ac956da94daa70c630ddc7f702bd1f2232ac757355a2b3cc3989f8b4f59
7
- data.tar.gz: 0dc75c02103b3fff808102fb4bb32e5f6e451f558d1479d0bf2b3d452c93a7d2a34f2b011697490397abcb231724998cfb8239b624a95f376088f86ce52a5c15
6
+ metadata.gz: 6477e3bff10e2bd795ad277a6376351c87fd520796a0bc717baf27776a0698caecfc6573190cb4074c9a3feea2f4fe1fd930d518ce18212978297e39af9a17fc
7
+ data.tar.gz: a3031e4f8b1a5196c3407798006c8ef750eabd83ae791973505480bae32399380d6f76d87c1ff1f400b010452b95f3854fb30520ced07f28e4a355818dcc333d
data/README.md CHANGED
@@ -8,12 +8,15 @@ See [Spiced Gracken](https://github.com/NullVoxPopuli/spiced_gracken)
8
8
 
9
9
  In order to use meshchat with your own interface, you only need to pass in your own implementations of `Display::Base` and `CLI::Base`
10
10
 
11
+ Optionally, you may pass in a notifier to have the mesh-chat trigger notifications for your system
12
+
11
13
  ```ruby
12
14
  MeshChat.start(
13
15
  client_name: NAME, # name of your client
14
16
  client_version: VERSION, # version of your client
15
- display: ui, # your class of your implementation of `Display::Base`
16
- input: input, # your class of your implementation of `CLI::Base`
17
+ display: ui, # your class implementing `Display::Base`
18
+ input: input, # your class implementing `CLI::Base`
19
+ notifier: notifier, # your class implementing `Notifier::Base`
17
20
  on_display_start: ->{ MeshChat::CLI.check_startup_settings } # optional
18
21
  )
19
22
  ```
data/lib/meshchat.rb CHANGED
@@ -4,10 +4,8 @@ require 'socket'
4
4
  require 'json'
5
5
  require 'date'
6
6
  require 'colorize'
7
- require 'curses'
8
7
  require 'io/console'
9
8
  require "readline"
10
-
11
9
  require 'logger'
12
10
 
13
11
  # required gems
@@ -16,7 +14,6 @@ require 'sqlite3'
16
14
  require 'active_record'
17
15
  require 'curb'
18
16
  require 'thin'
19
- require 'libnotify'
20
17
 
21
18
  # active support extensions
22
19
  require 'active_support/core_ext/module/delegation'
@@ -47,7 +44,6 @@ module MeshChat
47
44
  Settings = Config::Settings
48
45
  Node = Models::Entry
49
46
  Cipher = Encryption
50
- Notify = Notifier::Base
51
47
 
52
48
  module_function
53
49
 
@@ -59,12 +55,17 @@ module MeshChat
59
55
  display: Display::Base,
60
56
  client_name: NAME,
61
57
  client_version: VERSION,
62
- input: CLI::Base
58
+ input: CLI::Base,
59
+ notifier: Notifier::Base
63
60
  }
64
61
  options = defaults.merge(overrides)
65
62
 
66
63
  # before doing anything, ensure we have a place to store data
67
64
  Database.setup_storage
65
+
66
+ # set up the notifier (if there is one)
67
+ const_set(:Notify, options[:notifier])
68
+
68
69
  # set the options / overrides!
69
70
  Instance.start(options)
70
71
  end
data/lib/meshchat/cli.rb CHANGED
@@ -123,7 +123,6 @@ module MeshChat
123
123
  threaded: true
124
124
  )
125
125
  end
126
-
127
126
  end
128
127
 
129
128
  def close_server
@@ -18,7 +18,10 @@ module MeshChat
18
18
 
19
19
  if they_only_have.present?
20
20
  they_only_have.each do |n|
21
- Node.from_json(n).save!
21
+ # be sure that we don't add ourselves
22
+ unless n['uid'] == Settings['uid']
23
+ Node.from_json(n).save!
24
+ end
22
25
  end
23
26
  end
24
27
 
@@ -22,6 +22,8 @@ module MeshChat
22
22
  node: node,
23
23
  message: NodeList.new(message: Node.as_json)
24
24
  )
25
+ else
26
+ Display.debug 'node list hash matches'
25
27
  end
26
28
  end
27
29
  end
@@ -2,7 +2,7 @@ module MeshChat
2
2
  module Message
3
3
  class PingReply < Base
4
4
  def display
5
- 'ping successful'.freeze
5
+ 'ping successful'.freeze if Settings.debug?
6
6
  end
7
7
  end
8
8
  end
@@ -15,6 +15,14 @@ module MeshChat
15
15
  # TODO: do we want to return an error if
16
16
  # we can't decrypt?
17
17
 
18
+ def self.run!(*)
19
+ # start the server
20
+ super
21
+
22
+ # send a pingall to see who's online
23
+ MeshChat::Command::PingAll.new.handle
24
+ end
25
+
18
26
  get '/' do
19
27
  process_request
20
28
  end
@@ -13,7 +13,8 @@ module MeshChat
13
13
 
14
14
  # Notifier::Base is a singleton
15
15
  # Not all Notifiers need to be singletons,
16
- # but it doesn't really make sense to have more than one
16
+ # but it doesn't really make sense to have more than one.
17
+ # An OS generally only has one notification system
17
18
  class << self
18
19
  delegate :show, to: :instance
19
20
 
@@ -23,27 +24,7 @@ module MeshChat
23
24
  end
24
25
 
25
26
  def show(*args)
26
- libnotify_message.update(*args) do |notify|
27
- yield(notify) if block_given?
28
- end
29
- end
30
-
31
- private
32
-
33
- def libnotify_message()
34
- @message ||= Libnotify.new do |notify|
35
- notify.summary = MeshChat::NAME
36
- notify.body = ""
37
- notify.timeout = 1.5 # 1.5 (s), 1000 (ms), "2", nil, false
38
- notify.urgency = :normal # :low, :normal, :critical
39
- notify.append = false # default true - append onto existing notification
40
- notify.transient = false # default false - keep the notifications around after display
41
- # TODO: this will vary on each system - maybe package icons
42
- # with the gem
43
- notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
44
- end
45
-
46
- @message
27
+ # by default don't notify
47
28
  end
48
29
  end
49
30
  end
@@ -1,3 +1,3 @@
1
1
  module MeshChat
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meshchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - L. Preston Sego III
@@ -108,34 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: curses
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: libnotify
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
111
  - !ruby/object:Gem::Dependency
140
112
  name: awesome_print
141
113
  requirement: !ruby/object:Gem::Requirement
@@ -285,6 +257,6 @@ rubyforge_project:
285
257
  rubygems_version: 2.4.7
286
258
  signing_key:
287
259
  specification_version: 4
288
- summary: MeshChat-0.6.1
260
+ summary: MeshChat-0.6.3
289
261
  test_files: []
290
262
  has_rdoc: