I am building an iPhone application using the XMPP Framework. I have an issue in the code bellow:
NSString *presenceType = [presence type]; // online/offline
NSString *myUsername = [[sender myJID] user];
NSString *presenceFromUser = [[presence from] user];
if (![presenceFromUser isEqualToString:myUsername]) {
if ([presenceType isEqualToString:@"available"]) {
[self._chatDelegate newBuddyOnline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, @"server.net"]];
} else if ([presenceType isEqualToString:@"unavailable"]) {
[self._chatDelegate buddyWentOffline:[NSString stringWithFormat:@"%@@%@", presenceFromUser, @"server.net"]];
}
}
Suppose that i have created 2 jabber accounts, ichat@server.net and iPhone@server.net. When i launch my application with the iPhone account, i can't see no one is connected. when i remove this line:
if (![presenceFromUser isEqualToString:myUsername])
i can see two rows with iphone@server.net (my account) one the online buddies table view. In Debug mode, when i checked the presenceFromUser variable, each time it's containing MY login not login for other buddies online.
Can you help me to fix this please. Thanks in advance