summaryrefslogtreecommitdiff
path: root/nanochat_send
diff options
context:
space:
mode:
Diffstat (limited to 'nanochat_send')
-rw-r--r--nanochat_send/pylon.lua24
1 files changed, 11 insertions, 13 deletions
diff --git a/nanochat_send/pylon.lua b/nanochat_send/pylon.lua
index 0e57763..f7cd60f 100644
--- a/nanochat_send/pylon.lua
+++ b/nanochat_send/pylon.lua
@@ -1,25 +1,23 @@
-local Queue = require 'queue'
local cqueues = require 'cqueues'
-local pylon = require 'pylon'
-local pprint = require 'pprint'
-local Channel = require 'channel'
local socket = require 'cqueues.socket'
+local pprint = require 'pprint'
+local class = require 'r.class'
-local NanochatSend = pylon.subclass "nanochat_send"
+local BasePylon = require 'pylon'
+local Channel = require 'channel'
+local NanochatSend = class.extend(BasePylon)
function NanochatSend:init()
- self:check_config "server port poll"
+ self:_check_fields "server port poll"
end
function NanochatSend:_connect()
- if not self.sock then
- self.sock = socket.connect(self.server, tonumber(self.port))
- self.sock:write("LAST 0\n")
- self.sock:read("*l") -- discard count
- self.lastid = tonumber(assert(self.sock:read("*l")))
- self.usids = {}
- end
+ self.sock = socket.connect(self.server, tonumber(self.port))
+ self.sock:write("LAST 0\n")
+ self.sock:read("*l") -- discard count
+ self.lastid = tonumber(assert(self.sock:read("*l")))
+ self.usids = {}
end
function NanochatSend:add_channel(channel)