diff options
-rw-r--r-- | src/command/commands.c | 26 | ||||
-rw-r--r-- | src/ui/buffer.c | 3 | ||||
-rw-r--r-- | src/ui/buffer.h | 3 | ||||
-rw-r--r-- | src/ui/console.c | 192 | ||||
-rw-r--r-- | src/ui/core.c | 452 | ||||
-rw-r--r-- | src/ui/ui.h | 4 | ||||
-rw-r--r-- | src/ui/window.c | 186 | ||||
-rw-r--r-- | src/ui/window.h | 2 | ||||
-rw-r--r-- | src/window_list.c | 2 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 4 |
10 files changed, 452 insertions, 422 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index e26db08f..86be7bc1 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -779,9 +779,9 @@ _cmd_help_cmd_list(const char * const tag) cons_show(""); ProfWin *console = wins_get_console(); if (tag) { - win_vprint(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "%s commands", tag); + win_vprint(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "%s commands", tag); } else { - win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "All commands"); + win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "All commands"); } GList *ordered_commands = NULL; @@ -1857,7 +1857,7 @@ cmd_status(ProfWin *window, const char * const command, gchar **args) if (occupant) { win_show_occupant(window, occupant); } else { - win_vprint(window, '-', NULL, 0, 0, "", "No such participant \"%s\" in room.", usr); + win_vprint(window, '-', 0, NULL, 0, 0, "", "No such participant \"%s\" in room.", usr); } } else { ui_current_print_line("You must specify a nickname."); @@ -2610,7 +2610,7 @@ cmd_kick(ProfWin *window, const char * const command, gchar **args) char *reason = args[1]; iq_room_kick_occupant(mucwin->roomjid, nick, reason); } else { - win_vprint((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Occupant does not exist: %s", nick); + win_vprint((ProfWin*) mucwin, '!', 0, NULL, 0, 0, "", "Occupant does not exist: %s", nick); } } else { cons_bad_cmd_usage(command); @@ -2668,10 +2668,10 @@ cmd_subject(ProfWin *window, const char * const command, gchar **args) if (args[0] == NULL) { char *subject = muc_subject(mucwin->roomjid); if (subject) { - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: "); - win_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", subject); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: "); + win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject); } else { - win_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room has no subject"); + win_print(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room has no subject"); } return TRUE; } @@ -2736,7 +2736,7 @@ cmd_affiliation(ProfWin *window, const char * const command, gchar **args) iq_room_affiliation_list(mucwin->roomjid, "member"); iq_room_affiliation_list(mucwin->roomjid, "outcast"); } else if (g_strcmp0(affiliation, "none") == 0) { - win_print((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Cannot list users with no affiliation."); + win_print((ProfWin*) mucwin, '!', 0, NULL, 0, 0, "", "Cannot list users with no affiliation."); } else { iq_room_affiliation_list(mucwin->roomjid, affiliation); } @@ -2804,7 +2804,7 @@ cmd_role(ProfWin *window, const char * const command, gchar **args) iq_room_role_list(mucwin->roomjid, "participant"); iq_room_role_list(mucwin->roomjid, "visitor"); } else if (g_strcmp0(role, "none") == 0) { - win_print((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Cannot list users with no role."); + win_print((ProfWin*) mucwin, '!', 0, NULL, 0, 0, "", "Cannot list users with no role."); } else { iq_room_role_list(mucwin->roomjid, role); } @@ -2866,12 +2866,12 @@ cmd_room(ProfWin *window, const char * const command, gchar **args) if (g_strcmp0(args[0], "accept") == 0) { gboolean requires_config = muc_requires_config(mucwin->roomjid); if (!requires_config) { - win_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Current room does not require configuration."); + win_print(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Current room does not require configuration."); return TRUE; } else { iq_confirm_instant_room(mucwin->roomjid); muc_set_requires_config(mucwin->roomjid, FALSE); - win_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room unlocked."); + win_print(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room unlocked."); return TRUE; } } @@ -3247,13 +3247,13 @@ cmd_tiny(ProfWin *window, const char * const command, gchar **args) } if (!tinyurl_valid(url)) { - win_vprint(window, '-', NULL, 0, THEME_ERROR, "", "/tiny, badly formed URL: %s", url); + win_vprint(window, '-', 0, NULL, 0, THEME_ERROR, "", "/tiny, badly formed URL: %s", url); return TRUE; } char *tiny = tinyurl_get(url); if (!tiny) { - win_print(window, '-', NULL, 0, THEME_ERROR, "", "Couldn't create tinyurl."); + win_print(window, '-', 0, NULL, 0, THEME_ERROR, "", "Couldn't create tinyurl."); return TRUE; } diff --git a/src/ui/buffer.c b/src/ui/buffer.c index b4771f1a..a464de4e 100644 --- a/src/ui/buffer.c +++ b/src/ui/buffer.c @@ -80,11 +80,12 @@ buffer_free(ProfBuff buffer) } void -buffer_push(ProfBuff buffer, const char show_char, GDateTime *time, +buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt) { ProfBuffEntry *e = malloc(sizeof(struct prof_buff_entry_t)); e->show_char = show_char; + e->pad_indent = pad_indent; e->flags = flags; e->theme_item = theme_item; e->time = g_date_time_ref(time); diff --git a/src/ui/buffer.h b/src/ui/buffer.h index cad7eee0..dcee0aff 100644 --- a/src/ui/buffer.h +++ b/src/ui/buffer.h @@ -47,6 +47,7 @@ typedef struct delivery_receipt_t { typedef struct prof_buff_entry_t { char show_char; + int pad_indent; GDateTime *time; int flags; theme_item_t theme_item; @@ -59,7 +60,7 @@ typedef struct prof_buff_t *ProfBuff; ProfBuff buffer_create(); void buffer_free(ProfBuff buffer); -void buffer_push(ProfBuff buffer, const char show_char, GDateTime *time, int flags, theme_item_t theme_item, +void buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt); int buffer_size(ProfBuff buffer); ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry); diff --git a/src/ui/console.c b/src/ui/console.c index a1cf9fbf..e3e6f6a3 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -67,14 +67,14 @@ void cons_show_time(void) { ProfWin *console = wins_get_console(); - win_print(console, '-', NULL, NO_EOL, 0, "", ""); + win_print(console, '-', 0, NULL, NO_EOL, 0, "", ""); } void cons_show_word(const char * const word) { ProfWin *console = wins_get_console(); - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", word); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", word); } void @@ -111,20 +111,20 @@ cons_show_help(Command *command) ProfWin *console = wins_get_console(); cons_show(""); - win_vprint(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "%s", &command->cmd[1]); - win_print(console, '-', NULL, NO_EOL, THEME_WHITE_BOLD, "", ""); + win_vprint(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "%s", &command->cmd[1]); + win_print(console, '-', 0, NULL, NO_EOL, THEME_WHITE_BOLD, "", ""); int i; for (i = 0; i < strlen(command->cmd) - 1 ; i++) { - win_print(console, '-', NULL, NO_EOL | NO_DATE, THEME_WHITE_BOLD, "", "-"); + win_print(console, '-', 0, NULL, NO_EOL | NO_DATE, THEME_WHITE_BOLD, "", "-"); } - win_print(console, '-', NULL, NO_DATE, THEME_WHITE_BOLD, "", ""); + win_print(console, '-', 0, NULL, NO_DATE, THEME_WHITE_BOLD, "", ""); cons_show(""); - win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Synopsis"); + win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Synopsis"); ui_show_lines(console, command->help.synopsis); cons_show(""); - win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Description"); + win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Description"); win_println(console, command->help.desc); int maxlen = 0; @@ -135,15 +135,15 @@ cons_show_help(Command *command) if (i > 0) { cons_show(""); - win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Arguments"); + win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Arguments"); for (i = 0; command->help.args[i][0] != NULL; i++) { - win_vprint(console, '-', NULL, 0, 0, "", "%-*s: %s", maxlen + 1, command->help.args[i][0], command->help.args[i][1]); + win_vprint(console, '-', maxlen + 3, NULL, 0, 0, "", "%-*s: %s", maxlen + 1, command->help.args[i][0], command->help.args[i][1]); } } if (g_strv_length((gchar**)command->help.examples) > 0) { cons_show(""); - win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Examples"); + win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Examples"); ui_show_lines(console, command->help.examples); } } @@ -168,7 +168,7 @@ cons_show_error(const char * const msg, ...) va_start(arg, msg); GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, msg, arg); - win_print(console, '-', NULL, 0, THEME_ERROR, "", fmt_msg->str); + win_print(console, '-', 0, NULL, 0, THEME_ERROR, "", fmt_msg->str); g_string_free(fmt_msg, TRUE); va_end(arg); @@ -191,7 +191,7 @@ cons_show_typing(const char * const barejid) display_usr = barejid; } - win_vprint(console, '-', NULL, 0, THEME_TYPING, "", "!! %s is typing a message...", display_usr); + win_vprint(console, '-', 0, NULL, 0, THEME_TYPING, "", "!! %s is typing a message...", display_usr); cons_alert(); } @@ -204,7 +204,7 @@ cons_show_incoming_message(const char * const short_from, const int win_index) if (ui_index == 10) { ui_index = 0; } - win_vprint(console, '-', NULL, 0, THEME_INCOMING, "", "<< incoming from %s (%d)", short_from, ui_index); + win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< incoming from %s (%d)", short_from, ui_index); cons_alert(); } @@ -222,16 +222,16 @@ cons_about(void) if (strcmp(PACKAGE_STATUS, "development") == 0) { #ifdef HAVE_GIT_VERSION - win_vprint(console, '-', NULL, 0, 0, "", "Welcome to Profanity, version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); + win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); #else - win_vprint(console, '-', NULL, 0, 0, "", "Welcome to Profanity, version %sdev", PACKAGE_VERSION); + win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %sdev", PACKAGE_VERSION); #endif } else { - win_vprint(console, '-', NULL, 0, 0, "", "Welcome to Profanity, version %s", PACKAGE_VERSION); + win_vprint(console, '-', 0, NULL, 0, 0, "", "Welcome to Profanity, version %s", PACKAGE_VERSION); } } - win_vprint(console, '-', NULL, 0, 0, "", "Copyright (C) 2012 - 2015 James Booth <%s>.", PACKAGE_BUGREPORT); + win_vprint(console, '-', 0, NULL, 0, 0, "", "Copyright (C) 2012 - 2015 James Booth <%s>.", PACKAGE_BUGREPORT); win_println(console, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>"); win_println(console, ""); win_println(console, "This is free software; you are free to change and redistribute it."); @@ -260,7 +260,7 @@ cons_check_version(gboolean not_available_msg) if (relase_valid) { if (release_is_new(latest_release)) { - win_vprint(console, '-', NULL, 0, 0, "", "A new version of Profanity is available: %s", latest_release); + win_vprint(console, '-', 0, NULL, 0, 0, "", "A new version of Profanity is available: %s", latest_release); win_println(console, "Check <http://www.profanity.im> for details."); win_println(console, ""); } else { @@ -280,16 +280,16 @@ void cons_show_login_success(ProfAccount *account) { ProfWin *console = wins_get_console(); - win_vprint(console, '-', NULL, NO_EOL, 0, "", "%s logged in successfully, ", account->jid); + win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", "%s logged in successfully, ", account->jid); resource_presence_t presence = accounts_get_login_presence(account->name); const char *presence_str = string_from_resource_presence(presence); theme_item_t presence_colour = theme_main_presence_attrs(presence_str); - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", presence_str); - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " (priority %d)", + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", presence_str); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " (priority %d)", accounts_get_priority_for_presence_type(account->name, presence)); - win_print(console, '-', NULL, NO_DATE, 0, "", "."); + win_print(console, '-', 0, NULL, NO_DATE, 0, "", "."); cons_alert(); } @@ -349,43 +349,43 @@ cons_show_caps(const char * const fulljid, resource_presence_t presence) const char *resource_presence = string_from_resource_presence(presence); theme_item_t presence_colour = theme_main_presence_attrs(resource_presence); - win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", "%s", fulljid); - win_print(console, '-', NULL, NO_DATE, 0, "", ":"); + win_vprint(console, '-', 0, NULL, NO_EOL, presence_colour, "", "%s", fulljid); + win_print(console, '-', 0, NULL, NO_DATE, 0, "", ":"); // show identity if (caps->category || caps->type || caps->name) { - win_print(console, '-', NULL, NO_EOL, 0, "", "Identity: "); + win_print(console, '-', 0, NULL, NO_EOL, 0, "", "Identity: "); if (caps->name) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->name); if (caps->category || caps->type) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->type) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->type); if (caps->category) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->category) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(console); } if (caps->software) { - win_vprint(console, '-', NULL, NO_EOL, 0, "", "Software: %s", caps->software); + win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", "Software: %s", caps->software); } if (caps->software_version) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } if (caps->software || caps->software_version) { win_newline(console); } if (caps->os) { - win_vprint(console, '-', NULL, NO_EOL, 0, "", "OS: %s", caps->os); + win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", "OS: %s", caps->os); } if (caps->os_version) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } if (caps->os || caps->os_version) { win_newline(console); @@ -395,7 +395,7 @@ cons_show_caps(const char * const fulljid, resource_presence_t presence) win_println(console, "Features:"); GSList *feature = caps->features; while (feature) { - win_vprint(console, '-', NULL, 0, 0, "", " %s", feature->data); + win_vprint(console, '-', 0, NULL, 0, 0, "", " %s", feature->data); feature = g_slist_next(feature); } } @@ -416,8 +416,8 @@ cons_show_software_version(const char * const jid, const char * const presence, if (name || version || os) { cons_show(""); theme_item_t presence_colour = theme_main_presence_attrs(presence); - win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", "%s", jid); - win_print(console, '-', NULL, NO_DATE, 0, "", ":"); + win_vprint(console, '-', 0, NULL, NO_EOL, presence_colour, "", "%s", jid); + win_print(console, '-', 0, NULL, NO_DATE, 0, "", ":"); } if (name) { cons_show("Name : %s", name); @@ -481,9 +481,9 @@ cons_show_room_list(GSList *rooms, const char * const conference_node) cons_show("Chat rooms at %s:", conference_node); while (rooms) { DiscoItem *room = rooms->data; - win_vprint(console, '-', NULL, NO_EOL, 0, "", " %s", room->jid); + win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", " %s", room->jid); if (room->name) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", room->name); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", room->name); } win_newline(console); rooms = g_slist_next(rooms); @@ -515,21 +515,21 @@ cons_show_bookmarks(const GList *list) if (muc_active(item->jid)) { presence_colour = THEME_ONLINE; } - win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s", item->jid); + win_vprint(console, '-', 0, NULL, NO_EOL, presence_colour, "", " %s", item->jid); if (item->nick) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", "/%s", item->nick); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "/%s", item->nick); } if (item->autojoin) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (autojoin)"); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (autojoin)"); } if (item->password) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (private)"); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (private)"); } if (muc_active(item->jid)) { ProfWin *roomwin = (ProfWin*)wins_get_muc(item->jid); if (roomwin) { int num = wins_get_num(roomwin); - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (%d)", num); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (%d)", num); } } win_newline(console); @@ -590,11 +590,11 @@ cons_show_disco_items(GSList *items, const char * const jid) cons_show("Service discovery items for %s:", jid); while (items) { DiscoItem *item = items->data; - win_vprint(console, '-', NULL, NO_EOL, 0, "", " %s", item->jid); + win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", " %s", item->jid); if (item->name) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", item->name); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", item->name); } - win_vprint(console, '-', NULL, NO_DATE, 0, "", ""); + win_vprint(console, '-', 0, NULL, NO_DATE, 0, "", ""); items = g_slist_next(items); } } else { @@ -669,7 +669,7 @@ cons_show_account_list(gchar **accounts) (g_strcmp0(jabber_get_account_name(), accounts[i]) == 0)) { resource_presence_t presence = accounts_get_last_presence(accounts[i]); theme_item_t presence_colour = theme_main_presence_attrs(string_from_resource_presence(presence)); - win_vprint(console, '-', NULL, 0, presence_colour, "", "%s", accounts[i]); + win_vprint(console, '-', 0, NULL, 0, presence_colour, "", "%s", accounts[i]); } else { cons_show(accounts[i]); } @@ -798,12 +798,12 @@ cons_show_account(ProfAccount *account) Resource *resource = curr->data; const char *resource_presence = string_from_resource_presence(resource->presence); theme_item_t presence_colour = theme_main_presence_attrs(resource_presence); - win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence); + win_vprint(console, '-', 0, NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence); if (resource->status) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status); } - win_vprint(console, '-', NULL, NO_DATE, 0, "", ""); + win_vprint(console, '-', 0, NULL, NO_DATE, 0, "", ""); Jid *jidp = jid_create_from_bare_and_resource(account->jid, resource->name); Capabilities *caps = caps_lookup(jidp->fulljid); jid_destroy(jidp); @@ -811,38 +811,38 @@ cons_show_account(ProfAccount *account) if (caps) { // show identity if (caps->category || caps->type || caps->name) { - win_print(console, '-', NULL, NO_EOL, 0, "", " Identity: "); + win_print(console, '-', 0, NULL, NO_EOL, 0, "", " Identity: "); if (caps->name) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->name); if (caps->category || caps->type) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->type) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->type); if (caps->category) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->category) { - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(console); } if (caps->software) { - win_vprint(console, '-', NULL, NO_EOL, 0, "", " Software: %s", caps->software); + win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", " Software: %s", caps->software); } if (caps->software_version) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } if (caps->software || caps->software_version) { win_newline(console); } if (caps->os) { - win_vprint(console, '-', NULL, NO_EOL, 0, "", " OS: %s", caps->os); + win_vprint(console, '-', 0, NULL, NO_EOL, 0, "", " OS: %s", caps->os); } if (caps->os_version) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } if (caps->os || caps->os_version) { win_newline(console); @@ -1554,7 +1554,7 @@ cons_navigation_help(void) { ProfWin *console = wins_get_console(); cons_show(""); - win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Navigation"); + win_print(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "Navigation"); cons_show("Alt-1..Alt-0, F1..F10 : Choose window."); cons_show("Alt-LEFT, Alt-RIGHT : Previous/next chat window"); cons_show("PAGEUP, PAGEDOWN : Page the main window."); @@ -1659,22 +1659,22 @@ cons_theme_colours(void) ProfWin *console = wins_get_console(); cons_show("Theme colours:"); - win_print(console, '-', NULL, NO_EOL, THEME_WHITE, "", " white "); - win_print(console, '-', NULL, NO_DATE, THEME_WHITE_BOLD, "", " bold_white"); - win_print(console, '-', NULL, NO_EOL, THEME_GREEN, "", " green "); - win_print(console, '-', NULL, NO_DATE, THEME_GREEN_BOLD, "", " bold_green"); - win_print(console, '-', NULL, NO_EOL, THEME_RED, "", " red "); - win_print(console, '-', NULL, NO_DATE, THEME_RED_BOLD, "", " bold_red"); - win_print(console, '-', NULL, NO_EOL, THEME_YELLOW, "", " yellow "); - win_print(console, '-', NULL, NO_DATE, THEME_YELLOW_BOLD, "", " bold_yellow"); - win_print(console, '-', NULL, NO_EOL, THEME_BLUE, "", " blue "); - win_print(console, '-', NULL, NO_DATE, THEME_BLUE_BOLD, "", " bold_blue"); - win_print(console, '-', NULL, NO_EOL, THEME_CYAN, "", " cyan "); - win_print(console, '-', NULL, NO_DATE, THEME_CYAN_BOLD, "", " bold_cyan"); - win_print(console, '-', NULL, NO_EOL, THEME_MAGENTA, "", " magenta "); - win_print(console, '-', NULL, NO_DATE, THEME_MAGENTA_BOLD, "", " bold_magenta"); - win_print(console, '-', NULL, NO_EOL, THEME_BLACK, "", " black "); - win_print(console, '-', NULL, NO_DATE, THEME_BLACK_BOLD, "", " bold_black"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_WHITE, "", " white "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_WHITE_BOLD, "", " bold_white"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_GREEN, "", " green "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_GREEN_BOLD, "", " bold_green"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_RED, "", " red "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_RED_BOLD, "", " bold_red"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_YELLOW, "", " yellow "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_YELLOW_BOLD, "", " bold_yellow"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_BLUE, "", " blue "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_BLUE_BOLD, "", " bold_blue"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_CYAN, "", " cyan "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_CYAN_BOLD, "", " bold_cyan"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_MAGENTA, "", " magenta "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_MAGENTA_BOLD, "", " bold_magenta"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_BLACK, "", " black "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_BLACK_BOLD, "", " bold_black"); cons_show(""); } @@ -1684,23 +1684,23 @@ _cons_splash_logo(void) ProfWin *console = wins_get_console(); win_println(console, "Welcome to"); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", " ___ _ "); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", " / __) (_)_ "); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", " ____ ____ ___ | |__ ____ ____ _| |_ _ _ "); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |"); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", "| | | | | | |_| | | ( ( | | | | | | |_| |_| |"); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |"); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", "|_| (____/ "); - win_print(console, '-', NULL, 0, THEME_SPLASH, "", ""); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", " ___ _ "); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", " / __) (_)_ "); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", " ____ ____ ___ | |__ ____ ____ _| |_ _ _ "); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |"); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", "| | | | | | |_| | | ( ( | | | | | | |_| |_| |"); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |"); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", "|_| (____/ "); + win_print(console, '-', 0, NULL, 0, THEME_SPLASH, "", ""); if (strcmp(PACKAGE_STATUS, "development") == 0) { #ifdef HAVE_GIT_VERSION - win_vprint(console, '-', NULL, 0, 0, "", "Version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); + win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); #else - win_vprint(console, '-', NULL, 0, 0, "", "Version %sdev", PACKAGE_VERSION); + win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %sdev", PACKAGE_VERSION); #endif } else { - win_vprint(console, '-', NULL, 0, 0, "", "Version %s", PACKAGE_VERSION); + win_vprint(console, '-', 0, NULL, 0, 0, "", "Version %s", PACKAGE_VERSION); } } @@ -1727,11 +1727,11 @@ _show_roster_contacts(GSList *list, gboolean show_groups) } else { presence_colour = theme_main_presence_attrs("offline"); } - win_vprint(console, '-', NULL, NO_EOL, presence_colour, "", title->str); + win_vprint(console, '-', 0, NULL, NO_EOL, presence_colour, "", title->str); g_string_free(title, TRUE); - win_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " - "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " - "); GString *sub = g_string_new(""); sub = g_string_append(sub, p_contact_subscription(contact)); if (p_contact_pending_out(contact)) { @@ -1747,9 +1747,9 @@ _show_roster_contacts(GSList *list, gboolean show_groups) } if (show_groups) { - win_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", sub->str); + win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", sub->str); } else { - win_vprint(console, '-', NULL, NO_DATE, presence_colour, "", "%s", sub->str); + win_vprint(console, '-', 0, NULL, NO_DATE, presence_colour, "", "%s", sub->str); } g_string_free(sub, TRUE); @@ -1765,10 +1765,10 @@ _show_roster_contacts(GSList *list, gboolean show_groups) } groups = g_slist_next(groups); } - win_vprint(console, '-', NULL, NO_DATE, 0, "", "%s", groups_str->str); + win_vprint(console, '-', 0, NULL, NO_DATE, 0, "", "%s", groups_str->str); g_string_free(groups_str, TRUE); } else { - win_print(console, '-', NULL, NO_DATE, 0, "", " "); + win_print(console, '-', 0, NULL, NO_DATE, 0, "", " "); } } diff --git a/src/ui/core.c b/src/ui/core.c index 821de9fe..fb647083 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -297,13 +297,13 @@ ui_handle_stanza(const char * const msg) ProfWin *window = (ProfWin*) xmlconsole; if (g_str_has_prefix(msg, "SENT:")) { - win_print(window, '-', NULL, 0, 0, "", "SENT:"); - win_print(window, '-', NULL, 0, THEME_ONLINE, "", &msg[6]); - win_print(window, '-', NULL, 0, THEME_ONLINE, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", "SENT:"); + win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]); + win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", ""); } else if (g_str_has_prefix(msg, "RECV:")) { - win_print(window, '-', NULL, 0, 0, "", "RECV:"); - win_print(window, '-', NULL, 0, THEME_AWAY, "", &msg[6]); - win_print(window, '-', NULL, 0, THEME_AWAY, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", "RECV:"); + win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]); + win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", ""); } } } @@ -625,7 +625,7 @@ ui_handle_recipient_not_found(const char * const recipient, const char * const e ProfMucWin *mucwin = wins_get_muc(recipient); if (mucwin) { cons_show_error("Room %s not found: %s", recipient, err_msg); - win_vprint((ProfWin*) mucwin, '!', NULL, 0, THEME_ERROR, "", "Room %s not found: %s", recipient, err_msg); + win_vprint((ProfWin*) mucwin, '!', 0, NULL, 0, THEME_ERROR, "", "Room %s not found: %s", recipient, err_msg); return; } } @@ -638,19 +638,19 @@ ui_handle_recipient_error(const char * const recipient, const char * const err_m ProfChatWin *chatwin = wins_get_chat(recipient); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, THEME_ERROR, "", "Error from %s: %s", recipient, err_msg); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_ERROR, "", "Error from %s: %s", recipient, err_msg); return; } ProfMucWin *mucwin = wins_get_muc(recipient); if (mucwin) { - win_vprint((ProfWin*)mucwin, '!', NULL, 0, THEME_ERROR, "", "Error from %s: %s", recipient, err_msg); + win_vprint((ProfWin*)mucwin, '!', 0, NULL, 0, THEME_ERROR, "", "Error from %s: %s", recipient, err_msg); return; } ProfPrivateWin *privatewin = wins_get_private(recipient); if (privatewin) { - win_vprint((ProfWin*)privatewin, '!', NULL, 0, THEME_ERROR, "", "Error from %s: %s", recipient, err_msg); + win_vprint((ProfWin*)privatewin, '!', 0, NULL, 0, THEME_ERROR, "", "Error from %s: %s", recipient, err_msg); return; } } @@ -896,9 +896,9 @@ ui_gone_secure(const char * const barejid, gboolean trusted) chatwin->enc_mode = PROF_ENC_OTR; chatwin->otr_is_trusted = trusted; if (trusted) { - win_print(window, '!', NULL, 0, THEME_OTR_STARTED_TRUSTED, "", "OTR session started (trusted)."); + win_print(window, '!', 0, NULL, 0, THEME_OTR_STARTED_TRUSTED, "", "OTR session started (trusted)."); } else { - win_print(window, '!', NULL, 0, THEME_OTR_STARTED_UNTRUSTED, "", "OTR session started (untrusted)."); + win_print(window, '!', 0, NULL, 0, THEME_OTR_STARTED_UNTRUSTED, "", "OTR session started (untrusted)."); } if (wins_is_current(window)) { @@ -925,7 +925,7 @@ ui_gone_insecure(const char * const barejid) chatwin->otr_is_trusted = FALSE; ProfWin *window = (ProfWin*)chatwin; - win_print(window, '!', NULL, 0, THEME_OTR_ENDED, "", "OTR session ended."); + win_print(window, '!', 0, NULL, 0, THEME_OTR_ENDED, "", "OTR session ended."); if (wins_is_current(window)) { title_bar_switch(); } @@ -937,7 +937,7 @@ ui_smp_recipient_initiated(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "%s wants to authenticate your identity, use '/otr secret <secret>'.", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "%s wants to authenticate your identity, use '/otr secret <secret>'.", barejid); } } @@ -946,9 +946,9 @@ ui_smp_recipient_initiated_q(const char * const barejid, const char *question) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "%s wants to authenticate your identity with the following question:", barejid); - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", " %s", question); - win_print((ProfWin*)chatwin, '!', NULL, 0, 0, "", "use '/otr answer <answer>'."); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "%s wants to authenticate your identity with the following question:", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", " %s", question); + win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "use '/otr answer <answer>'."); } } @@ -957,7 +957,7 @@ ui_smp_unsuccessful_sender(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "Authentication failed, the secret you entered does not match the secret entered by %s.", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication failed, the secret you entered does not match the secret entered by %s.", barejid); } } @@ -966,7 +966,7 @@ ui_smp_unsuccessful_receiver(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "Authentication failed, the secret entered by %s does not match yours.", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication failed, the secret entered by %s does not match yours.", barejid); } } @@ -975,7 +975,7 @@ ui_smp_aborted(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_print((ProfWin*)chatwin, '!', NULL, 0, 0, "", "SMP session aborted."); + win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "SMP session aborted."); } } @@ -984,7 +984,7 @@ ui_smp_successful(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_print((ProfWin*)chatwin, '!', NULL, 0, 0, "", "Authentication successful."); + win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authentication successful."); } } @@ -993,7 +993,7 @@ ui_smp_answer_success(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "%s successfully authenticated you.", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "%s successfully authenticated you.", barejid); } } @@ -1002,7 +1002,7 @@ ui_smp_answer_failure(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "%s failed to authenticate you.", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "%s failed to authenticate you.", barejid); } } @@ -1011,7 +1011,7 @@ ui_otr_authenticating(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "Authenticating %s...", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Authenticating %s...", barejid); } } @@ -1020,7 +1020,7 @@ ui_otr_authetication_waiting(const char * const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_vprint((ProfWin*)chatwin, '!', NULL, 0, 0, "", "Awaiting authentication from %s...", barejid); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "Awaiting authentication from %s...", barejid); } } @@ -1029,7 +1029,7 @@ ui_handle_otr_error(const char * const barejid, const char * const message) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { - win_print((ProfWin*)chatwin, '!', NULL, 0, THEME_ERROR, "", message); + win_print((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_ERROR, "", message); } else { cons_show_error("%s - %s", barejid, message); } @@ -1044,7 +1044,7 @@ ui_trust(const char * const barejid) chatwin->otr_is_trusted = TRUE; ProfWin *window = (ProfWin*)chatwin; - win_print(window, '!', NULL, 0, THEME_OTR_TRUSTED, "", "OTR session trusted."); + win_print(window, '!', 0, NULL, 0, THEME_OTR_TRUSTED, "", "OTR session trusted."); if (wins_is_current(window)) { title_bar_switch(); } @@ -1060,7 +1060,7 @@ ui_untrust(const char * const barejid) chatwin->otr_is_trusted = FALSE; ProfWin *window = (ProfWin*)chatwin; - win_print(window, '!', NULL, 0, THEME_OTR_UNTRUSTED, "", "OTR session untrusted."); + win_print(window, '!', 0, NULL, 0, THEME_OTR_UNTRUSTED, "", "OTR session untrusted."); if (wins_is_current(window)) { title_bar_switch(); } @@ -1163,7 +1163,7 @@ ui_current_print_formatted_line(const char show_char, int attrs, const char * co va_start(arg, msg); GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, msg, arg); - win_print(current, show_char, NULL, 0, attrs, "", fmt_msg->str); + win_print(current, show_char, 0, NULL, 0, attrs, "", fmt_msg->str); va_end(arg); g_string_free(fmt_msg, TRUE); } @@ -1171,14 +1171,14 @@ ui_current_print_formatted_line(const char show_char, int attrs, const char * co void ui_win_error_line(ProfWin *window, const char * const msg) { - win_print(window, '-', NULL, 0, THEME_ERROR, "", msg); + win_print(window, '-', 0, NULL, 0, THEME_ERROR, "", msg); } void ui_current_error_line(const char * const msg) { ProfWin *current = wins_get_current(); - win_print(current, '-', NULL, 0, THEME_ERROR, "", msg); + win_print(current, '-', 0, NULL, 0, THEME_ERROR, "", msg); } void @@ -1201,7 +1201,7 @@ ui_print_system_msg_from_recipient(const char * const barejid, const char *messa } } - win_vprint(window, '-', NULL, 0, 0, "", "*%s %s", barejid, message); + win_vprint(window, '-', 0, NULL, 0, 0, "", "*%s %s", barejid, message); } void @@ -1233,7 +1233,7 @@ ui_recipient_gone(const char * const barejid, const char * const resource) display_usr = barejid; } - win_vprint((ProfWin*)chatwin, '!', NULL, 0, THEME_GONE, "", "<- %s has left the conversation.", display_usr); + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_GONE, "", "<- %s has left the conversation.", display_usr); } } } @@ -1288,9 +1288,9 @@ void ui_outgoing_chat_msg(ProfChatWin *chatwin, const char * const message, char *id) { if (prefs_get_boolean(PREF_RECEIPTS_REQUEST) && id) { - win_print_with_receipt((ProfWin*)chatwin, '-', NULL, 0, THEME_TEXT_ME, "me", message, id); + win_print_with_receipt((ProfWin*)chatwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message, id); } else { - win_print((ProfWin*)chatwin, '-', NULL, 0, THEME_TEXT_ME, "me", message); + win_print((ProfWin*)chatwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message); } } @@ -1306,7 +1306,7 @@ ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const messa chat_state_active(chatwin->state); - win_print((ProfWin*)chatwin, '-', NULL, 0, THEME_TEXT_ME, "me", message); + win_print((ProfWin*)chatwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message); int num = wins_get_num((ProfWin*)chatwin); status_bar_active(num); @@ -1315,7 +1315,7 @@ ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const messa void ui_outgoing_private_msg(ProfPrivateWin *privwin, const char * const message) { - win_print((ProfWin*)privwin, '-', NULL, 0, THEME_TEXT_ME, "me", message); + win_print((ProfWin*)privwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message); } void @@ -1327,18 +1327,18 @@ ui_room_join(const char * const roomjid, gboolean focus) } char *nick = muc_nick(roomjid); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "-> You have joined the room as %s", nick); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "-> You have joined the room as %s", nick); if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) { char *role = muc_role_str(roomjid); char *affiliation = muc_affiliation_str(roomjid); if (role) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", role: %s", role); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", role: %s", role); } if (affiliation) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", affiliation: %s", affiliation); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", affiliation: %s", affiliation); } } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); if (focus) { @@ -1348,7 +1348,7 @@ ui_room_join(const char * const roomjid, gboolean focus) status_bar_active(num); ProfWin *console = wins_get_console(); char *nick = muc_nick(roomjid); - win_vprint(console, '!', NULL, 0, THEME_TYPING, "", "-> Autojoined %s as %s (%d).", roomjid, nick, num); + win_vprint(console, '!', 0, NULL, 0, THEME_TYPING, "", "-> Autojoined %s as %s (%d).", roomjid, nick, num); } } @@ -1364,14 +1364,14 @@ ui_room_role_change(const char * const roomjid, const char * const role, const c const char * const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Your role has been changed to: %s", role); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your role has been changed to: %s", role); if (actor) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); } if (reason) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); } void @@ -1379,14 +1379,14 @@ ui_room_affiliation_change(const char * const roomjid, const char * const affili const char * const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation); if (actor) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); } if (reason) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); } void @@ -1394,14 +1394,14 @@ ui_room_role_and_affiliation_change(const char * const roomjid, const char * con const char * const actor, const char * const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation); if (actor) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); } if (reason) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); } @@ -1410,14 +1410,14 @@ ui_room_occupant_role_change(const char * const roomjid, const char * const nick const char * const actor, const char * const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role has been changed to: %s", nick, role); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role has been changed to: %s", nick, role); if (actor) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); } if (reason) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); } void @@ -1425,14 +1425,14 @@ ui_room_occupant_affiliation_change(const char * const roomjid, const char * con const char * const actor, const char * const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation); if (actor) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); } if (reason) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); } void @@ -1440,14 +1440,14 @@ ui_room_occupant_role_and_affiliation_change(const char * const roomjid, const c const char * const affiliation, const char * const actor, const char * const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation); if (actor) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor); } if (reason) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", reason: %s", reason); } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); } void @@ -1455,8 +1455,8 @@ ui_handle_room_info_error(const char * const roomjid, const char * const error) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { - win_vprint(window, '!', NULL, 0, 0, "", "Room info request failed: %s", error); - win_print(window, '-', NULL, 0, 0, "", ""); + win_vprint(window, '!', 0, NULL, 0, 0, "", "Room info request failed: %s", error); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } } @@ -1468,7 +1468,7 @@ ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList * if ((identities && (g_slist_length(identities) > 0)) || (features && (g_slist_length(features) > 0))) { if (identities) { - win_print(window, '!', NULL, 0, 0, "", "Identities:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Identities:"); } while (identities) { DiscoIdentity *identity = identities->data; // anme trpe, cat @@ -1484,19 +1484,19 @@ ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList * if (identity->category) { identity_str = g_string_append(identity_str, identity->category); } - win_print(window, '!', NULL, 0, 0, "", identity_str->str); + win_print(window, '!', 0, NULL, 0, 0, "", identity_str->str); g_string_free(identity_str, TRUE); identities = g_slist_next(identities); } if (features) { - win_print(window, '!', NULL, 0, 0, "", "Features:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Features:"); } while (features) { - win_vprint(window, '!', NULL, 0, 0, "", " %s", features->data); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", features->data); features = g_slist_next(features); } - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } } } @@ -1510,16 +1510,16 @@ ui_room_roster(const char * const roomjid, GList *roster, const char * const pre } else { if ((roster == NULL) || (g_list_length(roster) == 0)) { if (presence == NULL) { - win_print(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room is empty."); + win_print(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room is empty."); } else { - win_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", "No occupants %s.", presence); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "No occupants %s.", presence); } } else { int length = g_list_length(roster); if (presence == NULL) { - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%d occupants: ", length); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%d occupants: ", length); } else { - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "%d %s: ", length, presence); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%d %s: ", length, presence); } while (roster) { @@ -1527,15 +1527,15 @@ ui_room_roster(const char * const roomjid, GList *roster, const char * const pre const char *presence_str = string_from_resource_presence(occupant->presence); theme_item_t presence_colour = theme_main_presence_attrs(presence_str); - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", occupant->nick); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", occupant->nick); if (roster->next) { - win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", "); + win_print(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", ", "); } roster = g_list_next(roster); } - win_print(window, '!', NULL, NO_DATE, THEME_ONLINE, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ONLINE, "", ""); } } @@ -1554,7 +1554,7 @@ ui_room_member_offline(const char * const roomjid, const char * const nick) if (window == NULL) { log_error("Received offline presence for room participant %s, but no window open for %s.", nick, roomjid); } else { - win_vprint(window, '!', NULL, 0, THEME_OFFLINE, "", "<- %s has left the room.", nick); + win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s has left the room.", nick); } } @@ -1577,7 +1577,7 @@ ui_room_member_kicked(const char * const roomjid, const char * const nick, const g_string_append(message, reason); } - win_vprint(window, '!', NULL, 0, THEME_OFFLINE, "", "<- %s", message->str); + win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str); g_string_free(message, TRUE); } } @@ -1601,7 +1601,7 @@ ui_room_member_banned(const char * const roomjid, const char * const nick, const g_string_append(message, reason); } - win_vprint(window, '!', NULL, 0, THEME_OFFLINE, "", "<- %s", message->str); + win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str); g_string_free(message, TRUE); } } @@ -1614,16 +1614,16 @@ ui_room_member_online(const char * const roomjid, const char * const nick, const if (window == NULL) { log_error("Received online presence for room participant %s, but no window open for %s.", nick, roomjid); } else { - win_vprint(window, '!', NULL, NO_EOL, THEME_ONLINE, "", "-> %s has joined the room", nick); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ONLINE, "", "-> %s has joined the room", nick); if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) { if (role) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", role: %s", role); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", role: %s", role); } if (affiliation) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", affiliation: %s", affiliation); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", affiliation: %s", affiliation); } } - win_print(window, '!', NULL, NO_DATE, THEME_ROOMINFO, "", ""); + win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", ""); } } @@ -1647,7 +1647,7 @@ ui_room_member_nick_change(const char * const roomjid, if (window == NULL) { log_error("Received nick change for room participant %s, but no window open for %s.", old_nick, roomjid); } else { - win_vprint(window, '!', NULL, 0, THEME_THEM, "", "** %s is now known as %s", old_nick, nick); + win_vprint(window, '!', 0, NULL, 0, THEME_THEM, "", "** %s is now known as %s", old_nick, nick); } } @@ -1658,7 +1658,7 @@ ui_room_nick_change(const char * const roomjid, const char * const nick) if (window == NULL) { log_error("Received self nick change %s, but no window open for %s.", nick, roomjid); } else { - win_vprint(window, '!', NULL, 0, THEME_ME, "", "** You are now known as %s", nick); + win_vprint(window, '!', 0, NULL, 0, THEME_ME, "", "** You are now known as %s", nick); } } @@ -1683,7 +1683,7 @@ ui_room_history(const char * const roomjid, const char * const nick, g_string_append(line, message); } - win_print(window, '-', timestamp, NO_COLOUR_DATE, 0, "", line->str); + win_print(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", line->str); g_string_free(line, TRUE); } } @@ -1704,12 +1704,12 @@ ui_room_message(const char * const roomjid, const char * const nick, if (g_strcmp0(nick, my_nick) != 0) { if (g_strrstr(message, my_nick)) { - win_print(window, '-', NULL, NO_ME, THEME_ROOMMENTION, nick, message); + win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMMENTION, nick, message); } else { - win_print(window, '-', NULL, NO_ME, THEME_TEXT_THEM, nick, message); + win_print(window, '-', 0, NULL, NO_ME, THEME_TEXT_THEM, nick, message); } } else { - win_print(window, '-', NULL, 0, THEME_TEXT_ME, nick, message); + win_print(window, '-', 0, NULL, 0, THEME_TEXT_ME, nick, message); } // currently in groupchat window @@ -1785,16 +1785,16 @@ ui_room_requires_config(const char * const roomjid) ui_index = 0; } - win_print(window, '-', NULL, 0, 0, "", ""); - win_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", + win_print(window, '-', 0, NULL, 0, 0, "", ""); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room locked, requires configuration."); - win_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room accept' to accept the defaults"); - win_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room destroy' to cancel and destroy the room"); - win_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room config' to edit the room configuration"); - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); // currently in groupchat window if (wins_is_current(window)) { @@ -1843,16 +1843,16 @@ ui_room_destroyed(const char * const roomjid, const char * const reason, const c ProfWin *console = wins_get_console(); if (reason) { - win_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- Room destroyed: %s, reason: %s", roomjid, reason); + win_vprint(console, '!', 0, NULL, 0, THEME_TYPING, "", "<- Room destroyed: %s, reason: %s", roomjid, reason); } else { - win_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- Room destroyed: %s", roomjid); + win_vprint(console, '!', 0, NULL, 0, THEME_TYPING, "", "<- Room destroyed: %s", roomjid); } if (new_jid) { if (password) { - win_vprint(console, '!', NULL, 0, THEME_TYPING, "", "Replacement room: %s, password: %s", new_jid, password); + win_vprint(console, '!', 0, NULL, 0, THEME_TYPING, "", "Replacement room: %s, password: %s", new_jid, password); } else { - win_vprint(console, '!', NULL, 0, THEME_TYPING, "", "Replacement room: %s", new_jid); + win_vprint(console, '!', 0, NULL, 0, THEME_TYPING, "", "Replacement room: %s", new_jid); } } } @@ -1880,7 +1880,7 @@ ui_room_kicked(const char * const roomjid, const char * const actor, const char } ProfWin *console = wins_get_console(); - win_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- %s", message->str); + win_vprint(console, '!', 0, NULL, 0, THEME_TYPING, "", "<- %s", message->str); g_string_free(message, TRUE); } } @@ -1907,7 +1907,7 @@ ui_room_banned(const char * const roomjid, const char * const actor, const char } ProfWin *console = wins_get_console(); - win_vprint(console, '!', NULL, 0, THEME_TYPING, "", "<- %s", message->str); + win_vprint(console, '!', 0, NULL, 0, THEME_TYPING, "", "<- %s", message->str); g_string_free(message, TRUE); } } @@ -1923,17 +1923,17 @@ ui_room_subject(const char * const roomjid, const char * const nick, const char if (subject) { if (nick) { - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "*%s has set the room subject: ", nick); - win_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", subject); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "*%s has set the room subject: ", nick); + win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject); } else { - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: "); - win_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", subject); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: "); + win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject); } } else { if (nick) { - win_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject: ", nick); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject: ", nick); } else { - win_vprint(window, '!', NULL, 0, THEME_ROOMINFO, "", "Room subject cleared"); + win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room subject cleared"); } } @@ -1955,7 +1955,7 @@ ui_handle_room_kick_error(const char * const roomjid, const char * const nick, c if (window == NULL) { log_error("Kick error received for %s, but no window open for %s.", nick, roomjid); } else { - win_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error kicking %s: %s", nick, error); + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error kicking %s: %s", nick, error); } } @@ -1968,8 +1968,8 @@ ui_room_broadcast(const char * const roomjid, const char * const message) } else { int num = wins_get_num(window); - win_vprint(window, '!', NULL, NO_EOL, THEME_ROOMINFO, "", "Room message: "); - win_vprint(window, '!', NULL, NO_DATE, 0, "", "%s", message); + win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room message: "); + win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", message); // currently in groupchat window if (wins_is_current(window)) { @@ -1988,7 +1988,7 @@ ui_handle_room_affiliation_list_error(const char * const roomjid, const char * c { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { - win_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", affiliation, error); + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", affiliation, error); } } @@ -1998,17 +1998,17 @@ ui_handle_room_affiliation_list(const char * const roomjid, const char * const a ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { if (jids) { - win_vprint(window, '!', NULL, 0, 0, "", "Affiliation: %s", affiliation); + win_vprint(window, '!', 0, NULL, 0, 0, "", "Affiliation: %s", affiliation); GSList *curr_jid = jids; while (curr_jid) { char *jid = curr_jid->data; - win_vprint(window, '!', NULL, 0, 0, "", " %s", jid); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", jid); curr_jid = g_slist_next(curr_jid); } - win_print(window, '!', NULL, 0, 0, "", ""); + win_print(window, '!', 0, NULL, 0, 0, "", ""); } else { - win_vprint(window, '!', NULL, 0, 0, "", "No users found with affiliation: %s", affiliation); - win_print(window, '!', NULL, 0, 0, "", ""); + win_vprint(window, '!', 0, NULL, 0, 0, "", "No users found with affiliation: %s", affiliation); + win_print(window, '!', 0, NULL, 0, 0, "", ""); } } } @@ -2018,7 +2018,7 @@ ui_handle_room_role_list_error(const char * const roomjid, const char * const ro { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { - win_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", role, error); + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", role, error); } } @@ -2028,26 +2028,26 @@ ui_handle_room_role_list(const char * const roomjid, const char * const role, GS ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { if (nicks) { - win_vprint(window, '!', NULL, 0, 0, "", "Role: %s", role); + win_vprint(window, '!', 0, NULL, 0, 0, "", "Role: %s", role); GSList *curr_nick = nicks; while (curr_nick) { char *nick = curr_nick->data; Occupant *occupant = muc_roster_item(roomjid, nick); if (occupant) { if (occupant->jid) { - win_vprint(window, '!', NULL, 0, 0, "", " %s (%s)", nick, occupant->jid); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", nick, occupant->jid); } else { - win_vprint(window, '!', NULL, 0, 0, "", " %s", nick); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", nick); } } else { - win_vprint(window, '!', NULL, 0, 0, "", " %s", nick); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", nick); } curr_nick = g_slist_next(curr_nick); } - win_print(window, '!', NULL, 0, 0, "", ""); + win_print(window, '!', 0, NULL, 0, 0, "", ""); } else { - win_vprint(window, '!', NULL, 0, 0, "", "No occupants found with role: %s", role); - win_print(window, '!', NULL, 0, 0, "", ""); + win_vprint(window, '!', 0, NULL, 0, 0, "", "No occupants found with role: %s", role); + win_print(window, '!', 0, NULL, 0, 0, "", ""); } } } @@ -2058,7 +2058,7 @@ ui_handle_room_affiliation_set_error(const char * const roomjid, const char * co { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { - win_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error setting %s affiliation for %s: %s", affiliation, jid, error); + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s affiliation for %s: %s", affiliation, jid, error); } } @@ -2068,7 +2068,7 @@ ui_handle_room_role_set_error(const char * const roomjid, const char * const nic { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { - win_vprint(window, '!', NULL, 0, THEME_ERROR, "", "Error setting %s role for %s: %s", role, nick, error); + win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s role for %s: %s", role, nick, error); } } @@ -2237,10 +2237,10 @@ ui_show_room_info(ProfMucWin *mucwin) char *affiliation = muc_affiliation_str(mucwin->roomjid); ProfWin *window = (ProfWin*) mucwin; - win_vprint(window, '!', NULL, 0, 0, "", "Room: %s", mucwin->roomjid); - win_vprint(window, '!', NULL, 0, 0, "", "Affiliation: %s", affiliation); - win_vprint(window, '!', NULL, 0, 0, "", "Role: %s", role); - win_print(window, '-', NULL, 0, 0, "", ""); + win_vprint(window, '!', 0, NULL, 0, 0, "", "Room: %s", mucwin->roomjid); + win_vprint(window, '!', 0, NULL, 0, 0, "", "Affiliation: %s", affiliation); + win_vprint(window, '!', 0, NULL, 0, 0, "", "Role: %s", role); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } void @@ -2252,28 +2252,28 @@ ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role) if (!occupants) { switch (role) { case MUC_ROLE_MODERATOR: - win_print(window, '!', NULL, 0, 0, "", "No moderators found."); + win_print(window, '!', 0, NULL, 0, 0, "", "No moderators found."); break; case MUC_ROLE_PARTICIPANT: - win_print(window, '!', NULL, 0, 0, "", "No participants found."); + win_print(window, '!', 0, NULL, 0, 0, "", "No participants found."); break; case MUC_ROLE_VISITOR: - win_print(window, '!', NULL, 0, 0, "", "No visitors found."); + win_print(window, '!', 0, NULL, 0, 0, "", "No visitors found."); break; default: break; } - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } else { switch (role) { case MUC_ROLE_MODERATOR: - win_print(window, '!', NULL, 0, 0, "", "Moderators:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Moderators:"); break; case MUC_ROLE_PARTICIPANT: - win_print(window, '!', NULL, 0, 0, "", "Participants:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Participants:"); break; case MUC_ROLE_VISITOR: - win_print(window, '!', NULL, 0, 0, "", "Visitors:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Visitors:"); break; default: break; @@ -2284,16 +2284,16 @@ ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role) Occupant *occupant = curr_occupant->data; if (occupant->role == role) { if (occupant->jid) { - win_vprint(window, '!', NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid); } else { - win_vprint(window, '!', NULL, 0, 0, "", " %s", occupant->nick); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", occupant->nick); } } curr_occupant = g_slist_next(curr_occupant); } - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } } @@ -2306,34 +2306,34 @@ ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) if (!occupants) { switch (affiliation) { case MUC_AFFILIATION_OWNER: - win_print(window, '!', NULL, 0, 0, "", "No owners found."); + win_print(window, '!', 0, NULL, 0, 0, "", "No owners found."); break; case MUC_AFFILIATION_ADMIN: - win_print(window, '!', NULL, 0, 0, "", "No admins found."); + win_print(window, '!', 0, NULL, 0, 0, "", "No admins found."); break; case MUC_AFFILIATION_MEMBER: - win_print(window, '!', NULL, 0, 0, "", "No members found."); + win_print(window, '!', 0, NULL, 0, 0, "", "No members found."); break; case MUC_AFFILIATION_OUTCAST: - win_print(window, '!', NULL, 0, 0, "", "No outcasts found."); + win_print(window, '!', 0, NULL, 0, 0, "", "No outcasts found."); break; default: break; } - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } else { switch (affiliation) { case MUC_AFFILIATION_OWNER: - win_print(window, '!', NULL, 0, 0, "", "Owners:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Owners:"); break; case MUC_AFFILIATION_ADMIN: - win_print(window, '!', NULL, 0, 0, "", "Admins:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Admins:"); break; case MUC_AFFILIATION_MEMBER: - win_print(window, '!', NULL, 0, 0, "", "Members:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Members:"); break; case MUC_AFFILIATION_OUTCAST: - win_print(window, '!', NULL, 0, 0, "", "Outcasts:"); + win_print(window, '!', 0, NULL, 0, 0, "", "Outcasts:"); break; default: break; @@ -2344,28 +2344,28 @@ ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) Occupant *occupant = curr_occupant->data; if (occupant->affiliation == affiliation) { if (occupant->jid) { - win_vprint(window, '!', NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid); } else { - win_vprint(window, '!', NULL, 0, 0, "", " %s", occupant->nick); + win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", occupant->nick); } } curr_occupant = g_slist_next(curr_occupant); } - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } } static void _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) { - win_vprint(window, '-', NULL, NO_EOL, THEME_AWAY, "", "[%s] ", tag); - win_vprint(window, '-', NULL, NO_EOL | NO_DATE, 0, "", "%s", field->label); + win_vprint(window, '-', 0, NULL, NO_EOL, THEME_AWAY, "", "[%s] ", tag); + win_vprint(window, '-', 0, NULL, NO_EOL | NO_DATE, 0, "", "%s", field->label); if (field->required) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " (required): "); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " (required): "); } else { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ": "); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ": "); } GSList *values = field->values; @@ -2379,9 +2379,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) char *value = curr_value->data; if (value) { if (g_strcmp0(field->var, "muc#roomconfig_roomsecret") == 0) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]"); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]"); } else { - win_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value); } } } @@ -2391,7 +2391,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) if (curr_value) { char *value = curr_value->data; if (value) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]"); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "[hidden]"); } } win_newline(window); @@ -2403,23 +2403,23 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) char *value = curr_value->data; GString *val_tag = g_string_new(""); g_string_printf(val_tag, "val%d", index++); - win_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", val_tag->str, value); + win_vprint(window, '-', 0, NULL, 0, THEME_ONLINE, "", " [%s] %s", val_tag->str, value); g_string_free(val_tag, TRUE); curr_value = g_slist_next(curr_value); } break; case FIELD_BOOLEAN: if (curr_value == NULL) { - win_print(window, '-', NULL, NO_DATE, THEME_OFFLINE, "", "FALSE"); + win_print(window, '-', 0, NULL, NO_DATE, THEME_OFFLINE, "", "FALSE"); } else { char *value = curr_value->data; if (value == NULL) { - win_print(window, '-', NULL, NO_DATE, THEME_OFFLINE, "", "FALSE"); + win_print(window, '-', 0, NULL, NO_DATE, THEME_OFFLINE, "", "FALSE"); } else { if (g_strcmp0(value, "0") == 0) { - win_print(window, '-', NULL, NO_DATE, THEME_OFFLINE, "", "FALSE"); + win_print(window, '-', 0, NULL, NO_DATE, THEME_OFFLINE, "", "FALSE"); } else { - win_print(window, '-', NULL, NO_DATE, THEME_ONLINE, "", "TRUE"); + win_print(window, '-', 0, NULL, NO_DATE, THEME_ONLINE, "", "TRUE"); } } } @@ -2433,9 +2433,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) while (curr_option) { FormOption *option = curr_option->data; if (g_strcmp0(option->value, value) == 0) { - win_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label); + win_vprint(window, '-', 0, NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label); } else { - win_vprint(window, '-', NULL, 0, THEME_OFFLINE, "", " [%s] %s", option->value, option->label); + win_vprint(window, '-', 0, NULL, 0, THEME_OFFLINE, "", " [%s] %s", option->value, option->label); } curr_option = g_slist_next(curr_option); } @@ -2449,9 +2449,9 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) while (curr_option) { FormOption *option = curr_option->data; if (g_slist_find_custom(curr_value, option->value, (GCompareFunc)g_strcmp0)) { - win_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label); + win_vprint(window, '-', 0, NULL, 0, THEME_ONLINE, "", " [%s] %s", option->value, option->label); } else { - win_vprint(window, '-', NULL, 0, THEME_OFFLINE, "", " [%s] %s", option->value, option->label); + win_vprint(window, '-', 0, NULL, 0, THEME_OFFLINE, "", " [%s] %s", option->value, option->label); } curr_option = g_slist_next(curr_option); } @@ -2461,7 +2461,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) if (curr_value) { char *value = curr_value->data; if (value) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", value); } } win_newline(window); @@ -2470,7 +2470,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) win_newline(window); while (curr_value) { char *value = curr_value->data; - win_vprint(window, '-', NULL, 0, THEME_ONLINE, "", " %s", value); + win_vprint(window, '-', 0, NULL, 0, THEME_ONLINE, "", " %s", value); curr_value = g_slist_next(curr_value); } break; @@ -2478,7 +2478,7 @@ _ui_handle_form_field(ProfWin *window, char *tag, FormField *field) if (curr_value) { char *value = curr_value->data; if (value) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", value); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", value); } } win_newline(window); @@ -2493,12 +2493,12 @@ ui_show_form(ProfMucConfWin *confwin) { ProfWin *window = (ProfWin*) confwin; if (confwin->form->title) { - win_print(window, '-', NULL, NO_EOL, 0, "", "Form title: "); - win_print(window, '-', NULL, NO_DATE, 0, "", confwin->form->title); + win_print(window, '-', 0, NULL, NO_EOL, 0, "", "Form title: "); + win_print(window, '-', 0, NULL, NO_DATE, 0, "", confwin->form->title); } else { - win_vprint(window, '-', NULL, 0, 0, "", "Configuration for room %s.", confwin->roomjid); + win_vprint(window, '-', 0, NULL, 0, 0, "", "Configuration for room %s.", confwin->roomjid); } - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); ui_show_form_help(confwin); @@ -2510,7 +2510,7 @@ ui_show_form(ProfMucConfWin *confwin) if ((g_strcmp0(field->type, "fixed") == 0) && field->values) { if (field->values) { char *value = field->values->data; - win_print(window, '-', NULL, 0, 0, "", value); + win_print(window, '-', 0, NULL, 0, 0, "", value); } } else if (g_strcmp0(field->type, "hidden") != 0 && field->var) { char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var); @@ -2539,11 +2539,11 @@ ui_handle_room_configuration(const char * const roomjid, DataForm *form) ui_ev_focus_win(window); ui_show_form(confwin); - win_print(window, '-', NULL, 0, 0, "", ""); - win_print(window, '-', NULL, 0, 0, "", "Use '/form submit' to save changes."); - win_print(window, '-', NULL, 0, 0, "", "Use '/form cancel' to cancel changes."); - win_print(window, '-', NULL, 0, 0, "", "See '/form help' for more information."); - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", "Use '/form submit' to save changes."); + win_print(window, '-', 0, NULL, 0, 0, "", "Use '/form cancel' to cancel changes."); + win_print(window, '-', 0, NULL, 0, 0, "", "See '/form help' for more information."); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } void @@ -2565,7 +2565,7 @@ ui_handle_room_configuration_form_error(const char * const roomjid, const char * g_string_append(message_str, message); } - win_print(window, '-', NULL, 0, THEME_ERROR, "", message_str->str); + win_print(window, '-', 0, NULL, 0, THEME_ERROR, "", message_str->str); g_string_free(message_str, TRUE); } @@ -2592,7 +2592,7 @@ ui_handle_room_config_submit_result(const char * const roomjid) if (muc_window) { ui_ev_focus_win((ProfWin*)muc_window); - win_print(muc_window, '!', NULL, 0, THEME_ROOMINFO, "", "Room configuration successful"); + win_print(muc_window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room configuration successful"); } else { ProfWin *console = wins_get_console(); ui_ev_focus_win(console); @@ -2620,25 +2620,25 @@ ui_handle_room_config_submit_result_error(const char * const roomjid, const char if (form_window) { if (message) { - win_vprint(form_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error: %s", message); + win_vprint(form_window, '!', 0, NULL, 0, THEME_ERROR, "", "Configuration error: %s", message); } else { - win_print(form_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error"); + win_print(form_window, '!', 0, NULL, 0, THEME_ERROR, "", "Configuration error"); } } else if (muc_window) { if (message) { - win_vprint(muc_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error: %s", message); + win_vprint(muc_window, '!', 0, NULL, 0, THEME_ERROR, "", "Configuration error: %s", message); } else { - win_print(muc_window, '!', NULL, 0, THEME_ERROR, "", "Configuration error"); + win_print(muc_window, '!', 0, NULL, 0, THEME_ERROR, "", "Configuration error"); } } else { if (message) { - win_vprint(console, '!', NULL, 0, THEME_ERROR, "", "Configuration error for %s: %s", roomjid, message); + win_vprint(console, '!', 0, NULL, 0, THEME_ERROR, "", "Configuration error for %s: %s", roomjid, message); } else { - win_vprint(console, '!', NULL, 0, THEME_ERROR, "", "Configuration error for %s", roomjid); + win_vprint(console, '!', 0, NULL, 0, THEME_ERROR, "", "Configuration error for %s", roomjid); } } } else { - win_print(console, '!', NULL, 0, THEME_ERROR, "", "Configuration error"); + win_print(console, '!', 0, NULL, 0, THEME_ERROR, "", "Configuration error"); } } @@ -2648,16 +2648,16 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) ProfWin *window = (ProfWin*) confwin; FormField *field = form_get_field_by_tag(confwin->form, tag); if (field) { - win_print(window, '-', NULL, NO_EOL, 0, "", field->label); + win_print(window, '-', 0, NULL, NO_EOL, 0, "", field->label); if (field->required) { - win_print(window, '-', NULL, NO_DATE, 0, "", " (Required):"); + win_print(window, '-', 0, NULL, NO_DATE, 0, "", " (Required):"); } else { - win_print(window, '-', NULL, NO_DATE, 0, "", ":"); + win_print(window, '-', 0, NULL, NO_DATE, 0, "", ":"); } if (field->description) { - win_vprint(window, '-', NULL, 0, 0, "", " Description : %s", field->description); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Description : %s", field->description); } - win_vprint(window, '-', NULL, 0, 0, "", " Type : %s", field->type); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Type : %s", field->type); int num_values = 0; GSList *curr_option = NULL; @@ -2666,51 +2666,51 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) switch (field->type_t) { case FIELD_TEXT_SINGLE: case FIELD_TEXT_PRIVATE: - win_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); - win_print(window, '-', NULL, 0, 0, "", " Where : <value> is any text"); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Set : /%s <value>", tag); + win_print(window, '-', 0, NULL, 0, 0, "", " Where : <value> is any text"); break; case FIELD_TEXT_MULTI: num_values = form_get_value_count(confwin->form, tag); - win_vprint(window, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag); - win_print(window, '-', NULL, 0, 0, "", " Where : <value> is any text"); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Add : /%s add <value>", tag); + win_print(window, '-', 0, NULL, 0, 0, "", " Where : <value> is any text"); if (num_values > 0) { - win_vprint(window, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag); - win_vprint(window, '-', NULL, 0, 0, "", " Where : <value> between 'val1' and 'val%d'", num_values); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Remove : /%s remove <value>", tag); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Where : <value> between 'val1' and 'val%d'", num_values); } break; case FIELD_BOOLEAN: - win_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); - win_print(window, '-', NULL, 0, 0, "", " Where : <value> is either 'on' or 'off'"); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Set : /%s <value>", tag); + win_print(window, '-', 0, NULL, 0, 0, "", " Where : <value> is either 'on' or 'off'"); break; case FIELD_LIST_SINGLE: - win_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); - win_print(window, '-', NULL, 0, 0, "", " Where : <value> is one of"); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Set : /%s <value>", tag); + win_print(window, '-', 0, NULL, 0, 0, "", " Where : <value> is one of"); curr_option = field->options; while (curr_option) { option = curr_option->data; - win_vprint(window, '-', NULL, 0, 0, "", " %s", option->value); + win_vprint(window, '-', 0, NULL, 0, 0, "", " %s", option->value); curr_option = g_slist_next(curr_option); } break; case FIELD_LIST_MULTI: - win_vprint(window, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag); - win_vprint(window, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag); - win_print(window, '-', NULL, 0, 0, "", " Where : <value> is one of"); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Add : /%s add <value>", tag); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Remove : /%s remove <value>", tag); + win_print(window, '-', 0, NULL, 0, 0, "", " Where : <value> is one of"); curr_option = field->options; while (curr_option) { option = curr_option->data; - win_vprint(window, '-', NULL, 0, 0, "", " %s", option->value); + win_vprint(window, '-', 0, NULL, 0, 0, "", " %s", option->value); curr_option = g_slist_next(curr_option); } break; case FIELD_JID_SINGLE: - win_vprint(window, '-', NULL, 0, 0, "", " Set : /%s <value>", tag); - win_print(window, '-', NULL, 0, 0, "", " Where : <value> is a valid Jabber ID"); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Set : /%s <value>", tag); + win_print(window, '-', 0, NULL, 0, 0, "", " Where : <value> is a valid Jabber ID"); break; case FIELD_JID_MULTI: - win_vprint(window, '-', NULL, 0, 0, "", " Add : /%s add <value>", tag); - win_vprint(window, '-', NULL, 0, 0, "", " Remove : /%s remove <value>", tag); - win_print(window, '-', NULL, 0, 0, "", " Where : <value> is a valid Jabber ID"); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Add : /%s add <value>", tag); + win_vprint(window, '-', 0, NULL, 0, 0, "", " Remove : /%s remove <value>", tag); + win_print(window, '-', 0, NULL, 0, 0, "", " Where : <value> is a valid Jabber ID"); break; case FIELD_FIXED: case FIELD_UNKNOWN: @@ -2719,7 +2719,7 @@ ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) break; } } else { - win_vprint(window, '-', NULL, 0, 0, "", "No such field %s", tag); + win_vprint(window, '-', 0, NULL, 0, 0, "", "No such field %s", tag); } } @@ -2728,9 +2728,9 @@ ui_show_form_help(ProfMucConfWin *confwin) { if (confwin->form->instructions) { ProfWin *window = (ProfWin*) confwin; - win_print(window, '-', NULL, 0, 0, "", "Supplied instructions:"); - win_print(window, '-', NULL, 0, 0, "", confwin->form->instructions); - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", "Supplied instructions:"); + win_print(window, '-', 0, NULL, 0, 0, "", confwin->form->instructions); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } } @@ -2740,7 +2740,7 @@ ui_show_lines(ProfWin *window, const gchar** lines) if (lines) { int i; for (i = 0; lines[i] != NULL; i++) { - win_print(window, '-', NULL, 0, 0, "", lines[i]); + win_print(window, '-', 0, NULL, 0, 0, "", lines[i]); } } } @@ -2808,11 +2808,11 @@ _win_show_history(ProfChatWin *chatwin, const char * const contact) char mm[3]; memcpy(mm, &line[3], 2); mm[2] = '\0'; int imm = atoi(mm); char ss[3]; memcpy(ss, &line[6], 2); ss[2] = '\0'; int iss = atoi(ss); GDateTime *timestamp = g_date_time_new_local(2000, 1, 1, ihh, imm, iss); - win_print((ProfWin*)chatwin, '-', timestamp, NO_COLOUR_DATE, 0, "", curr->data+11); + win_print((ProfWin*)chatwin, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", curr->data+11); g_date_time_unref(timestamp); // header } else { - win_print((ProfWin*)chatwin, '-', NULL, 0, 0, "", curr->data); + win_print((ProfWin*)chatwin, '-', 0, NULL, 0, 0, "", curr->data); } curr = g_slist_next(curr); } diff --git a/src/ui/ui.h b/src/ui/ui.h index dba90d2b..90f29b65 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -352,8 +352,8 @@ void win_hide_subwin(ProfWin *window); void win_show_subwin(ProfWin *window); void win_refresh_without_subwin(ProfWin *window); void win_refresh_with_subwin(ProfWin *window); -void win_print(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message); -void win_vprint(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...); +void win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message); +void win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...); char* win_get_title(ProfWin *window); void win_show_occupant(ProfWin *window, Occupant *occupant); void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant); diff --git a/src/ui/window.c b/src/ui/window.c index 6c76b5f8..bfc992ae 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -59,9 +59,9 @@ #define CEILING(X) (X-(int)(X) > 0 ? (int)(X+1) : (int)(X)) -static void _win_print(ProfWin *window, const char show_char, GDateTime *time, +static void _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt); -static void _win_print_wrapped(WINDOW *win, const char * const message, size_t indent); +static void _win_print_wrapped(WINDOW *win, const char * const message, size_t indent, int pad_indent); int win_roster_cols(void) @@ -577,14 +577,14 @@ win_show_occupant(ProfWin *window, Occupant *occupant) theme_item_t presence_colour = theme_main_presence_attrs(presence_str); - win_print(window, '-', NULL, NO_EOL, presence_colour, "", occupant->nick); - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); + win_print(window, '-', 0, NULL, NO_EOL, presence_colour, "", occupant->nick); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); if (occupant->status) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", occupant->status); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", occupant->status); } - win_print(window, '-', NULL, NO_DATE, presence_colour, "", ""); + win_print(window, '-', 0, NULL, NO_DATE, presence_colour, "", ""); } void @@ -599,12 +599,12 @@ win_show_contact(ProfWin *window, PContact contact) theme_item_t presence_colour = theme_main_presence_attrs(presence); if (name) { - win_print(window, '-', NULL, NO_EOL, presence_colour, "", name); + win_print(window, '-', 0, NULL, NO_EOL, presence_colour, "", name); } else { - win_print(window, '-', NULL, NO_EOL, presence_colour, "", barejid); + win_print(window, '-', 0, NULL, NO_EOL, presence_colour, "", barejid); } - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence); if (last_activity) { GDateTime *now = g_date_time_new_now_local(); @@ -617,18 +617,18 @@ win_show_contact(ProfWin *window, PContact contact) int seconds = span / G_TIME_SPAN_SECOND; if (hours > 0) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds); } else { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dm%ds", minutes, seconds); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dm%ds", minutes, seconds); } } if (status) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", p_contact_status(contact)); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", p_contact_status(contact)); } - win_print(window, '-', NULL, NO_DATE, presence_colour, "", ""); + win_print(window, '-', 0, NULL, NO_DATE, presence_colour, "", ""); } void @@ -640,21 +640,21 @@ win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occup theme_item_t presence_colour = theme_main_presence_attrs(presence_str); - win_print(window, '!', NULL, NO_EOL, presence_colour, "", occupant->nick); - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); + win_print(window, '!', 0, NULL, NO_EOL, presence_colour, "", occupant->nick); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); if (occupant->status) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", occupant->status); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", occupant->status); } win_newline(window); if (occupant->jid) { - win_vprint(window, '!', NULL, 0, 0, "", " Jid: %s", occupant->jid); + win_vprint(window, '!', 0, NULL, 0, 0, "", " Jid: %s", occupant->jid); } - win_vprint(window, '!', NULL, 0, 0, "", " Affiliation: %s", occupant_affiliation); - win_vprint(window, '!', NULL, 0, 0, "", " Role: %s", occupant_role); + win_vprint(window, '!', 0, NULL, 0, 0, "", " Affiliation: %s", occupant_affiliation); + win_vprint(window, '!', 0, NULL, 0, 0, "", " Role: %s", occupant_role); Jid *jidp = jid_create_from_bare_and_resource(room, occupant->nick); Capabilities *caps = caps_lookup(jidp->fulljid); @@ -663,38 +663,38 @@ win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occup if (caps) { // show identity if (caps->category || caps->type || caps->name) { - win_print(window, '!', NULL, NO_EOL, 0, "", " Identity: "); + win_print(window, '!', 0, NULL, NO_EOL, 0, "", " Identity: "); if (caps->name) { - win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->name); + win_print(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->name); if (caps->category || caps->type) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->type) { - win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->type); + win_print(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->type); if (caps->category) { - win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->category) { - win_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->category); + win_print(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(window); } if (caps->software) { - win_vprint(window, '!', NULL, NO_EOL, 0, "", " Software: %s", caps->software); + win_vprint(window, '!', 0, NULL, NO_EOL, 0, "", " Software: %s", caps->software); } if (caps->software_version) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } if (caps->software || caps->software_version) { win_newline(window); } if (caps->os) { - win_vprint(window, '!', NULL, NO_EOL, 0, "", " OS: %s", caps->os); + win_vprint(window, '!', 0, NULL, NO_EOL, 0, "", " OS: %s", caps->os); } if (caps->os_version) { - win_vprint(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); + win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } if (caps->os || caps->os_version) { win_newline(window); @@ -702,7 +702,7 @@ win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occup caps_destroy(caps); } - win_print(window, '-', NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, 0, 0, "", ""); } void @@ -716,15 +716,15 @@ win_show_info(ProfWin *window, PContact contact) theme_item_t presence_colour = theme_main_presence_attrs(presence); - win_print(window, '-', NULL, 0, 0, "", ""); - win_print(window, '-', NULL, NO_EOL, presence_colour, "", barejid); + win_print(window, '-', 0, NULL, 0, 0, "", ""); + win_print(window, '-', 0, NULL, NO_EOL, presence_colour, "", barejid); if (name) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (%s)", name); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (%s)", name); } - win_print(window, '-', NULL, NO_DATE, 0, "", ":"); + win_print(window, '-', 0, NULL, NO_DATE, 0, "", ":"); if (sub) { - win_vprint(window, '-', NULL, 0, 0, "", "Subscription: %s", sub); + win_vprint(window, '-', 0, NULL, 0, 0, "", "Subscription: %s", sub); } if (last_activity) { @@ -738,10 +738,10 @@ win_show_info(ProfWin *window, PContact contact) int seconds = span / G_TIME_SPAN_SECOND; if (hours > 0) { - win_vprint(window, '-', NULL, 0, 0, "", "Last activity: %dh%dm%ds", hours, minutes, seconds); + win_vprint(window, '-', 0, NULL, 0, 0, "", "Last activity: %dh%dm%ds", hours, minutes, seconds); } else { - win_vprint(window, '-', NULL, 0, 0, "", "Last activity: %dm%ds", minutes, seconds); + win_vprint(window, '-', 0, NULL, 0, 0, "", "Last activity: %dm%ds", minutes, seconds); } g_date_time_unref(now); @@ -750,7 +750,7 @@ win_show_info(ProfWin *window, PContact contact) GList *resources = p_contact_get_available_resources(contact); GList *ordered_resources = NULL; if (resources) { - win_print(window, '-', NULL, 0, 0, "", "Resources:"); + win_print(window, '-', 0, NULL, 0, 0, "", "Resources:"); // sort in order of availability GList *curr = resources; @@ -768,9 +768,9 @@ win_show_info(ProfWin *window, PContact contact) Resource *resource = curr->data; const char *resource_presence = string_from_resource_presence(resource->presence); theme_item_t presence_colour = theme_main_presence_attrs(resource_presence); - win_vprint(window, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence); + win_vprint(window, '-', 0, NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence); if (resource->status) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status); } win_newline(window); @@ -781,38 +781,38 @@ win_show_info(ProfWin *window, PContact contact) if (caps) { // show identity if (caps->category || caps->type || caps->name) { - win_print(window, '-', NULL, NO_EOL, 0, "", " Identity: "); + win_print(window, '-', 0, NULL, NO_EOL, 0, "", " Identity: "); if (caps->name) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->name); if (caps->category || caps->type) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->type) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->type); if (caps->category) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->category) { - win_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category); + win_print(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_newline(window); } if (caps->software) { - win_vprint(window, '-', NULL, NO_EOL, 0, "", " Software: %s", caps->software); + win_vprint(window, '-', 0, NULL, NO_EOL, 0, "", " Software: %s", caps->software); } if (caps->software_version) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } if (caps->software || caps->software_version) { win_newline(window); } if (caps->os) { - win_vprint(window, '-', NULL, NO_EOL, 0, "", " OS: %s", caps->os); + win_vprint(window, '-', 0, NULL, NO_EOL, 0, "", " OS: %s", caps->os); } if (caps->os_version) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } if (caps->os || caps->os_version) { win_newline(window); @@ -842,12 +842,12 @@ win_show_status_string(ProfWin *window, const char * const from, } - win_vprint(window, '-', NULL, NO_EOL, presence_colour, "", "%s %s", pre, from); + win_vprint(window, '-', 0, NULL, NO_EOL, presence_colour, "", "%s %s", pre, from); if (show) - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", show); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", show); else - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", default_show); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", default_show); if (last_activity) { GDateTime *now = g_date_time_new_now_local(); @@ -861,17 +861,17 @@ win_show_status_string(ProfWin *window, const char * const from, int seconds = span / G_TIME_SPAN_SECOND; if (hours > 0) { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds); } else { - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dm%ds", minutes, seconds); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dm%ds", minutes, seconds); } } if (status) - win_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", status); + win_vprint(window, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", status); - win_print(window, '-', NULL, NO_DATE, presence_colour, "", ""); + win_print(window, '-', 0, NULL, NO_DATE, presence_colour, "", ""); } @@ -883,7 +883,7 @@ win_print_incoming_message(ProfWin *window, GDateTime *timestamp, { case WIN_CHAT: case WIN_PRIVATE: - win_print(window, '-', timestamp, NO_ME, THEME_TEXT_THEM, from, message); + win_print(window, '-', 0, timestamp, NO_ME, THEME_TEXT_THEM, from, message); break; default: assert(FALSE); @@ -892,31 +892,31 @@ win_print_incoming_message(ProfWin *window, GDateTime *timestamp, } void -win_vprint(ProfWin *window, const char show_char, GDateTime *timestamp, +win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...) { va_list arg; va_start(arg, message); GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, message, arg); - win_print(window, show_char, timestamp, flags, theme_item, from, fmt_msg->str); + win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str); g_string_free(fmt_msg, TRUE); } void -win_print(ProfWin *window, const char show_char, GDateTime *timestamp, +win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message) { if (timestamp == NULL) timestamp = g_date_time_new_now_local(); - buffer_push(window->layout->buffer, show_char, timestamp, flags, theme_item, from, message, NULL); - _win_print(window, show_char, timestamp, flags, theme_item, from, message, NULL); + buffer_push(window->layout->buffer, show_char, pad_indent, timestamp, flags, theme_item, from, message, NULL); + _win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, message, NULL); // TODO: cross-reference.. this should be replaced by a real event-based system ui_input_nonblocking(TRUE); } void -win_print_with_receipt(ProfWin *window, const char show_char, GTimeVal *tstamp, +win_print_with_receipt(ProfWin *window, const char show_char, int pad_indent, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, char *id) { GDateTime *time; @@ -931,8 +931,8 @@ win_print_with_receipt(ProfWin *window, const char show_char, GTimeVal *tstamp, receipt->id = strdup(id); receipt->received = FALSE; - buffer_push(window->layout->buffer, show_char, time, flags, theme_item, from, message, receipt); - _win_print(window, show_char, time, flags, theme_item, from, message, receipt); + buffer_push(window->layout->buffer, show_char, pad_indent, time, flags, theme_item, from, message, receipt); + _win_print(window, show_char, pad_indent, time, flags, theme_item, from, message, receipt); // TODO: cross-reference.. this should be replaced by a real event-based system ui_input_nonblocking(TRUE); } @@ -949,17 +949,17 @@ win_mark_received(ProfWin *window, const char * const id) void win_println(ProfWin *window, const char * const message) { - win_print(window, '-', NULL, 0, 0, "", message); + win_print(window, '-', 0, NULL, 0, 0, "", message); } void win_newline(ProfWin *window) { - win_print(window, '-', NULL, NO_DATE, 0, "", ""); + win_print(window, '-', 0, NULL, NO_DATE, 0, "", ""); } static void -_win_print(ProfWin *window, const char show_char, GDateTime *time, +_win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt) { // flags : 1st bit = 0/1 - me/not me @@ -1028,7 +1028,7 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time, } if (prefs_get_boolean(PREF_WRAP)) { - _win_print_wrapped(window->layout->win, message+offset, indent); + _win_print_wrapped(window->layout->win, message+offset, indent, pad_indent); } else { wprintw(window->layout->win, "%s", message+offset); } @@ -1058,23 +1058,29 @@ _win_indent(WINDOW *win, int size) } static void -_win_print_wrapped(WINDOW *win, const char * const message, size_t indent) +_win_print_wrapped(WINDOW *win, const char * const message, size_t indent, int pad_indent) { + int starty = getcury(win); int wordi = 0; char *word = malloc(strlen(message) + 1); gchar *curr_ch = g_utf8_offset_to_pointer(message, 0); while (*curr_ch != '\0') { + + // handle space if (*curr_ch == ' ') { waddch(win, ' '); curr_ch = g_utf8_next_char(curr_ch); + + // handle newline } else if (*curr_ch == '\n') { waddch(win, '\n'); - _win_indent(win, indent); + _win_indent(win, indent + pad_indent); curr_ch = g_utf8_next_char(curr_ch); + + // handle word } else { - // get word wordi = 0; while (*curr_ch != ' ' && *curr_ch != '\n' && *curr_ch != '\0') { size_t ch_len = mbrlen(curr_ch, 4, NULL); @@ -1087,23 +1093,33 @@ _win_print_wrapped(WINDOW *win, const char * const message, size_t indent) word[wordi] = '\0'; int curx = getcurx(win); + int cury = getcury(win); int maxx = getmaxx(win); + gboolean firstline = (cury == starty); // word larger than line - if (utf8_display_len(word) > (maxx - indent)) { + if ((firstline && (utf8_display_len(word) > (maxx - indent))) || + (!firstline && (utf8_display_len(word) > (maxx - (indent + pad_indent))))) { + gchar *word_ch = g_utf8_offset_to_pointer(word, 0); while(*word_ch != '\0') { curx = getcurx(win); - if (curx < indent) { + cury = getcury(win); + firstline = cury == starty; + + if (firstline && curx < indent) { _win_indent(win, indent); } + if (!firstline && curx < (indent + pad_indent)) { + _win_indent(win, indent + pad_indent); + } gchar copy[wordi++]; g_utf8_strncpy(copy, word_ch, 1); if (curx + utf8_display_len(copy) > maxx) { waddch(win, '\n'); - _win_indent(win, indent); + _win_indent(win, indent + pad_indent); } waddstr(win, copy); @@ -1112,14 +1128,26 @@ _win_print_wrapped(WINDOW *win, const char * const message, size_t indent) } else { if (curx + utf8_display_len(word) > maxx) { waddch(win, '\n'); - _win_indent(win, indent); + _win_indent(win, indent + pad_indent); } - if (curx < indent) { + if (firstline && curx < indent) { _win_indent(win, indent); } + if (!firstline && curx < (indent + pad_indent)) { + _win_indent(win, indent + pad_indent); + } wprintw(win, "%s", word); } } + + // consume first space of next line + int curx = getcurx(win); + int cury = getcury(win); + gboolean firstline = (cury == starty); + + if (!firstline && curx == 0 && *curr_ch == ' ') { + curr_ch = g_utf8_next_char(curr_ch); + } } free(word); @@ -1134,7 +1162,7 @@ win_redraw(ProfWin *window) for (i = 0; i < size; i++) { ProfBuffEntry *e = buffer_yield_entry(window->layout->buffer, i); - _win_print(window, e->show_char, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt); + _win_print(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt); } } diff --git a/src/ui/window.h b/src/ui/window.h index 35f82f1c..64989e4c 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -61,7 +61,7 @@ void win_show_status_string(ProfWin *window, const char * const from, const char * const default_show); void win_print_incoming_message(ProfWin *window, GDateTime *timestamp, const char * const from, const char * const message); -void win_print_with_receipt(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, +void win_print_with_receipt(ProfWin *window, const char show_char, int pad_indent, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, char *id); void win_newline(ProfWin *window); void win_redraw(ProfWin *window); diff --git a/src/window_list.c b/src/window_list.c index 2892cc53..a300bd82 100644 --- a/src/window_list.c +++ b/src/window_list.c @@ -497,7 +497,7 @@ wins_lost_connection(void) while (curr) { ProfWin *window = curr->data; if (window->type != WIN_CONSOLE) { - win_print(window, '-', NULL, 0, THEME_ERROR, "", "Lost connection."); + win_print(window, '-', 0, NULL, 0, THEME_ERROR, "", "Lost connection."); // if current win, set current_win_dirty if (wins_is_current(window)) { diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index efe70d62..59e2ac9f 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -539,8 +539,8 @@ void win_hide_subwin(ProfWin *window) {} void win_show_subwin(ProfWin *window) {} void win_refresh_without_subwin(ProfWin *window) {} void win_refresh_with_subwin(ProfWin *window) {} -void win_print(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message) {} -void win_vprint(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...) {} +void win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message) {} +void win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...) {} char* win_get_title(ProfWin *window) { return NULL; |