Пример #1
0
callable_obj_t *
sflphone_new_call(SFLPhoneClient *client)
{
    // Disable screensaver if the list is empty call
    guint nbcall = calllist_get_size(current_calls_tab);
    if(nbcall == 0)
        dbus_screensaver_inhibit();

    callable_obj_t *selected_call = calllist_empty(current_calls_tab) ? NULL :
        calltab_get_selected_call(current_calls_tab);

    if (selected_call != NULL && selected_call->_callID) {
        gchar *confID = dbus_get_conference_id(selected_call->_callID);
        if (g_strcmp0(confID, "") != 0)
            sflphone_on_hold();
        g_free(confID);
    }

    // Play a tone when creating a new call
    if (calllist_empty(current_calls_tab))
        dbus_start_tone(TRUE , (current_account_has_new_message()  > 0) ? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ;

    callable_obj_t *c = create_new_call(CALL, CALL_STATE_DIALING, "", "", "", "");

    c->_history_state = g_strdup(OUTGOING_STRING);

    calllist_add_call(current_calls_tab, c);
    calltree_add_call(current_calls_tab, c, NULL);
    update_actions(client);

    return c;
}
Пример #2
0
void
sflphone_hang_up(SFLPhoneClient *client)
{
    callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab);
    conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree_tab);

    if (selectedConf) {
        disable_messaging_tab(selectedConf->_confID);
        dbus_hang_up_conference(selectedConf);
    } else if (selectedCall) {
        switch (selectedCall->_state) {
            case CALL_STATE_DIALING:
                dbus_hang_up(selectedCall);
                break;
            case CALL_STATE_RINGING:
                dbus_hang_up(selectedCall);
                call_remove_all_errors(selectedCall);
                selectedCall->_state = CALL_STATE_DIALING;
                //selectedCall->_stop = 0;
                break;
            case CALL_STATE_CURRENT:
            case CALL_STATE_HOLD:
            case CALL_STATE_BUSY:
                dbus_hang_up(selectedCall);
                call_remove_all_errors(selectedCall);
                selectedCall->_state = CALL_STATE_DIALING;
                time(&selectedCall->_time_stop);

                break;
            case CALL_STATE_FAILURE:
                dbus_hang_up(selectedCall);
                call_remove_all_errors(selectedCall);
                selectedCall->_state = CALL_STATE_DIALING;
                break;
            case CALL_STATE_INCOMING:
                dbus_refuse(selectedCall);
                call_remove_all_errors(selectedCall);
                selectedCall->_state = CALL_STATE_DIALING;
                g_debug("from sflphone_hang_up : ");
                break;
            case CALL_STATE_TRANSFER:
                dbus_hang_up(selectedCall);
                call_remove_all_errors(selectedCall);
                time(&selectedCall->_time_stop);
                break;
            default:
                g_warning("Should not happen in sflphone_hang_up()!");
                break;
        }
    }

    calltree_update_call(history_tab, selectedCall, client);

    statusbar_update_clock("");

    // Allow screen saver to start
    if (calllist_get_size(current_calls_tab) == 1)
        dbus_screensaver_uninhibit();
}
Пример #3
0
void
sflphone_quit(gboolean force_quit, SFLPhoneClient *client)
{
    if (force_quit || calllist_get_size(current_calls_tab) == 0 || main_window_ask_quit(client)) {
        dbus_unregister(getpid());
        dbus_clean();
        account_list_free();
        calllist_clean(current_calls_tab);
        calllist_clean(contacts_tab);
        calllist_clean(history_tab);
        free_addressbook();

#if GLIB_CHECK_VERSION(2,32,0)
        g_application_quit(G_APPLICATION(client));
#else
        g_application_release(G_APPLICATION(client));
#endif
    }
}
Пример #4
0
void
sflphone_quit(gboolean force_quit, SFLPhoneClient *client)
{
    if (force_quit || calllist_get_size(current_calls_tab) == 0 || main_window_ask_quit(client)) {
        dbus_unregister(getpid());
        dbus_clean();
        account_list_free();
        calllist_clean(current_calls_tab);
        calllist_clean(contacts_tab);
        calllist_clean(history_tab);
        free_addressbook();

        // make sure all open dialogs get a response signal so that they can close
        GList* top_level_windows = gtk_window_list_toplevels();
        g_list_foreach(top_level_windows, (GFunc)send_response_to_dialogs, NULL);

#if GLIB_CHECK_VERSION(2,32,0)
        g_application_quit(G_APPLICATION(client));
#else
        g_application_release(G_APPLICATION(client));
#endif
    }
}
Пример #5
0
void
sflphone_pick_up(SFLPhoneClient *client)
{
    callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree_tab);

    // Disable screensaver if the list is empty call
    if (calllist_get_size(current_calls_tab) == 0)
        dbus_screensaver_inhibit();

    if (!selectedCall) {
        sflphone_new_call(client);
        return;
    }

    switch (selectedCall->_state) {
        case CALL_STATE_DIALING:
            sflphone_place_call(selectedCall, client);
            break;
        case CALL_STATE_INCOMING:
            selectedCall->_history_state = g_strdup(INCOMING_STRING);
            calltree_update_call(history_tab, selectedCall, client);

            dbus_accept(selectedCall);
            break;
        case CALL_STATE_TRANSFER:
            dbus_transfer(selectedCall);
            break;
        case CALL_STATE_CURRENT:
        case CALL_STATE_HOLD:
        case CALL_STATE_RINGING:
            sflphone_new_call(client);
            break;
        default:
            g_warning("Should not happen in sflphone_pick_up()!");
            break;
    }
}