mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-27 19:16:21 +00:00
Command /info parameter optional when in chat or private chat
Recipient is used.
This commit is contained in:
@@ -255,11 +255,12 @@ static struct cmd_t main_commands[] =
|
|||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/info",
|
{ "/info",
|
||||||
_cmd_info, parse_args, 1, 1,
|
_cmd_info, parse_args, 0, 1,
|
||||||
{ "/info jid|nick", "Find out a contacts presence information.",
|
{ "/info [jid|nick]", "Find out a contacts presence information.",
|
||||||
{ "/info jid|nick",
|
{ "/info [jid|nick]",
|
||||||
"--------------",
|
"----------------",
|
||||||
"Find out a contact, or room members presence information.",
|
"Find out a contact, or room members presence information.",
|
||||||
|
"If in a chat window the parameter is not required, the current recipient will be used.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/join",
|
{ "/join",
|
||||||
@@ -1672,9 +1673,29 @@ _cmd_info(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show("You are not currently connected.");
|
cons_show("You are not currently connected.");
|
||||||
} else {
|
} else {
|
||||||
if (win_current_is_groupchat()) {
|
if (win_current_is_groupchat()) {
|
||||||
win_show_status(usr);
|
if (usr != NULL) {
|
||||||
|
win_room_show_status(usr);
|
||||||
|
} else {
|
||||||
|
win_current_show("You must specify a nickname.");
|
||||||
|
}
|
||||||
|
} else if (win_current_is_chat()) {
|
||||||
|
if (usr != NULL) {
|
||||||
|
win_current_show("No parameter required when in chat.");
|
||||||
|
} else {
|
||||||
|
win_show_status();
|
||||||
|
}
|
||||||
|
} else if (win_current_is_private()) {
|
||||||
|
if (usr != NULL) {
|
||||||
|
win_current_show("No parameter required when in chat.");
|
||||||
|
} else {
|
||||||
|
win_private_show_status();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cons_show_status(usr);
|
if (usr != NULL) {
|
||||||
|
cons_show_status(usr);
|
||||||
|
} else {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
src/ui.h
4
src/ui.h
@@ -132,7 +132,9 @@ void win_show_room_member_nick_change(const char * const room,
|
|||||||
void win_show_room_nick_change(const char * const room, const char * const nick);
|
void win_show_room_nick_change(const char * const room, const char * const nick);
|
||||||
void win_show_room_member_presence(const char * const room,
|
void win_show_room_member_presence(const char * const room,
|
||||||
const char * const nick, const char * const show, const char * const status);
|
const char * const nick, const char * const show, const char * const status);
|
||||||
void win_show_status(const char * const contact);
|
void win_room_show_status(const char * const contact);
|
||||||
|
void win_show_status(void);
|
||||||
|
void win_private_show_status(void);
|
||||||
|
|
||||||
// console window actions
|
// console window actions
|
||||||
void cons_about(void);
|
void cons_about(void);
|
||||||
|
|||||||
@@ -1184,7 +1184,36 @@ cons_show_status(const char * const contact)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_show_status(const char * const contact)
|
win_show_status(void)
|
||||||
|
{
|
||||||
|
char *recipient = win_current_get_recipient();
|
||||||
|
PContact pcontact = contact_list_get_contact(recipient);
|
||||||
|
|
||||||
|
if (pcontact != NULL) {
|
||||||
|
_win_show_contact(current, pcontact);
|
||||||
|
} else {
|
||||||
|
win_current_show("Error getting contact info.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_private_show_status(void)
|
||||||
|
{
|
||||||
|
Jid *jid = jid_create(win_current_get_recipient());
|
||||||
|
|
||||||
|
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||||
|
|
||||||
|
if (pcontact != NULL) {
|
||||||
|
_win_show_contact(current, pcontact);
|
||||||
|
} else {
|
||||||
|
win_current_show("Error getting contact info.");
|
||||||
|
}
|
||||||
|
|
||||||
|
jid_destroy(jid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_room_show_status(const char * const contact)
|
||||||
{
|
{
|
||||||
PContact pcontact = muc_get_participant(win_current_get_recipient(), contact);
|
PContact pcontact = muc_get_participant(win_current_get_recipient(), contact);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user