33 lines
919 B
Swift
33 lines
919 B
Swift
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
|
|
}
|
|
|
|
func process(state _: ClientState, with event: Event) async -> Event? {
|
|
switch event {
|
|
case .rosterRequestDone:
|
|
guard let initial = Stanza.initialPresence() else { return nil }
|
|
return .stanzaOutbound(initial)
|
|
|
|
case .stanzaInbound(let stanza):
|
|
return nil
|
|
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
}
|