- out:
- silc_client_command_free(cmd);
-}
-
-/*
- * Local commands
- */
-
-/* HELP command. This is local command and shows help on SILC */
-
-SILC_CLIENT_CMD_FUNC(help)
-{
-
-}
-
-/* CLEAR command. This is local command and clears current output window */
-
-SILC_CLIENT_CMD_FUNC(clear)
-{
- SilcClientCommandContext cmd = (SilcClientCommandContext)context;
- SilcClient client = cmd->client;
-
- assert(client->current_win != NULL);
- wclear((WINDOW *)client->current_win->screen);
- wrefresh((WINDOW *)client->current_win->screen);
-
- silc_client_command_free(cmd);
-}
-
-/* VERSION command. This is local command and shows version of the client */
-
-SILC_CLIENT_CMD_FUNC(version)
-{
- SilcClientCommandContext cmd = (SilcClientCommandContext)context;
- SilcClient client = cmd->client;
- extern char *silc_version;
- extern char *silc_name;
- extern char *silc_fullname;
-
- silc_say(client, "%s (%s) version %s", silc_name, silc_fullname,
- silc_version);
-
- silc_client_command_free(cmd);
-}
-
-/* Command MSG. Sends private message to user or list of users. Note that
- private messages are not really commands, they are message packets,
- however, on user interface it is convenient to show them as commands
- as that is the common way of sending private messages (like in IRC). */
-/* XXX supports only one destination */
-
-SILC_CLIENT_CMD_FUNC(msg)
-{
- SilcClientCommandContext cmd = (SilcClientCommandContext)context;
- SilcClientWindow win = NULL;
- SilcClient client = cmd->client;
- SilcClientEntry client_entry = NULL;
- unsigned int num = 0;
- char *nickname = NULL, *server = NULL;
-
- if (cmd->argc < 3) {
- silc_say(cmd->client, "Usage: /MSG <nickname> <message>");
- goto out;
- }
-
- if (!cmd->client->current_win->sock) {
- SILC_NOT_CONNECTED(cmd->client);
- goto out;
- }
-
- win = (SilcClientWindow)cmd->sock->user_data;
-
- /* Parse the typed nickname. */
- if (!silc_client_parse_nickname(cmd->argv[1], &nickname, &server, &num)) {
- silc_say(cmd->client, "Bad nickname");
- goto out;
- }
-
- /* Find client entry */
- client_entry = silc_idlist_get_client(client, win, nickname, server, num);
- if (!client_entry) {
- /* Client entry not found, it was requested thus mark this to be
- pending command. */
- silc_client_command_pending(SILC_COMMAND_IDENTIFY,
- silc_client_command_msg, context);
- return;
- }
-
- /* Display the message for our eyes. */
- silc_print(client, "-> *%s* %s", cmd->argv[1], cmd->argv[2]);
-
- /* Send the private message */
- silc_client_packet_send_private_message(client, cmd->sock, client_entry,
- cmd->argv[2], cmd->argv_lens[2],
- TRUE);
-
- out:
- silc_client_command_free(cmd);
-}
-
-/* Local command AWAY. Client replies with away message to whomever sends
- private message to the client if the away message is set. If this is
- given without arguments the away message is removed. */
-
-SILC_CLIENT_CMD_FUNC(away)
-{
- SilcClientCommandContext cmd = (SilcClientCommandContext)context;
- SilcClientWindow win = NULL;
- SilcClient client = cmd->client;
-
- if (!cmd->client->current_win->sock) {
- SILC_NOT_CONNECTED(cmd->client);
- goto out;
- }
-
- win = (SilcClientWindow)cmd->sock->user_data;
-
- if (cmd->argc == 1) {
- if (win->away) {
- silc_free(win->away->away);
- silc_free(win->away);
- win->away = NULL;
- client->screen->bottom_line->away = FALSE;
-
- silc_say(client, "Away message removed");
- silc_screen_print_bottom_line(cmd->client->screen, 0);
- }
- } else {
-
- if (win->away)
- silc_free(win->away->away);
- else
- win->away = silc_calloc(1, sizeof(*win->away));
-
- client->screen->bottom_line->away = TRUE;
- win->away->away = strdup(cmd->argv[1]);
-
- silc_say(client, "Away message set: %s", win->away->away);
- silc_screen_print_bottom_line(cmd->client->screen, 0);
- }