示例#1
0
void
sv_ev_login_account_success(char *account_name)
{
    ProfAccount *account = accounts_get_account(account_name);

#ifdef HAVE_LIBOTR
    otr_on_connect(account);
#endif

    ui_handle_login_account_success(account);

    // attempt to rejoin rooms with passwords
    GList *curr = muc_rooms();
    while (curr) {
        char *password = muc_password(curr->data);
        if (password) {
            char *nick = muc_nick(curr->data);
            presence_join_room(curr->data, nick, password);
        }
        curr = g_list_next(curr);
    }
    g_list_free(curr);

    log_info("%s logged in successfully", account->jid);
    account_free(account);
}
示例#2
0
static void
_send_room_presence(xmpp_stanza_t *presence)
{
    GList *rooms = muc_rooms();
    GList *curr = rooms;
    while (curr) {
        const char *room = curr->data;
        const char *nick = muc_nick(room);

        if (nick) {
            char *full_room_jid = create_fulljid(room, nick);
            xmpp_stanza_set_to(presence, full_room_jid);
            log_debug("Sending presence to room: %s", full_room_jid);
            free(full_room_jid);

            _send_presence_stanza(presence);
        }

        curr = g_list_next(curr);
    }
    g_list_free(rooms);
}
示例#3
0
void
sv_ev_login_account_success(char *account_name, gboolean secured)
{
    ProfAccount *account = accounts_get_account(account_name);

    roster_create();

#ifdef HAVE_LIBOTR
    otr_on_connect(account);
#endif

#ifdef HAVE_LIBGPGME
    p_gpg_on_connect(account->jid);
#endif

    ui_handle_login_account_success(account, secured);

    // attempt to rejoin rooms with passwords
    GList *curr = muc_rooms();
    while (curr) {
        char *password = muc_password(curr->data);
        if (password) {
            char *nick = muc_nick(curr->data);
            presence_join_room(curr->data, nick, password);
        }
        curr = g_list_next(curr);
    }
    g_list_free(curr);

    log_info("%s logged in successfully", account->jid);

    if (account->startscript) {
        scripts_exec(account->startscript);
    }

    account_free(account);
}