]> cgit.babelmonkeys.de Git - jubjub.git/blobdiff - src/core/JubChatClient.m
Move adding messages to the ChatUI to JubChatClient
[jubjub.git] / src / core / JubChatClient.m
index 9acdf3935addec8aed8df165bcb5630eb0208893..77a4791541806bff07e079e3ecf01b7f4f26a1ae 100644 (file)
@@ -27,6 +27,7 @@
                _contactManager = [[XMPPContactManager alloc]
                    initWithConnection: _connection
                                roster: _roster];
+               [_contactManager addDelegate: self];
 
                _streamManagement = [[XMPPStreamManagement alloc]
                    initWithConnection: _connection];
 
 - (void)dealloc
 {
+       [_roster removeDelegate: self];
+       [_contactManager removeDelegate: self];
+       [_connection removeDelegate: self];
+
        [_roster release];
        [_contactManager release];
        [_streamManagement release];
        }
 }
 
+-  (void)contact: (XMPPContact*)contact
+  didSendMessage: (XMPPMessage*)message
+{
+       if (message.body == nil || ![message.type isEqual: @"chat"])
+               return;
+
+       id<JubChatUI> chat = [self chatForContact: contact];
+       [chat addMessage: message.body
+                 sender: [message.from bareJID]];
+}
+
 - (void)rosterWasReceived: (XMPPRoster*)roster
 {
        XMPPPresence *pres = [XMPPPresence presence];