diff --git a/AnotherIM/View/TestScreen.swift b/AnotherIM/View/TestScreen.swift index 80dc5c5..ae32501 100644 --- a/AnotherIM/View/TestScreen.swift +++ b/AnotherIM/View/TestScreen.swift @@ -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() diff --git a/AnotherXMPP/modules/roster/RosterModule.swift b/AnotherXMPP/modules/roster/RosterModule.swift index 0fdb6e8..ed1d661 100644 --- a/AnotherXMPP/modules/roster/RosterModule.swift +++ b/AnotherXMPP/modules/roster/RosterModule.swift @@ -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 }