Pergunta

I'm trying to set the users presence to away (or anything at the moment). I'm using the following code but it doesn't seem to do anything.

XMPPPresence *presence = [XMPPPresence presence];
NSXMLElement *show = [NSXMLElement elementWithName:@"show" stringValue:@"away"];

NSXMLElement *status = [NSXMLElement elementWithName:@"status" stringValue:@"away"];
[presence addChild:show];
[presence addChild:status];
[[self xmppStream] sendElement:presence];

I've used iChat to make sure all the presence subscriptions on my Ejabberd server are correct and working. This is driving me crazy, am I missing something?

Foi útil?

Solução

I figured it out, turns out the presence wasn't being sent out by the app as I'd missed this out:

- (MMApplication *)appDelegate {
    return (MMApplication *)[[UIApplication sharedApplication] delegate];
}
- (XMPPStream *)xmppStream {
    return [[self appDelegate] xmppStream];
}

Works perfectly now

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top