mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added /occupants commands, unfinished
This commit is contained in:
parent
f6e0a219ff
commit
778a495fbd
@ -317,6 +317,15 @@ static struct cmd_t command_defs[] =
|
|||||||
"info - Show room details.",
|
"info - Show room details.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
|
{ "/occupants",
|
||||||
|
cmd_occupants, parse_args, 1, 1, NULL,
|
||||||
|
{ "/occupants show|hide", "Room configuration.",
|
||||||
|
{ "/occupants show|hide",
|
||||||
|
"--------------------",
|
||||||
|
"show - Show the occupants panel in chat rooms.",
|
||||||
|
"hide - Hide the occupants panel in chat rooms.",
|
||||||
|
NULL } } },
|
||||||
|
|
||||||
{ "/form",
|
{ "/form",
|
||||||
cmd_form, parse_args, 1, 3, NULL,
|
cmd_form, parse_args, 1, 3, NULL,
|
||||||
{ "/form show|submit|cancel|set|add|remove|help [tag] [value]", "Form manipulation.",
|
{ "/form show|submit|cancel|set|add|remove|help [tag] [value]", "Form manipulation.",
|
||||||
|
@ -2326,6 +2326,35 @@ cmd_room(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
cmd_occupants(gchar **args, struct cmd_help_t help)
|
||||||
|
{
|
||||||
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
|
|
||||||
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
|
cons_show("You are not currently connected.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
win_type_t win_type = ui_current_win_type();
|
||||||
|
if (win_type != WIN_MUC) {
|
||||||
|
cons_show("Command '/occupants' does not apply to this window.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *room = ui_current_recipient();
|
||||||
|
|
||||||
|
if (g_strcmp0(args[0], "show") == 0) {
|
||||||
|
ui_room_show_occupants(room);
|
||||||
|
} else if (g_strcmp0(args[0], "hide") == 0) {
|
||||||
|
ui_room_hide_occupants(room);
|
||||||
|
} else {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_rooms(gchar **args, struct cmd_help_t help)
|
cmd_rooms(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
|
@ -126,5 +126,6 @@ gboolean cmd_alias(gchar **args, struct cmd_help_t help);
|
|||||||
gboolean cmd_xmlconsole(gchar **args, struct cmd_help_t help);
|
gboolean cmd_xmlconsole(gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_ping(gchar **args, struct cmd_help_t help);
|
gboolean cmd_ping(gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_form(gchar **args, struct cmd_help_t help);
|
gboolean cmd_form(gchar **args, struct cmd_help_t help);
|
||||||
|
gboolean cmd_occupants(gchar **args, struct cmd_help_t help);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2721,7 +2721,7 @@ static void
|
|||||||
_ui_muc_roster(const char * const room)
|
_ui_muc_roster(const char * const room)
|
||||||
{
|
{
|
||||||
ProfWin *window = wins_get_by_recipient(room);
|
ProfWin *window = wins_get_by_recipient(room);
|
||||||
if (room) {
|
if (window) {
|
||||||
GList *roster = muc_roster(room);
|
GList *roster = muc_roster(room);
|
||||||
if (roster) {
|
if (roster) {
|
||||||
werase(window->subwin);
|
werase(window->subwin);
|
||||||
@ -2783,6 +2783,24 @@ _ui_muc_roster(const char * const room)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ui_room_show_occupants(const char * const room)
|
||||||
|
{
|
||||||
|
ProfWin *window = wins_get_by_recipient(room);
|
||||||
|
if (window && !window->subwin) {
|
||||||
|
cons_debug("Showing occupants");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ui_room_hide_occupants(const char * const room)
|
||||||
|
{
|
||||||
|
ProfWin *window = wins_get_by_recipient(room);
|
||||||
|
if (window && window->subwin) {
|
||||||
|
cons_debug("Hiding occupants");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_win_handle_switch(const wint_t * const ch)
|
_win_handle_switch(const wint_t * const ch)
|
||||||
{
|
{
|
||||||
@ -3079,5 +3097,7 @@ ui_init_module(void)
|
|||||||
ui_handle_room_role_list_error = _ui_handle_room_role_list_error;
|
ui_handle_room_role_list_error = _ui_handle_room_role_list_error;
|
||||||
ui_handle_room_role_list = _ui_handle_room_role_list;
|
ui_handle_room_role_list = _ui_handle_room_role_list;
|
||||||
ui_muc_roster = _ui_muc_roster;
|
ui_muc_roster = _ui_muc_roster;
|
||||||
|
ui_room_show_occupants = _ui_room_show_occupants;
|
||||||
|
ui_room_hide_occupants = _ui_room_hide_occupants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +162,8 @@ void (*ui_room_member_nick_change)(const char * const room,
|
|||||||
void (*ui_room_nick_change)(const char * const room, const char * const nick);
|
void (*ui_room_nick_change)(const char * const room, const char * const nick);
|
||||||
void (*ui_room_member_presence)(const char * const room,
|
void (*ui_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 (*ui_room_show_occupants)(const char * const room);
|
||||||
|
void (*ui_room_hide_occupants)(const char * const room);
|
||||||
void (*ui_roster_add)(const char * const barejid, const char * const name);
|
void (*ui_roster_add)(const char * const barejid, const char * const name);
|
||||||
void (*ui_roster_remove)(const char * const barejid);
|
void (*ui_roster_remove)(const char * const barejid);
|
||||||
void (*ui_contact_already_in_group)(const char * const contact, const char * const group);
|
void (*ui_contact_already_in_group)(const char * const contact, const char * const group);
|
||||||
|
Loading…
Reference in New Issue
Block a user