Esempio n. 1
0
int main()
{
    char Verify[4];
    char Account[20];
    char passwd[20];
    userinfo* info = fetionInit();

    printf("Account:");
    gets(Account);
    printf("Passwd:");
    gets(passwd);
    getVerify(info,"./");
    printf("Verify:");
    gets(Verify);

    login(info, Account, passwd, Verify);

    getFriendList(info);
    getFriend(info);
    toChat(info);


    sendMsgBymobileNo(info, "10086",  "zhai gan sha!");

    return 0;
}
Esempio n. 2
0
FriendWidget* ContentDialogManager::addFriendToDialog(ContentDialog* dialog,
    std::shared_ptr<FriendChatroom> chatroom, GenericChatForm* form)
{
    auto friendWidget = dialog->addFriend(chatroom, form);
    const auto friendPk = friendWidget->getFriend()->getPublicKey();

    ContentDialog* lastDialog = getFriendDialog(friendPk);
    if (lastDialog) {
        lastDialog->removeFriend(friendPk);
    }

    contactDialogs[friendPk] = dialog;
    return friendWidget;
}
Esempio n. 3
0
void FriendWidget::mouseMoveEvent(QMouseEvent *ev)
{
    if (!(ev->buttons() & Qt::LeftButton))
        return;

    if ((dragStartPos - ev->pos()).manhattanLength() > QApplication::startDragDistance())
    {
        QMimeData* mdata = new QMimeData;
        mdata->setText(getFriend()->getToxId().toString());

        QDrag* drag = new QDrag(this);
        drag->setMimeData(mdata);
        drag->setPixmap(avatar->getPixmap());
        drag->exec(Qt::CopyAction | Qt::MoveAction);
    }
}
Esempio n. 4
0
//------------------------------------------------------------------------------
void
Cloud::collide( Entity * entity, b2ContactPoint * point )
{
    if ( getFriend() || entity->getType() != Bullet::TYPE )
    {
        return;
    }
    if ( entity->getBlack() != getBlack() || m_size == 0 )
    {
        takeDamage( DAMAGE[ m_size ] );
    }
    else if ( m_size > 0 && m_size < 4 )
    {
        addStrength( DAMAGE[ m_size + 1 ] );
    }
    entity->destroy();
}
Esempio n. 5
0
//------------------------------------------------------------------------------
void
Cloud::doUpdate( float dt )
{
    m_life += dt;
    if ( m_size == 0 )
    {
        setBlack( static_cast<Game *>( Engine::instance()->getContext() )->getBlack() );
    }
    updateDamageable( dt );
    if ( m_black )
    {
        m_sprite = Engine::rm()->GetSprite( BLACK[m_size] );
    }
    else
    {
        m_sprite = Engine::rm()->GetSprite( WHITE[m_size] );
    }
    if ( isDestroyed() )
    {
        if ( m_size > 0 )
        {
            for ( int i = 0; i < 3; ++i )
            {
                Entity* entity = Engine::em()->factory( Cloud::TYPE );
                if ( getBlack() )
                {
                    entity->setBlack( 0 );
                }
                else
                {
                    entity->setBlack( 1 );
                }
                entity->setScale( 0.1f );
                static_cast< Cloud * >( entity )->setSize( m_size - 1 );
                entity->init();
                entity->getBody()->SetXForm( m_body->GetPosition(),
                                             m_body->GetAngle() );
            }
        }
        destroy();
    }
    else if ( isHealthy() && m_size < 4 )
    {
        Entity* entity = Engine::em()->factory( Cloud::TYPE );
        if ( getBlack() )
        {
            entity->setBlack( 0 );
        }
        else
        {
            entity->setBlack( 1 );
        }
        entity->setScale( 0.1f );
        static_cast< Cloud * >( entity )->setSize( m_size + 1 );
        entity->init();
        entity->getBody()->SetXForm( m_body->GetPosition(),
                                     m_body->GetAngle() );
        destroy(); 
    }
    if ( getFriend() )
    {
        b2Vec2 velocity( 0.0f, 0.0f );
        m_body->SetAngularVelocity( 0.0f );
        m_body->SetLinearVelocity( velocity );
    }
}