コード例 #1
0
int
api_cons_show_themed(const char *const group, const char *const key, const char *const def, const char *const message)
{
    if (message == NULL) {
        log_warning("%s", "prof_cons_show_themed failed, message is NULL");
        return 0;
    }

    char *parsed = str_replace(message, "\r\n", "\n");
    theme_item_t themeitem = plugin_themes_get(group, key, def);
    ProfWin *console = wins_get_console();
    win_println(console, themeitem, '-', "%s", parsed);

    free(parsed);

    return 1;
}
コード例 #2
0
ファイル: api.c プロジェクト: anossov/profanity
int
api_room_show_themed(const char *const roomjid, const char *const group, const char *const key, const char *const def,
    const char *const ch, const char *const message)
{
    if (message == NULL) {
        log_warning("%s", "api_room_show_themed failed, message is NULL");
        return 0;
    }

    if (roomjid == NULL) {
        log_warning("%s", "api_room_show_themed failed, roomjid is NULL");
        return 0;
    }

    char show_ch = '-';
    if (ch) {
        if (strlen(ch) != 1) {
            log_warning("%s", "api_room_show_themed failed, ch must be a string of length 1");
            return 0;
        } else {
            show_ch = ch[0];
        }
    }

    ProfMucWin *mucwin = wins_get_muc(roomjid);
    if (mucwin == NULL) {
        log_warning("%s", "api_room_show_themed failed, could not find room window for %s", roomjid);
        return 0;
    }

    char *parsed = str_replace(message, "\r\n", "\n");
    theme_item_t themeitem = plugin_themes_get(group, key, def);

    win_println((ProfWin*)mucwin, themeitem, show_ch, "%s", parsed);
    free(parsed);

    return 1;
}
コード例 #3
0
int
api_win_show_themed(const char *tag, const char *const group, const char *const key, const char *const def, const char *line)
{
    if (tag == NULL) {
        log_warning("%s", "prof_win_show_themed failed, tag is NULL");
        return 0;
    }
    if (line == NULL) {
        log_warning("%s", "prof_win_show_themed failed, line is NULL");
        return 0;
    }

    ProfPluginWin *pluginwin = wins_get_plugin(tag);
    if (pluginwin == NULL) {
        log_warning("prof_win_show_themed failed, no window with tag: %s", tag);
        return 0;
    }

    theme_item_t themeitem = plugin_themes_get(group, key, def);
    ProfWin *window = (ProfWin*)pluginwin;
    win_println(window, themeitem, '!', "%s", line);

    return 1;
}