mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Show info in chat and private chat windows
This commit is contained in:
parent
c65b43f081
commit
1925cb80ec
@ -1402,28 +1402,16 @@ cmd_info(gchar **args, struct cmd_help_t help)
|
||||
break;
|
||||
case WIN_CHAT:
|
||||
if (usr != NULL) {
|
||||
cons_show("No parameter required for /info in chat.");
|
||||
ui_current_print_line("No parameter required when in chat.");
|
||||
} else {
|
||||
pcontact = roster_get_contact(recipient);
|
||||
if (pcontact != NULL) {
|
||||
cons_show_info(pcontact);
|
||||
} else {
|
||||
cons_show("No such contact \"%s\" in roster.", recipient);
|
||||
}
|
||||
ui_info();
|
||||
}
|
||||
break;
|
||||
case WIN_PRIVATE:
|
||||
if (usr != NULL) {
|
||||
ui_current_print_line("No parameter required when in chat.");
|
||||
} else {
|
||||
Jid *jid = jid_create(recipient);
|
||||
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||
if (pcontact != NULL) {
|
||||
cons_show_info(pcontact);
|
||||
} else {
|
||||
cons_show("No such participant \"%s\" in room.", jid->resourcepart);
|
||||
}
|
||||
jid_destroy(jid);
|
||||
ui_info_private();
|
||||
}
|
||||
break;
|
||||
case WIN_CONSOLE:
|
||||
|
@ -1804,6 +1804,20 @@ _ui_status(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_info(void)
|
||||
{
|
||||
char *recipient = ui_current_recipient();
|
||||
PContact pcontact = roster_get_contact(recipient);
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
win_show_info(current, pcontact);
|
||||
} else {
|
||||
win_print_line(current, '-', 0, "Error getting contact info.");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_status_private(void)
|
||||
{
|
||||
@ -1820,6 +1834,22 @@ _ui_status_private(void)
|
||||
jid_destroy(jid);
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_info_private(void)
|
||||
{
|
||||
Jid *jid = jid_create(ui_current_recipient());
|
||||
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
win_show_info(current, pcontact);
|
||||
} else {
|
||||
win_print_line(current, '-', 0, "Error getting contact info.");
|
||||
}
|
||||
|
||||
jid_destroy(jid);
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_status_room(const char * const contact)
|
||||
{
|
||||
@ -2172,7 +2202,9 @@ ui_init_module(void)
|
||||
ui_room_subject = _ui_room_subject;
|
||||
ui_room_broadcast = _ui_room_broadcast;
|
||||
ui_status = _ui_status;
|
||||
ui_info = _ui_info;
|
||||
ui_status_private = _ui_status_private;
|
||||
ui_info_private = _ui_info_private;
|
||||
ui_status_room = _ui_status_room;
|
||||
ui_info_room = _ui_info_room;
|
||||
ui_unread = _ui_unread;
|
||||
|
@ -153,7 +153,9 @@ void (*ui_handle_room_join_error)(const char * const room, const char * const er
|
||||
void (*ui_status_room)(const char * const contact);
|
||||
void (*ui_info_room)(const char * const contact);
|
||||
void (*ui_status)(void);
|
||||
void (*ui_info)(void);
|
||||
void (*ui_status_private)(void);
|
||||
void (*ui_info_private)(void);
|
||||
|
||||
void (*ui_create_duck_win)(void);
|
||||
void (*ui_open_duck_win)(void);
|
||||
|
Loading…
Reference in New Issue
Block a user