Esempio n. 1
0
void Telegram::timerEvent(QTimerEvent *e)
{
    if( e->timerId() == p->update_dialog_timer_id )
    {
        updateDialogList();
        if( p->update_dialog_again )
        {
            p->update_dialog_again = false;
            return;
        }

        p->update_dialog_again = false;
        killTimer(p->update_dialog_timer_id);
        p->update_dialog_timer_id = 0;
    }
    else
    if( e->timerId() == p->update_contact_timer_id )
    {
        updateContactList();
        if( p->update_contact_again )
        {
            p->update_contact_again = false;
            return;
        }

        p->update_contact_again = false;
        killTimer(p->update_contact_timer_id);
        p->update_contact_timer_id = 0;
    }
    else
        QObject::timerEvent(e);
}
Esempio n. 2
0
void Telegram::_incomingNewMsg(qint64 msg_id)
{
    const MessageClass & msg = message(msg_id);
    if( msg.service != 0 && msg.action == Enums::MessageActionChatCreate && msg.from_id == me() )
    {
        const QList<int> & list = p->chat_group_buffer.value(msg.actionNewTitle);
        foreach( int id, list )
            chatAddUser( msg.to_id, id );

        p->chat_group_buffer.remove(msg.actionNewTitle);
        updateDialogList();
    }

    emit incomingNewMsg(msg_id);
}
Esempio n. 3
0
void Telegram::timerEvent(QTimerEvent *e)
{
    if( e->timerId() == p->update_dialog_timer_id )
    {
        updateDialogList();
        if( p->update_dialog_again )
        {
            p->update_dialog_again = false;
            return;
        }

        p->update_dialog_again = false;
        killTimer(p->update_dialog_timer_id);
        p->update_dialog_timer_id = 0;
    }
    else
    if( e->timerId() == p->update_contact_timer_id )
    {
        updateContactList();
        if( p->update_contact_again )
        {
            p->update_contact_again = false;
            return;
        }

        p->update_contact_again = false;
        killTimer(p->update_contact_timer_id);
        p->update_contact_timer_id = 0;
    }
    else
    if( e->timerId() == p->msg_send_timer )
    {
        p->msg_send_queue.takeFirst();
        if( p->msg_send_queue.isEmpty() )
        {
            killTimer(p->msg_send_timer);
            p->msg_send_timer = 0;
            return;
        }

        const MessageQueueItem & item = p->msg_send_queue.first();
        p->tg_thread->sendMessage(item.first,item.second);
    }
    else
        QObject::timerEvent(e);
}