コード例 #1
0
ファイル: core.c プロジェクト: jesseadams/profanity
void
ui_status_room(const char * const contact)
{
    PContact pcontact = muc_get_participant(ui_current_recipient(), contact);
    ProfWin *current = wins_get_current();

    if (pcontact != NULL) {
        win_show_contact(current, pcontact);
    } else {
        ui_current_print_line("No such participant \"%s\" in room.", contact);
    }
}
コード例 #2
0
ファイル: core.c プロジェクト: jesseadams/profanity
void
ui_status(void)
{
    char *recipient = ui_current_recipient();
    PContact pcontact = roster_get_contact(recipient);
    ProfWin *current = wins_get_current();

    if (pcontact != NULL) {
        win_show_contact(current, pcontact);
    } else {
        ui_current_print_line("Error getting contact info.");
    }
}
コード例 #3
0
ファイル: core.c プロジェクト: jesseadams/profanity
void
ui_status_private(void)
{
    Jid *jid = jid_create(ui_current_recipient());
    PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
    ProfWin *current = wins_get_current();

    if (pcontact != NULL) {
        win_show_contact(current, pcontact);
    } else {
        ui_current_print_line("Error getting contact info.");
    }

    jid_destroy(jid);
}
コード例 #4
0
ファイル: profanity.c プロジェクト: Liangwz/profanity
void
prof_handle_activity(void)
{
    win_type_t win_type = ui_current_win_type();
    jabber_conn_status_t status = jabber_get_connection_status();

    if ((status == JABBER_CONNECTED) && (win_type == WIN_CHAT)) {
        char *recipient = ui_current_recipient();
        if (chat_session_get_recipient_supports(recipient)) {
            chat_session_set_composing(recipient);
            if (!chat_session_get_sent(recipient) ||
                    chat_session_is_paused(recipient)) {
                message_send_composing(recipient);
            }
        }
    }
}
コード例 #5
0
ファイル: muc.c プロジェクト: NYAMNYAM3/profanity
void
muc_autocomplete(char *input, int *size)
{
    char *recipient = ui_current_recipient();
    Autocomplete nick_ac = muc_get_roster_ac(recipient);
    if (nick_ac != NULL) {
        input[*size] = '\0';
        gchar *last_space = g_strrstr(input, " ");
        char *result = NULL;
        if (last_space == NULL) {
            result = autocomplete_complete(nick_ac, input);
        } else {
            int len = (last_space - input);
            char *start_str = strndup(input, len);
            result = autocomplete_param_with_ac(input, size, start_str, nick_ac);
            free(start_str);
        }
        if (result != NULL) {
            ui_replace_input(input, result, size);
            g_free(result);
            return;
        }
    }
}
コード例 #6
0
ファイル: muc.c プロジェクト: Liangwz/profanity
void
muc_autocomplete(char *input, int *size)
{
    char *recipient = ui_current_recipient();
    ChatRoom *chat_room = g_hash_table_lookup(rooms, recipient);

    if (chat_room && chat_room->nick_ac) {
        input[*size] = '\0';
        char *search_str = NULL;

        gchar *last_space = g_strrstr(input, " ");
        if (!last_space) {
            search_str = input;
            if (!chat_room->autocomplete_prefix) {
                chat_room->autocomplete_prefix = strdup("");
            }
        } else {
            search_str = last_space+1;
            if (!chat_room->autocomplete_prefix) {
                chat_room->autocomplete_prefix = g_strndup(input, search_str - input);
            }
        }

        char *result = autocomplete_complete(chat_room->nick_ac, search_str, FALSE);
        if (result) {
            GString *replace_with = g_string_new(chat_room->autocomplete_prefix);
            g_string_append(replace_with, result);
            if (!last_space || (*(last_space+1) == '\0')) {
                g_string_append(replace_with, ": ");
            }
            ui_replace_input(input, replace_with->str, size);
            g_string_free(replace_with, TRUE);
            g_free(result);
        }
    }
}