diff options
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c index d3279a01..1a0596b6 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -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_invite(gchar **args, struct cmd_help_t help); static gboolean _cmd_rooms(gchar **args, struct cmd_help_t help); static gboolean _cmd_disco(gchar **args, struct cmd_help_t help); static gboolean _cmd_set_beep(gchar **args, struct cmd_help_t help); @@ -338,6 +339,16 @@ static struct cmd_t main_commands[] = "Example : /join jdev (as user@jabber.org will join jdev@conference.jabber.org)", NULL } } }, + { "/invite", + _cmd_invite, parse_args_with_freetext, 1, 2, + { "/invite jid [message]", "Invite contact to chat room.", + { "/invite jid [message]", + "--------------------------", + "Send a direct invite to the specified contact to the current chat room.", + "The jid must be a contact in your roster.", + "If a message is supplied it will be send as the reason for the invite.", + NULL } } }, + { "/rooms", _cmd_rooms, parse_args, 0, 1, { "/rooms [conference-service]", "List chat rooms.", @@ -1079,6 +1090,8 @@ _cmd_complete_parameters(char *input, int *size) contact_list_find_resource); } + _parameter_autocomplete(input, size, "/invite", contact_list_find_contact); + _parameter_autocomplete(input, size, "/connect", accounts_find_enabled); _parameter_autocomplete_with_ac(input, size, "/sub", sub_ac); @@ -2123,6 +2136,37 @@ _cmd_join(gchar **args, struct cmd_help_t help) } static gboolean +_cmd_invite(gchar **args, struct cmd_help_t help) +{ + char *contact = args[0]; + char *reason = args[1]; + char *room = NULL; + jabber_conn_status_t conn_status = jabber_get_connection_status(); + + if (conn_status != JABBER_CONNECTED) { + cons_show("You are not currently connected."); + return TRUE; + } + + if (!win_current_is_groupchat()) { + cons_show("You must be in a chat room to send an invite."); + return TRUE; + } + + room = win_current_get_recipient(); + message_send_invite(room, contact, reason); + if (reason != NULL) { + cons_show("Room invite sent, contact: %s, room: %s, reason: \"%s\".", + contact, room, reason); + } else { + cons_show("Room invite sent, contact: %s, room: %s.", + contact, room); + } + + return TRUE; +} + +static gboolean _cmd_rooms(gchar **args, struct cmd_help_t help) { jabber_conn_status_t conn_status = jabber_get_connection_status(); |