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) }
}
Button {
cls.addContact(jidStr: "asdadad22@asdfsdf.df", name: "bobob")
cls.addContact(jidStr: "asdadad33@asdfsdf.df", name: "sdsd")
} label: {
Text("Add contact")
.padding()

View file

@ -107,23 +107,35 @@ final class RosterModule: XmppModule {
case .stanzaInbound(let stanza):
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 {
case .iq(.set):
return nil
break
// return await processSet(state: state, stanza: stanza)
case .iq(.result):
return nil
break
// return await processResult(state: state, stanza: stanza)
case .iq(.error):
// handle errors here
// TODO: implement error catching
return nil
break
default:
return nil
break
}
// process items
// result
return nil
} else {
return nil
}