This commit is contained in:
fmodf 2024-12-16 09:04:14 +01:00
parent ad0c82348f
commit ff6f3f3ee2
3 changed files with 41 additions and 5 deletions

View file

@ -93,7 +93,8 @@ final class XMPPClient {
ParserModule(self.fire),
SessionModule(),
AuthorizationModule(self.storage),
StanzaModule(self.storage)
StanzaModule(self.storage),
DiscoveryModule()
]
init(storage: any XMPPClientStorageProtocol, userAgent: UserAgent) {

View file

@ -1,14 +1,14 @@
import Foundation
enum StanzaType {
enum IqType: String {
enum StanzaType: Codable & Equatable {
enum IqType: String, Codable & Equatable {
case get
case set
case result
case error
}
enum MessageType: String {
enum MessageType: String, Codable & Equatable {
case chat
case groupchat
case headline
@ -17,7 +17,7 @@ enum StanzaType {
case none
}
enum PresenceType: String {
enum PresenceType: String, Codable & Equatable {
case subscribe
case unsubscribe
case subscribed

View file

@ -0,0 +1,35 @@
// XEP-0030
import Foundation
// TODO: Implement
final class DiscoveryModule: XmppModule {
let id = "Discovery module"
private let reqId = ""
func reduce(oldState: ClientState, with _: Event) -> ClientState {
oldState
}
func process(state _: ClientState, with _: Event) async -> Event? {
// switch event {
// case .streamReady:
// let req = Stanza.iqGet(payload: XMLElement(name: "query", xmlns: "http://jabber.org/protocol/disco#info", attributes: [:], content: nil, nodes: []))
// if let req {
// return .stanzaOutbound(req)
// } else {
// return nil
// }
//
// case .stanzaInbound(let stanza):
// if stanza.id == reqId && stanza.type == .iq(.result) {
// print(stanza)
// return nil
// }
//
// default:
// return nil
// }
nil
}
}