mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 22:16:22 +00:00
Added basic /rooms command to get chat room list
This commit is contained in:
@@ -101,6 +101,7 @@ static gboolean _cmd_tiny(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_close(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_clear(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_join(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_rooms(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_beep(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_notify(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_log(gchar **args, struct cmd_help_t help);
|
||||
@@ -334,6 +335,19 @@ static struct cmd_t main_commands[] =
|
||||
"Example : /join jdev@conference.jabber.org mynick",
|
||||
NULL } } },
|
||||
|
||||
{ "/rooms",
|
||||
_cmd_rooms, parse_args, 0, 1,
|
||||
{ "/rooms [conference-node]", "List chat rooms.",
|
||||
{ "/rooms [conference-node]",
|
||||
"------------------------",
|
||||
"List the chat rooms available at the specified conference node",
|
||||
"If no argument is supplied, the domainpart of the current logged in JID is used,",
|
||||
"with a prefix of 'conference'.",
|
||||
"",
|
||||
"Example : /rooms conference.jabber.org",
|
||||
"Example : /rooms (if logged in as me@server.org, is equivalent to /rooms conference.server.org)",
|
||||
NULL } } },
|
||||
|
||||
{ "/nick",
|
||||
_cmd_nick, parse_args_with_freetext, 1, 1,
|
||||
{ "/nick nickname", "Change nickname in chat room.",
|
||||
@@ -2057,6 +2071,29 @@ _cmd_join(gchar **args, struct cmd_help_t help)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_rooms(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 currenlty connect.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (args[0] == NULL) {
|
||||
Jid *jid = jid_create(jabber_get_jid());
|
||||
GString *conference_node = g_string_new("conference.");
|
||||
g_string_append(conference_node, jid->domainpart);
|
||||
iq_room_list_request(conference_node->str);
|
||||
g_string_free(conference_node, TRUE);
|
||||
} else {
|
||||
iq_room_list_request(args[0]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_nick(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user