if (server == NULL)
return;
- silc_client_packet_send(silc_client, sock, SILC_PACKET_HEARTBEAT,
- NULL, 0, NULL, NULL, NULL, 0, FALSE);
+ silc_client_send_packet(silc_client, server->conn, SILC_PACKET_HEARTBEAT,
+ NULL, 0);
}
static void sig_connected(SILC_SERVER_REC *server)
/* SYNTAX: KEY MSG <nickname> set|unset|list|agreement|negotiate [<arguments>] */
/* SYNTAX: KEY CHANNEL <channel> set|unset|list|change [<arguments>] */
/* SYNTAX: KICK <channel> <nickname>[@<hostname>] [<comment>] */
-/* SYNTAX: KILL <nickname>[@<hostname>] [<comment>] */
+/* SYNTAX: KILL <nickname>[@<hostname>] [<comment>] [-pubkey] */
/* SYNTAX: OPER <username> [-pubkey] */
/* SYNTAX: SILCOPER <username> [-pubkey] */
/* SYNTAX: TOPIC <channel> [<topic>] */
/* SYNTAX: PING */
/* SYNTAX: SCONNECT <server> [<port>] */
/* SYNTAX: USERS <channel> */
-/* SYNTAX: FILE SEND <filepath> <nickname> [<local IP> [<local port>]] */
-/* SYNTAX: FILE RECEIVE [<nickname>] */
+/* SYNTAX: FILE SEND <filepath> <nickname> [<local IP> [<local port>]] [-no-listener]*/
+/* SYNTAX: FILE ACCEPT [<nickname>] */
/* SYNTAX: FILE CLOSE [<nickname>] */
/* SYNTAX: FILE */
/* SYNTAX: JOIN <channel> [<passphrase>] [-cipher <cipher>] [-hmac <hmac>] [-founder] */
void silc_command_exec(SILC_SERVER_REC *server,
const char *command, const char *args)
{
- SilcUInt32 argc = 0;
- unsigned char **argv;
- SilcUInt32 *argv_lens, *argv_types;
- char *data, *tmpcmd;
- SilcClientCommand cmd;
- SilcClientCommandContext ctx;
-
+ char *data;
g_return_if_fail(server != NULL);
- tmpcmd = g_strdup(command);
- g_strup(tmpcmd);
- cmd = silc_client_command_find(silc_client, tmpcmd);
- g_free(tmpcmd);
- if (cmd == NULL)
- return;
-
- /* Now parse all arguments */
+ /* Call the command */
data = g_strconcat(command, " ", args, NULL);
- silc_parse_command_line(data, &argv, &argv_lens,
- &argv_types, &argc, cmd->max_args);
+ silc_client_command_call(silc_client, server->conn, data);
g_free(data);
-
- /* Allocate command context. This and its internals must be free'd
- by the command routine receiving it. */
- ctx = silc_client_command_alloc();
- ctx->client = silc_client;
- ctx->conn = server->conn;
- ctx->command = cmd;
- ctx->argc = argc;
- ctx->argv = argv;
- ctx->argv_lens = argv_lens;
- ctx->argv_types = argv_types;
-
- /* Execute command */
- silc_client_command_call(cmd, ctx);
}
/* Generic command function to call any SILC command directly. */
char *local_ip = NULL;
SilcUInt32 local_port = 0;
SilcUInt32 session_id;
+ bool do_not_bind = FALSE;
CMD_SILC_SERVER(server);
if (!server || !IS_SILC_SERVER(server) || !server->connected)
/* Now parse all arguments */
tmp = g_strconcat("FILE", " ", data, NULL);
- silc_parse_command_line(tmp, &argv, &argv_lens, &argv_types, &argc, 6);
+ silc_parse_command_line(tmp, &argv, &argv_lens, &argv_types, &argc, 7);
g_free(tmp);
if (argc == 1)
if (argc >= 2) {
if (!strcasecmp(argv[1], "send"))
type = 1;
- if (!strcasecmp(argv[1], "receive"))
+ if (!strcasecmp(argv[1], "accept"))
type = 2;
if (!strcasecmp(argv[1], "close"))
type = 3;
client_entry = entrys[0];
silc_free(entrys);
- if (argc >= 5)
- local_ip = argv[4];
- if (argc >= 6)
- local_port = atoi(argv[5]);
+ if (argc >= 5) {
+ if (!strcasecmp(argv[4], "-no-listener"))
+ do_not_bind = TRUE;
+ else
+ local_ip = argv[4];
+ }
+ if (argc >= 6) {
+ if (!strcasecmp(argv[5], "-no-listener"))
+ do_not_bind = TRUE;
+ else
+ local_port = atoi(argv[5]);
+ }
+ if (argc >= 7) {
+ if (!strcasecmp(argv[6], "-no-listener"))
+ do_not_bind = TRUE;
+ }
ret =
silc_client_file_send(silc_client, conn, silc_client_file_monitor,
- server, local_ip, local_port,
+ server, local_ip, local_port, do_not_bind,
client_entry, argv[2], &session_id);
if (ret == SILC_CLIENT_FILE_OK) {
ftp = silc_calloc(1, sizeof(*ftp));