X-Git-Url: http://cgit.babelmonkeys.de/?p=jubjub.git;a=blobdiff_plain;f=src%2Fcore%2FJubChatClient.m;h=d539d9025c615152e38e1cc832cfe6a3e4f7623d;hp=a31bdb598efcaee9b881955bd58cb3b5d6961a93;hb=e7980c8d1a40175b56fad21082291152e214825d;hpb=0daa7a1cf98c6281dd7ba09baf0bf36cd1e154f7 diff --git a/src/core/JubChatClient.m b/src/core/JubChatClient.m index a31bdb5..d539d90 100644 --- a/src/core/JubChatClient.m +++ b/src/core/JubChatClient.m @@ -3,6 +3,7 @@ @implementation JubChatClient @synthesize connection; @synthesize roster; +@synthesize presence; @synthesize ui; - initWithConfig: (JubConfig*)config @@ -38,11 +39,12 @@ [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]); @@ -50,8 +52,20 @@ [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