Added _who_roster function
This commit is contained in:
@@ -62,6 +62,7 @@ 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);
|
static void _who_room(const char * const presence);
|
||||||
|
static void _who_roster(const char * const group, const char * const presence);
|
||||||
|
|
||||||
extern GHashTable *commands;
|
extern GHashTable *commands;
|
||||||
|
|
||||||
@@ -794,43 +795,9 @@ _who_room(const char * const presence)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static void
|
||||||
cmd_who(gchar **args, struct cmd_help_t help)
|
_who_roster(const char * const group, 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);
|
|
||||||
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
cons_show("");
|
cons_show("");
|
||||||
GSList *list = NULL;
|
GSList *list = NULL;
|
||||||
if (group != NULL) {
|
if (group != NULL) {
|
||||||
@@ -998,6 +965,46 @@ cmd_who(gchar **args, struct cmd_help_t help)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_who_roster(group, presence);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user