@implementation JubChatClient
@synthesize connection;
@synthesize roster;
+@synthesize presence;
@synthesize ui;
- initWithConfig: (JubConfig*)config
[roster release];
[streamManagement release];
[connection release];
+ [presence release];
[super dealloc];
}
-- (void)connection: (XMPPConnection*)conn_
+- (void)connection: (XMPPConnection*)connection_
wasBoundToJID: (XMPPJID*)jid
{
of_log(@"Bound to JID: %@", [jid fullJID]);
[roster requestRoster];
}
+- (void)connection: (XMPPConnection*)connection_
+ didReceivePresence: (XMPPPresence*)presence_
+{
+ if ([presence_.from isEqual: connection.JID]) {
+ [ui client: self
+ didChangePresence: presence_];
+ OF_SETTER(presence, presence_, YES, 0);
+ }
+}
+
- (void)rosterWasReceived: (XMPPRoster*)roster
{
- [connection sendStanza: [XMPPPresence presence]];
+ XMPPPresence *pres = [XMPPPresence presence];
+ [pres addStatus: @"Hello from JubJub"];
+ [connection sendStanza: pres];
}
@end