Ejemplo n.º 1
0
void
sflphone_notify_voice_mail(const gchar* accountID , guint count, SFLPhoneClient *client)
{
    // We want to notify only the current account; ie the first in the list
    gchar *id = g_strdup(accountID);
    const gchar * const current_id = account_list_get_current_id();

    g_debug("sflphone_notify_voice_mail begin");

    if (g_ascii_strcasecmp(id, current_id) != 0 ||
        account_list_get_size() == 0)
        return;

    // Set the number of voice messages for the current account
    current_account_set_message_number(count);
    account_t *current = account_list_get_current();

    // Update the voicemail tool button
    update_voicemail_status();

    if (current)
        notify_voice_mails(count, current, client);

    g_debug("sflphone_notify_voice_mail end");
}
Ejemplo n.º 2
0
void
status_bar_display_account()
{
    statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);

    account_t *acc = account_list_get_current();
    status_tray_icon_online(acc != NULL);

    static const char * const account_types[] = {
        N_("(SIP)"),
        N_("(IAX)")
    };

    gchar* msg;
    if (acc) {
        const guint type_idx = account_is_IAX(acc);
        msg = g_markup_printf_escaped(_("%s %s"),
                                      (gchar*) account_lookup(acc, CONFIG_ACCOUNT_ALIAS),
                                      _(account_types[type_idx]));
    } else {
        msg = g_markup_printf_escaped(_("No registered accounts"));
    }

    statusbar_push_message(msg, NULL, __MSG_ACCOUNT_DEFAULT);
    g_free(msg);
}
Ejemplo n.º 3
0
int
sflphone_place_call(callable_obj_t * c, SFLPhoneClient *client)
{
    account_t * account = NULL;

    if (c == NULL) {
        g_warning("Callable object is NULL while making new call");
        return -1;
    }

    g_debug("Placing call from %s to %s using account %s", c->_display_name, c->_peer_number, c->_accountID);

    if (c->_state != CALL_STATE_DIALING) {
        g_warning("Call not in state dialing, cannot place call");
        return -1;
    }

    if (!c->_peer_number || strlen(c->_peer_number) == 0) {
        g_warning("No peer number set for this call");
        return -1;
    }

    // Get the account for this call
    if (strlen(c->_accountID) != 0) {
        g_debug("Account %s already set for this call", c->_accountID);
        account = account_list_get_by_id(c->_accountID);
    } else {
        g_debug("No account set for this call, use first of the list");
        account = account_list_get_current();
    }

    // Make sure the previously found account is registered, take first one registered elsewhere
    if (account) {
        const gchar *status = account_lookup(account, CONFIG_ACCOUNT_REGISTRATION_STATUS);
        if (!utf8_case_equal(status, "REGISTERED")) {
            // Place the call with the first registered account
            account = account_list_get_by_state(ACCOUNT_STATE_REGISTERED);
        }
    }

    // If there is no account specified or found, fallback on IP2IP call
    if(account == NULL) {
        g_debug("Could not find an account for this call, making ip to ip call");
        account = account_list_get_by_id("IP2IP");
        if (account == NULL) {
            g_warning("Actions: Could not determine any account for this call");
            return -1;
        }
    }

    // free memory for previous account id and use the new one in case it changed
    g_free(c->_accountID);
    c->_accountID = g_strdup(account->accountID);
    dbus_place_call(c);
    notify_current_account(account, client);

    c->_history_state = g_strdup(OUTGOING_STRING);

    return 0;
}
Ejemplo n.º 4
0
guint current_account_get_message_number(void)
{
    account_t *current = account_list_get_current();
    if (current)
        return current->_messages_number;
    else
        return 0;
}
Ejemplo n.º 5
0
const gchar* account_list_get_current_id(void)
{
    account_t *current = account_list_get_current();

    if (current)
        return current->accountID;
    else
        return NULL;
}
Ejemplo n.º 6
0
gboolean current_account_has_mailbox(void)
{
    // Check if the current account has a voicemail number configured
    account_t *current = account_list_get_current();

    if (current) {
        gchar * account_mailbox = account_lookup(current, ACCOUNT_MAILBOX);

        if (account_mailbox && !utf8_case_equal(account_mailbox, ""))
            return TRUE;
    }

    return FALSE;
}
Ejemplo n.º 7
0
gboolean current_account_has_new_message(void)
{
    account_t *current = account_list_get_current();
    return current && current->_messages_number > 0;
}
Ejemplo n.º 8
0
void current_account_set_message_number(guint nb)
{
    account_t *current = account_list_get_current();
    if (current)
        current->_messages_number = nb;
}