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), ParserModule(self.fire),
SessionModule(), SessionModule(),
AuthorizationModule(self.storage), AuthorizationModule(self.storage),
StanzaModule(self.storage) StanzaModule(self.storage),
DiscoveryModule()
] ]
init(storage: any XMPPClientStorageProtocol, userAgent: UserAgent) { init(storage: any XMPPClientStorageProtocol, userAgent: UserAgent) {

View file

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