mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Use helper function for cmd_status
This commit is contained in:
parent
b961ad29c7
commit
a4e9d9b9e2
@ -3216,6 +3216,16 @@ cmd_resource(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cmd_status_show_status(char* usr)
|
||||||
|
{
|
||||||
|
char *usr_jid = roster_barejid_from_name(usr);
|
||||||
|
if (usr_jid == NULL) {
|
||||||
|
usr_jid = usr;
|
||||||
|
}
|
||||||
|
cons_show_status(usr_jid);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_status(ProfWin *window, const char *const command, gchar **args)
|
cmd_status(ProfWin *window, const char *const command, gchar **args)
|
||||||
{
|
{
|
||||||
@ -3246,11 +3256,7 @@ cmd_status(ProfWin *window, const char *const command, gchar **args)
|
|||||||
break;
|
break;
|
||||||
case WIN_CHAT:
|
case WIN_CHAT:
|
||||||
if (usr) {
|
if (usr) {
|
||||||
char *usr_jid = roster_barejid_from_name(usr);
|
_cmd_status_show_status(usr);
|
||||||
if (usr_jid == NULL) {
|
|
||||||
usr_jid = usr;
|
|
||||||
}
|
|
||||||
cons_show_status(usr_jid);
|
|
||||||
} else {
|
} else {
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
@ -3264,11 +3270,7 @@ cmd_status(ProfWin *window, const char *const command, gchar **args)
|
|||||||
break;
|
break;
|
||||||
case WIN_PRIVATE:
|
case WIN_PRIVATE:
|
||||||
if (usr) {
|
if (usr) {
|
||||||
char *usr_jid = roster_barejid_from_name(usr);
|
_cmd_status_show_status(usr);
|
||||||
if (usr_jid == NULL) {
|
|
||||||
usr_jid = usr;
|
|
||||||
}
|
|
||||||
cons_show_status(usr_jid);
|
|
||||||
} else {
|
} else {
|
||||||
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
@ -3284,11 +3286,7 @@ cmd_status(ProfWin *window, const char *const command, gchar **args)
|
|||||||
break;
|
break;
|
||||||
case WIN_CONSOLE:
|
case WIN_CONSOLE:
|
||||||
if (usr) {
|
if (usr) {
|
||||||
char *usr_jid = roster_barejid_from_name(usr);
|
_cmd_status_show_status(usr);
|
||||||
if (usr_jid == NULL) {
|
|
||||||
usr_jid = usr;
|
|
||||||
}
|
|
||||||
cons_show_status(usr_jid);
|
|
||||||
} else {
|
} else {
|
||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user