This commit is contained in:
fmodf 2025-01-09 18:07:39 +01:00
parent dbcd071b92
commit 821d9dcfe9

View file

@ -81,8 +81,29 @@ final class RosterModule: XmppModule {
} }
case .deleteRosterItem(let jidStr): case .deleteRosterItem(let jidStr):
return nil let req = Stanza.iqSet(
// return await delete(state: state, jidStr: jidStr) from: state.jid.full,
payload: XMLElement(
name: "query",
xmlns: "jabber:iq:roster",
attributes: [:],
content: nil,
nodes: [
XMLElement(
name: "item",
xmlns: nil,
attributes: ["jid": jidStr, "subscription": "remove"],
content: nil,
nodes: []
)
]
)
)
if let req {
return .stanzaOutbound(req)
} else {
return nil
}
case .stanzaInbound(let stanza): case .stanzaInbound(let stanza):
if let query = stanza.wrapped.nodes.first(where: { $0.name == "query" }), query.xmlns == "jabber:iq:roster" { if let query = stanza.wrapped.nodes.first(where: { $0.name == "query" }), query.xmlns == "jabber:iq:roster" {
@ -113,13 +134,6 @@ final class RosterModule: XmppModule {
} }
} }
private extension RosterModule {
private func sendUpdate(state: ClientState, jidStr: String, args: [String: String]) async -> Event? {
print(state, jidStr, args)
return nil
}
}
// private extension RosterModule { // private extension RosterModule {
// private func update(state: ClientState, jidStr: String, args: [String: String]) async -> Event? { // private func update(state: ClientState, jidStr: String, args: [String: String]) async -> Event? {
// print(state, jidStr, args) // print(state, jidStr, args)