diff options
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index b9d2bee4..4a922c59 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -126,6 +126,23 @@ win_presence_colour(const char * const presence) } void +win_show_occupant(ProfWin *window, Occupant *occupant) +{ + const char *presence_str = string_from_resource_presence(occupant->presence); + + 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); + + if (occupant->status) { + win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", occupant->status); + } + + win_save_print(window, '-', NULL, NO_DATE, presence_colour, "", ""); +} + +void win_show_contact(ProfWin *window, PContact contact) { const char *barejid = p_contact_barejid(contact); @@ -170,6 +187,70 @@ win_show_contact(ProfWin *window, PContact contact) } void +win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant) +{ + const char *presence_str = string_from_resource_presence(occupant->presence); + + 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); + + if (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); + + Jid *jidp = jid_create_from_bare_and_resource(room, occupant->nick); + Capabilities *caps = caps_lookup(jidp->fulljid); + + if (caps) { + // show identity + if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) { + 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); + 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); + if (caps->category != NULL) { + 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_newline(window); + } + if (caps->software != NULL) { + 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); + } + 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); + } + if (caps->os_version != NULL) { + 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); + } +} + +void win_show_info(ProfWin *window, PContact contact) { const char *barejid = p_contact_barejid(contact); |