aboutsummaryrefslogtreecommitdiff
path: root/Sources/swiftGopherClient/gopherRequestResponseHandler.swift
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2023-12-13 02:17:12 -0700
committerNavan Chauhan <navanchauhan@gmail.com>2023-12-13 02:17:12 -0700
commit9e3cb79bbfe4eb55ef820b6afed2129412eaabe9 (patch)
tree10b4a22f585df9c75a5169cfd6a9b19599e331ad /Sources/swiftGopherClient/gopherRequestResponseHandler.swift
parentfe8c3f5aed3c45f8d3f6679791548f3f565422f4 (diff)
public structs
Diffstat (limited to 'Sources/swiftGopherClient/gopherRequestResponseHandler.swift')
-rw-r--r--Sources/swiftGopherClient/gopherRequestResponseHandler.swift29
1 files changed, 18 insertions, 11 deletions
diff --git a/Sources/swiftGopherClient/gopherRequestResponseHandler.swift b/Sources/swiftGopherClient/gopherRequestResponseHandler.swift
index 0cd040a..3d15d66 100644
--- a/Sources/swiftGopherClient/gopherRequestResponseHandler.swift
+++ b/Sources/swiftGopherClient/gopherRequestResponseHandler.swift
@@ -14,9 +14,9 @@ final class GopherRequestResponseHandler: ChannelInboundHandler {
private var accumulatedData: ByteBuffer
private let message: String
- private let completion: (Result<String, Error>) -> Void
+ private let completion: (Result<[gopherItem], Error>) -> Void
- init(message: String, completion: @escaping (Result<String, Error>) -> Void) {
+ init(message: String, completion: @escaping (Result<[gopherItem], Error>) -> Void) {
self.message = message
self.completion = completion
self.accumulatedData = ByteBuffer()
@@ -95,17 +95,24 @@ final class GopherRequestResponseHandler: ChannelInboundHandler {
print("done parsing")
- completion(.success(response))
+ completion(.success(gopherServerResponse))
+
+ //completion(.success(response))
}
}
-struct gopherItem {
- var rawLine: String
- var message: String = ""
- var parsedItemType: gopherItemType = .info
- var host: String = "error.host"
- var port: Int = 1
- var selector: String = ""
- var valid: Bool = true
+public struct gopherItem {
+
+ public var rawLine: String
+ public var message: String = ""
+ public var parsedItemType: gopherItemType = .info
+ public var host: String = "error.host"
+ public var port: Int = 1
+ public var selector: String = ""
+ public var valid: Bool = true
+
+ public init(rawLine: String) {
+ self.rawLine = rawLine
+ }
}