Пример #1
0
Kopete::ChatSession* WPContact::manager( Kopete::Contact::CanCreateFlags /*canCreate*/ )	// TODO: use the parameter as canCreate
{
	if (m_manager == 0) {
		// Set up the message managers
		QPtrList<Kopete::Contact> singleContact;
		singleContact.append(this);

		m_manager = Kopete::ChatSessionManager::self()->create( account()->myself(), singleContact, protocol() );

		connect(m_manager, SIGNAL(messageSent(Kopete::Message &, Kopete::ChatSession *)), this, SLOT(slotSendMessage(Kopete::Message &)));
		connect(m_manager, SIGNAL(messageSent(Kopete::Message &, Kopete::ChatSession *)), m_manager, SLOT(appendMessage(Kopete::Message &)));
		connect(m_manager, SIGNAL(destroyed()), this, SLOT(slotChatSessionDestroyed()));
	}
Пример #2
0
Kopete::ChatSession* TestbedContact::manager( CanCreateFlags )
{
    kdDebug( 14210 ) << k_funcinfo << endl;
    if ( m_msgManager )
    {
        return m_msgManager;
    }
    else
    {
        QPtrList<Kopete::Contact> contacts;
        contacts.append(this);
        m_msgManager = Kopete::ChatSessionManager::self()->create(account()->myself(), contacts, protocol());
        connect(m_msgManager, SIGNAL(messageSent(Kopete::Message&, Kopete::ChatSession*)),
                this, SLOT( sendMessage( Kopete::Message& ) ) );
        connect(m_msgManager, SIGNAL(destroyed()), this, SLOT(slotChatSessionDestroyed()));
        return m_msgManager;
    }
}
Пример #3
0
Kopete::ChatSession* FacebookContact::manager( CanCreateFlags canCreateFlags )
{
    kDebug( FBDBG ) ;

    Kopete::ContactPtrList chatmembers;
    chatmembers.append (this);

    Kopete::ChatSession * m_msgManager = Kopete::ChatSessionManager::self()->findChatSession (account()->myself(), chatmembers, protocol());

    FacebookChatSession *manager = qobject_cast <FacebookChatSession *>(m_msgManager);
    if (!manager && canCreateFlags == Kopete::Contact::CanCreate)
    {        
        //Kopete::ChatSession::Form form = ( m_type == Group ?
	//				   Kopete::ChatSession::Chatroom : Kopete::ChatSession::Small );
        //m_msgManager = Kopete::ChatSessionManager::self()->create(account()->myself(), contacts, protocol(), form );
        m_msgManager = new FacebookChatSession(protocol(), account()->myself(),
                                                  chatmembers, static_cast<FacebookAccount *>( account() )->service() );
        connect(m_msgManager, SIGNAL(destroyed()), this, SLOT(slotChatSessionDestroyed()));
    }
    return m_msgManager;
}
Пример #4
0
Kopete::ChatSession* MrimContact::manager( CanCreateFlags canCreateFlags )
{

    if ( d->msgManager )
    {
        return d->msgManager;
    }
    else if ( canCreateFlags == CanCreate )
    {
        QList<Kopete::Contact*> contacts;

        contacts.append(this);

        Kopete::ChatSession::Form form = Kopete::ChatSession::Small;
        if ( isChatContact() ) {

            form = Kopete::ChatSession::Chatroom;

            loadChatMembersList();

            d->msgManager = new MrimChatSession(account()->myself(), this, contacts, dynamic_cast<MrimProtocol*>(protocol()), form);

        } else {
            d->msgManager = Kopete::ChatSessionManager::self()->create(account()->myself(), contacts, protocol(), form );
        }

        connect(d->msgManager, SIGNAL(messageSent(Kopete::Message&,Kopete::ChatSession*)),
                this, SLOT(sendMessage(Kopete::Message&)) );

        connect(d->msgManager, SIGNAL(myselfTyping(bool)),
                this, SLOT(slotMyselfTyping(bool)) );

        connect(d->msgManager, SIGNAL(destroyed()), this, SLOT(slotChatSessionDestroyed()));

        return d->msgManager;
    }