コード例 #1
0
ファイル: audio_call.c プロジェクト: h4ck3rm1k3/toxic
void cmd_cancel(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
    uint8_t *error_str;

    if (argc != 0) {
        error_str = "Invalid syntax!";
        goto on_error;
    }

    if ( !ASettins.av ) {
        error_str = "Audio not supported!";
        goto on_error;
    }

    ToxAvError error = toxav_cancel(ASettins.av, self->call_idx, self->num,
                                    "Only those who appreciate small things know the beauty that is life");

    if ( error != ErrorNone ) {
        if ( error == ErrorNoCall ) error_str = "No call!";
        else if ( error == ErrorInvalidState ) error_str = "Cannot cancel in invalid state!";
        else error_str = "Internal error!";

        goto on_error;
    }

    /* Callback will print status... */

    return;
on_error:
    print_err (self, error_str);
}
コード例 #2
0
ファイル: av.cpp プロジェクト: Nokius/cyanide
void Cyanide::av_call_cancel(int fid)
{
    qDebug() << "cancelling call";
    Friend *f = &friends[fid];
    Q_ASSERT(f->callstate == -1);
    toxav_cancel(toxav, f->call_index, fid, "Call cancelled by friend");
    emit signal_friend_callstate(fid, (f->callstate = 0));
}
コード例 #3
0
ファイル: audio_call.c プロジェクト: zetok/toxic
void stop_current_call(ToxWindow* self)
{    
    ToxAvCallState callstate;
    if ( ASettins.av != NULL && self->call_idx != -1 && 
       ( callstate = toxav_get_call_state(ASettins.av, self->call_idx) ) != av_CallNonExistant) {
        switch (callstate)
        {
        case av_CallActive:
        case av_CallHold:
            toxav_hangup(ASettins.av, self->call_idx);
            break;
        case av_CallInviting:
            toxav_cancel(ASettins.av, self->call_idx, 0, "Not interested anymore");
            break;
        case av_CallStarting:
            toxav_reject(ASettins.av, self->call_idx, "Not interested");
            break;
        default:
            break;
        }
    }
}
コード例 #4
0
ファイル: audio_call.c プロジェクト: zetok/toxic
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
    const char *error_str;

    if (argc != 0) {
        error_str = "Unknown arguments.";
        goto on_error;
    }

    if ( !ASettins.av ) {
        error_str = "Audio not supported!";
        goto on_error;
    }

    ToxAvError error;

    if (toxav_get_call_state(ASettins.av, self->call_idx) == av_CallInviting) {
        error = toxav_cancel(ASettins.av, self->call_idx, self->num,
                                        "Only those who appreciate small things know the beauty that is life");
#ifdef SOUND_NOTIFY
        stop_sound(self->ringing_sound);
#endif
        line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call canceled!");
    } else {
        error = toxav_hangup(ASettins.av, self->call_idx);
    }

    if ( error != ErrorNone ) {
        if ( error == ErrorInvalidState ) error_str = "Cannot hangup in invalid state!";
        else if ( error == ErrorNoCall ) error_str = "No call!";
        else error_str = "Internal error!";

        goto on_error;
    }

    return;
on_error:
    print_err (self, error_str);
}
コード例 #5
0
ファイル: coreav.cpp プロジェクト: cmcsun/qTox
void Core::cancelCall(int32_t callId, uint32_t friendId)
{
    qDebug() << QString("Core: Cancelling call with %1").arg(friendId);
    calls[callId].active = false;
    toxav_cancel(toxav, callId, friendId, nullptr);
}