-// FIXME: This needs to move somewhere else
-- (JubGtkChatUI*)chatForJID: (XMPPJID*)jid
-{
- OFAutoreleasePool *pool = [OFAutoreleasePool new];
- JubGtkChatUI *chat =
- [chatMap objectForKey: [jid bareJID]];
- if (chat == nil) {
- OFString * title = [@"Chat with " stringByAppendingString:
- [jid bareJID]];
-
- chat = [[[JubGtkChatUI alloc]
- initWithTitle: title
- closeBlock: ^{
- [chatMap removeObjectForKey: [jid bareJID]];
- }
- sendBlock: ^(OFString *text) {
- XMPPMessage *msg =
- [XMPPMessage messageWithType: @"chat"];
- msg.to = jid;
- msg.body = text;
- [client.connection sendStanza: msg];
- }
- ] autorelease];
-
- [chatMap setObject: chat
- forKey: [jid bareJID]];
- }
-
- [pool release];
-
- return chat;
-}
-