2024-12-26 13:12:19 +00:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
// NSString* const kSubBoth = @"both";
|
|
|
|
// NSString* const kSubNone = @"none";
|
|
|
|
// NSString* const kSubTo = @"to";
|
|
|
|
// NSString* const kSubFrom = @"from";
|
|
|
|
// NSString* const kSubRemove = @"remove";
|
|
|
|
// NSString* const kAskSubscribe = @"subscribe";
|
|
|
|
|
|
|
|
// TODO: Cancel subscr. request when contact deleted from roster
|
|
|
|
// Update when server sends roster push also
|
|
|
|
final class PresenceModule: XmppModule {
|
|
|
|
let id = "Presence module"
|
|
|
|
|
|
|
|
func reduce(oldState: ClientState, with _: Event) -> ClientState {
|
|
|
|
oldState
|
|
|
|
}
|
|
|
|
|
2025-01-14 02:52:20 +00:00
|
|
|
func process(state _: ClientState, with event: Event) async -> Event? {
|
|
|
|
switch event {
|
|
|
|
case .rosterRequestDone:
|
2025-01-14 03:19:12 +00:00
|
|
|
guard let initial = Stanza.initialPresence() else { return nil }
|
|
|
|
return .stanzaOutbound(initial)
|
2025-01-14 02:52:20 +00:00
|
|
|
|
|
|
|
case .stanzaInbound(let stanza):
|
|
|
|
return nil
|
|
|
|
|
|
|
|
default:
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-26 13:12:19 +00:00
|
|
|
}
|
|
|
|
}
|