This commit is contained in:
fmodf 2025-01-09 18:47:42 +01:00
parent 821d9dcfe9
commit 3b92aa7606
2 changed files with 17 additions and 5 deletions

View file

@ -31,7 +31,7 @@ struct TestScreen: View {
.background { Color.blue.opacity(0.4) } .background { Color.blue.opacity(0.4) }
} }
Button { Button {
cls.addContact(jidStr: "asdadad22@asdfsdf.df", name: "bobob") cls.addContact(jidStr: "asdadad33@asdfsdf.df", name: "sdsd")
} label: { } label: {
Text("Add contact") Text("Add contact")
.padding() .padding()

View file

@ -107,23 +107,35 @@ final class RosterModule: XmppModule {
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" {
// update version if needed
if let ver = stanza.wrapped.nodes.first(where: { $0.name == "query" })?.attributes["ver"] {
await storage?.setRosterVer(jid: state.jid, version: ver)
}
// get items from stanza
var items: [XMLElement] = []
switch stanza.type { switch stanza.type {
case .iq(.set): case .iq(.set):
return nil break
// return await processSet(state: state, stanza: stanza) // return await processSet(state: state, stanza: stanza)
case .iq(.result): case .iq(.result):
return nil break
// return await processResult(state: state, stanza: stanza) // return await processResult(state: state, stanza: stanza)
case .iq(.error): case .iq(.error):
// handle errors here // handle errors here
// TODO: implement error catching // TODO: implement error catching
return nil break
default: default:
return nil break
} }
// process items
// result
return nil
} else { } else {
return nil return nil
} }