#import "JubGtkUI.h"
@interface AppDelegate: OFObject
- <OFApplicationDelegate, XMPPConnectionDelegate>
+ <OFApplicationDelegate, XMPPConnectionDelegate, XMPPRosterDelegate>
{
XMPPConnection *connection;
XMPPRoster *roster;
- (void)applicationDidFinishLaunching
{
ui = [[JubGtkUI alloc] init];
+ id<XMPPRosterDelegate, XMPPConnectionDelegate> rosterDelegate =
+ [ui rosterDelegate];
connection = [[XMPPConnection alloc] init];
[connection addDelegate: self];
[connection connect];
[connection handleConnection];
+ [connection addDelegate: rosterDelegate];
+
roster = [[XMPPRoster alloc] initWithConnection: connection];
- [roster addDelegate: [ui rosterDelegate]];
+ [roster addDelegate: rosterDelegate];
+ [roster addDelegate: self];
[ui startUIThread];
}
[roster requestRoster];
}
+- (void)rosterWasReceived: (XMPPRoster*)roster
+{
+ [connection sendStanza: [XMPPPresence presence]];
+}
+
- (void)connection: (XMPPConnection*)conn
didReceiveElement: (OFXMLElement*)element
{