]> cgit.babelmonkeys.de Git - jubjub.git/blobdiff - src/core/main.m
Filter roster model based on received presences
[jubjub.git] / src / core / main.m
index e40a02f328fe7ed2b0ea14bd1420c0ac3a082e8b..ff97a3b602b56b98e01f071e7c3040923f23e912 100644 (file)
@@ -4,7 +4,7 @@
 #import "JubGtkUI.h"
 
 @interface AppDelegate: OFObject
-    <OFApplicationDelegate, XMPPConnectionDelegate>
+    <OFApplicationDelegate, XMPPConnectionDelegate, XMPPRosterDelegate>
 {
        XMPPConnection *connection;
        XMPPRoster *roster;
@@ -29,8 +29,11 @@ OF_APPLICATION_DELEGATE(AppDelegate)
        [connection connect];
        [connection handleConnection];
 
+       [connection addDelegate: [ui rosterDelegate]];
+
        roster = [[XMPPRoster alloc] initWithConnection: connection];
        [roster addDelegate: [ui rosterDelegate]];
+       [roster addDelegate: self];
 
        [ui startUIThread];
 }
@@ -43,6 +46,11 @@ OF_APPLICATION_DELEGATE(AppDelegate)
        [roster requestRoster];
 }
 
+- (void)rosterWasReceived: (XMPPRoster*)roster
+{
+       [connection sendStanza: [XMPPPresence presence]];
+}
+
 -  (void)connection: (XMPPConnection*)conn
   didReceiveElement: (OFXMLElement*)element
 {