diff --git a/AnotherXMPP/modules/roster/RosterModule.swift b/AnotherXMPP/modules/roster/RosterModule.swift index 410d818..0fdb6e8 100644 --- a/AnotherXMPP/modules/roster/RosterModule.swift +++ b/AnotherXMPP/modules/roster/RosterModule.swift @@ -81,8 +81,29 @@ final class RosterModule: XmppModule { } case .deleteRosterItem(let jidStr): - return nil - // return await delete(state: state, jidStr: jidStr) + let req = Stanza.iqSet( + 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): 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 func update(state: ClientState, jidStr: String, args: [String: String]) async -> Event? { // print(state, jidStr, args)