diff options
-rw-r--r-- | src/command/commands.c | 5 | ||||
-rw-r--r-- | src/muc.c | 12 | ||||
-rw-r--r-- | src/muc.h | 2 | ||||
-rw-r--r-- | src/ui/window.c | 32 |
4 files changed, 37 insertions, 14 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index 2b8a0d2c..65759c0a 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2080,7 +2080,10 @@ cmd_room(gchar **args, struct cmd_help_t help) if (g_strcmp0(args[0], "info") == 0) { char *role = muc_role_str(room); char *affiliation = muc_affiliation_str(room); - ui_current_print_line("Affiliation: %s, Role: %s", affiliation, role); + win_save_print(window, '-', NULL, 0, 0, "", ""); + win_save_vprint(window, '!', NULL, 0, 0, "", "Affiliation: %s", affiliation); + win_save_vprint(window, '!', NULL, 0, 0, "", "Role: %s", role); + win_save_print(window, '-', NULL, 0, 0, "", ""); return TRUE; } diff --git a/src/muc.c b/src/muc.c index 6c48f342..ec9c9bfe 100644 --- a/src/muc.c +++ b/src/muc.c @@ -507,6 +507,18 @@ muc_occupant_available(Occupant *occupant) return (occupant->presence == RESOURCE_ONLINE || occupant->presence == RESOURCE_CHAT); } +const char * +muc_occupant_affiliation_str(Occupant *occupant) +{ + return _affiliation_to_string(occupant->affiliation); +} + +const char * +muc_occupant_role_str(Occupant *occupant) +{ + return _role_to_string(occupant->role); +} + /* * Remove the old_nick from the roster, and flag that a pending nickname change * is in progress diff --git a/src/muc.h b/src/muc.h index 3bf836ee..7a25e87c 100644 --- a/src/muc.h +++ b/src/muc.h @@ -95,6 +95,8 @@ Autocomplete muc_roster_ac(const char * const room); Occupant* muc_roster_item(const char * const room, const char * const nick); gboolean muc_occupant_available(Occupant *occupant); +const char * muc_occupant_affiliation_str(Occupant *occupant); +const char * muc_occupant_role_str(Occupant *occupant); void muc_roster_nick_change_start(const char * const room, const char * const new_nick, const char * const old_nick); char* muc_roster_nick_change_complete(const char * const room, const char * const nick); diff --git a/src/ui/window.c b/src/ui/window.c index 4a922c59..ace6e8aa 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -190,19 +190,23 @@ void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant) { const char *presence_str = string_from_resource_presence(occupant->presence); + const char *occupant_affiliation = muc_occupant_affiliation_str(occupant); + const char *occupant_role = muc_occupant_role_str(occupant); int presence_colour = win_presence_colour(presence_str); - win_save_print(window, '-', NULL, NO_EOL, presence_colour, "", occupant->nick); - win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); + win_save_print(window, '-', NULL, 0, 0, "", ""); + win_save_print(window, '!', NULL, NO_EOL, presence_colour, "", occupant->nick); + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence_str); if (occupant->status) { - win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", occupant->status); + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", occupant->status); } win_save_newline(window); - win_save_vprint(window, '-', NULL, NO_DATE, 0, "", "Role: %s, Affiliation: %s", occupant->role, occupant->affiliation); + win_save_vprint(window, '!', NULL, 0, 0, "", " Affiliation: %s", occupant_affiliation); + win_save_vprint(window, '!', NULL, 0, 0, "", " Role: %s", occupant_role); Jid *jidp = jid_create_from_bare_and_resource(room, occupant->nick); Capabilities *caps = caps_lookup(jidp->fulljid); @@ -210,44 +214,46 @@ win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occup if (caps) { // show identity if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) { - win_save_print(window, '-', NULL, NO_EOL, 0, "", " Identity: "); + win_save_print(window, '!', NULL, NO_EOL, 0, "", " Identity: "); if (caps->name != NULL) { - win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name); + win_save_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->name); if ((caps->category != NULL) || (caps->type != NULL)) { win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->type != NULL) { - win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type); + win_save_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->type); if (caps->category != NULL) { - win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " "); + win_save_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", " "); } } if (caps->category != NULL) { - win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category); + win_save_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", caps->category); } win_save_newline(window); } if (caps->software != NULL) { - win_save_vprint(window, '-', NULL, NO_EOL, 0, "", " Software: %s", caps->software); + win_save_vprint(window, '!', NULL, NO_EOL, 0, "", " Software: %s", caps->software); } if (caps->software_version != NULL) { - win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version); } if ((caps->software != NULL) || (caps->software_version != NULL)) { win_save_newline(window); } if (caps->os != NULL) { - win_save_vprint(window, '-', NULL, NO_EOL, 0, "", " OS: %s", caps->os); + win_save_vprint(window, '!', NULL, NO_EOL, 0, "", " OS: %s", caps->os); } if (caps->os_version != NULL) { - win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version); } if ((caps->os != NULL) || (caps->os_version != NULL)) { win_save_newline(window); } caps_destroy(caps); } + + win_save_print(window, '-', NULL, 0, 0, "", ""); } void |