mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-08-01 08:36:21 +00:00
Added _who_room function
This commit is contained in:
@@ -61,6 +61,7 @@ static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
|
|||||||
static int _strtoi(char *str, int *saveptr, int min, int max);
|
static int _strtoi(char *str, int *saveptr, int min, int max);
|
||||||
static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
|
static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
|
||||||
static gint _compare_commands(Command *a, Command *b);
|
static gint _compare_commands(Command *a, Command *b);
|
||||||
|
static void _who_room(const char * const presence);
|
||||||
|
|
||||||
extern GHashTable *commands;
|
extern GHashTable *commands;
|
||||||
|
|
||||||
@@ -711,42 +712,9 @@ cmd_theme(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static void
|
||||||
cmd_who(gchar **args, struct cmd_help_t help)
|
_who_room(const char * const presence)
|
||||||
{
|
{
|
||||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
|
||||||
win_type_t win_type = ui_current_win_type();
|
|
||||||
|
|
||||||
if (conn_status != JABBER_CONNECTED) {
|
|
||||||
cons_show("You are not currently connected.");
|
|
||||||
} else {
|
|
||||||
char *presence = args[0];
|
|
||||||
char *group = NULL;
|
|
||||||
if ((g_strv_length(args) == 2) && (args[1] != NULL)) {
|
|
||||||
group = args[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// bad arg
|
|
||||||
if ((presence != NULL)
|
|
||||||
&& (strcmp(presence, "online") != 0)
|
|
||||||
&& (strcmp(presence, "available") != 0)
|
|
||||||
&& (strcmp(presence, "unavailable") != 0)
|
|
||||||
&& (strcmp(presence, "offline") != 0)
|
|
||||||
&& (strcmp(presence, "away") != 0)
|
|
||||||
&& (strcmp(presence, "chat") != 0)
|
|
||||||
&& (strcmp(presence, "xa") != 0)
|
|
||||||
&& (strcmp(presence, "dnd") != 0)
|
|
||||||
&& (strcmp(presence, "any") != 0)) {
|
|
||||||
cons_show("Usage: %s", help.usage);
|
|
||||||
|
|
||||||
// valid arg
|
|
||||||
} else {
|
|
||||||
if (win_type == WIN_MUC) {
|
|
||||||
if (group != NULL) {
|
|
||||||
cons_show("The group argument is not valid when in a chat room.");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *room = ui_current_recipient();
|
char *room = ui_current_recipient();
|
||||||
GList *list = muc_get_roster(room);
|
GList *list = muc_get_roster(room);
|
||||||
|
|
||||||
@@ -824,8 +792,44 @@ cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
ui_room_roster(room, filtered, presence);
|
ui_room_roster(room, filtered, presence);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
cmd_who(gchar **args, struct cmd_help_t help)
|
||||||
|
{
|
||||||
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
|
win_type_t win_type = ui_current_win_type();
|
||||||
|
|
||||||
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
|
cons_show("You are not currently connected.");
|
||||||
|
} else {
|
||||||
|
char *presence = args[0];
|
||||||
|
char *group = NULL;
|
||||||
|
if ((g_strv_length(args) == 2) && (args[1] != NULL)) {
|
||||||
|
group = args[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// bad arg
|
||||||
|
if ((presence != NULL)
|
||||||
|
&& (strcmp(presence, "online") != 0)
|
||||||
|
&& (strcmp(presence, "available") != 0)
|
||||||
|
&& (strcmp(presence, "unavailable") != 0)
|
||||||
|
&& (strcmp(presence, "offline") != 0)
|
||||||
|
&& (strcmp(presence, "away") != 0)
|
||||||
|
&& (strcmp(presence, "chat") != 0)
|
||||||
|
&& (strcmp(presence, "xa") != 0)
|
||||||
|
&& (strcmp(presence, "dnd") != 0)
|
||||||
|
&& (strcmp(presence, "any") != 0)) {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (win_type == WIN_MUC) {
|
||||||
|
if (group != NULL) {
|
||||||
|
cons_show("The group argument is not valid when in a chat room.");
|
||||||
|
} else {
|
||||||
|
_who_room(presence);
|
||||||
|
}
|
||||||
|
|
||||||
// not in groupchat window
|
|
||||||
} else {
|
} else {
|
||||||
cons_show("");
|
cons_show("");
|
||||||
GSList *list = NULL;
|
GSList *list = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user