Esempio n. 1
0
void FacebookAccount::slotTypingEventAvailable( const QString &from, const QString &to )
{
    Q_UNUSED(to);
    if ( ! contact(from) )
        return;
    
    Kopete::ChatSession *mm = contact(from)->manager(Kopete::Contact::CanCreate);
    // Tell the message manager that the buddy is typing
    mm->receivedTypingMsg(contact(from), true);
}
Esempio n. 2
0
void  FacebookAccount::slotMessageAvailable( const Facebook::ChatMessage &message )
{
    QFont msgFont;
    QDateTime msgDT;
    Kopete::ContactPtrList justMe;

    // outgoing or incoming
    if ( message.from() == m_service->userId() )
    {
        kDebug(FBDBG) << "got own sent message back (ack)";        
        // outgoing, we get our own messages back
        // we should use this for confirmation or something
        // like that
    }
    else if ( message.to() == m_service->userId() )
    {
        // incoming
        if( !contact( message.from() ) )
        {
            // this would be rare... receiving a message from unknown buddy
            kDebug(FBDBG) << "Adding contact " << message.from();
            addContact( message.from(), message.from(),  0L, Kopete::Account::Temporary );
        }
        if (message.time().toTime_t() == 0)
            msgDT = QDateTime( QDate::currentDate(), QTime::currentTime(), Qt::LocalTime );
        else
            msgDT = message.time();

        Kopete::ChatSession *mm = contact(message.from())->manager(Kopete::Contact::CanCreate);

        // Tell the message manager that the buddy is done typing
        mm->receivedTypingMsg(contact(message.from()), false);

        justMe.append(myself());

        Kopete::Message kmsg(contact(message.from()), justMe);
        kmsg.setTimestamp( msgDT );
        kmsg.setPlainBody( message.text() );
        kmsg.setDirection( Kopete::Message::Inbound );

        mm->appendMessage(kmsg);
    }
}