summaryrefslogtreecommitdiff
path: root/nanochat_send
diff options
context:
space:
mode:
authorrebecca <ubq323@ubq323.website>2026-09-12 18:58:49 +0100
committerrebecca <ubq323@ubq323.website>2026-09-12 18:58:49 +0100
commit90856a67fa2fa8061254006974b8921b4e97bc1a (patch)
treecce28902a826d511b6bd38755c886746fe5cd18e /nanochat_send
parent085040f49cc1386b294857aa68651329b0044420 (diff)
more oop refactoring
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)