static void silc_send_msg_clients(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
PRIVMSG_REC *rec = context;
char *nickname = NULL;
if (!clients_count) {
- printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown nick: %s", rec->nick);
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client", rec->nick);
} else {
if (clients_count > 1) {
silc_parse_userfqdn(rec->nick, &nickname, NULL);
nickname, rec->nick,
&clients_count);
if (!clients) {
- printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown nick: %s",
- rec->nick);
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client", rec->nick);
silc_free(nickname);
goto out;
}
target = clients[0];
+ /* Still check for exact math for nickname, this compares the
+ real (formatted) nickname and the nick (maybe formatted) that
+ use gave. This is to assure that `nick' does not match
+ `nick@host'. */
+ if (strcasecmp(rec->nick, clients[0]->nickname)) {
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client", rec->nick);
+ goto out;
+ }
+
/* Send the private message */
silc_client_send_private_message(client, conn, target, 0,
rec->msg, strlen(rec->msg),
{
PRIVMSG_REC *rec;
SilcClientEntry *clients;
- uint32 clients_count;
+ SilcUInt32 clients_count;
char *nickname = NULL;
if (!silc_parse_userfqdn(nick, &nickname, NULL)) {
/* Find client entry */
clients = silc_client_get_clients_local(silc_client, server->conn,
nickname, nick, &clients_count);
- silc_free(nickname);
-
if (!clients) {
rec = g_new0(PRIVMSG_REC, 1);
rec->nick = g_strdup(nick);
/* Could not find client with that nick, resolve it from server. */
silc_client_get_clients(silc_client, server->conn,
nickname, NULL, silc_send_msg_clients, rec);
+ silc_free(nickname);
return;
}
/* Send the private message directly */
+ silc_free(nickname);
silc_client_send_private_message(silc_client, server->conn,
clients[0], 0, msg, strlen(msg), TRUE);
}
return flag == '@' || flag == '+';
}
-static int ischannel_func(const char *data)
+static int ischannel_func(SERVER_REC *server, const char *data)
{
- return *data == '#';
+ return FALSE;
}
const char *get_nick_flags(void)
return "@\0\0";
}
-static void send_message(SILC_SERVER_REC *server, char *target, char *msg)
+static void send_message(SILC_SERVER_REC *server, char *target,
+ char *msg, int target_type)
{
g_return_if_fail(server != NULL);
g_return_if_fail(target != NULL);
g_return_if_fail(msg != NULL);
- if (*target == '#')
+ if (target_type == SEND_TARGET_CHANNEL)
silc_send_channel(server, target, msg);
else
silc_send_msg(server, target, msg);
server->conn = conn;
fd = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));
- if (!silc_client_start_key_exchange(silc_client, conn, fd)) {
- /* some internal error occured */
- server_disconnect(SERVER(server));
- signal_stop();
- return;
- }
+ silc_client_start_key_exchange(silc_client, conn, fd);
+ server->ftp_sessions = silc_dlist_init();
server->isnickflag = isnickflag_func;
server->ischannel = ischannel_func;
server->get_nick_flags = get_nick_flags;
{
if (!IS_SILC_SERVER(server))
return;
-
+
+ silc_dlist_uninit(server->ftp_sessions);
+
if (server->conn && server->conn->sock != NULL) {
silc_client_close_connection(silc_client, NULL, server->conn);
if (server->connrec->port <= 0)
server->connrec->port = 706;
+ server_connect_ref(SERVER_CONNECT(conn));
+
if (!server_start_connect((SERVER_REC *) server)) {
- server_connect_free(SERVER_CONNECT(conn));
+ server_connect_unref(SERVER_CONNECT(conn));
g_free(server);
return NULL;
}
- server->ftp_sessions = silc_dlist_init();
-
return server;
}
/* SYNTAX: INVITE <channel> [<nickname>[@hostname>] */
/* SYNTAX: INVITE <channel> [+|-[<nickname>[@<server>[!<username>[@hostname>]]]]] */
/* SYNTAX: KEY MSG <nickname> set|unset|list|agreement|negotiate [<arguments>] */
-/* SYNTAX: KEY CHANNEL <channel> set|unset|list|agreement|negotiate [<arguments>] */
+/* SYNTAX: KEY CHANNEL <channel> set|unset|list [<arguments>] */
/* SYNTAX: KICK <channel> <nickname>[@<hostname>] [<comment>] */
/* SYNTAX: KILL <nickname>[@<hostname>] [<comment>] */
/* SYNTAX: OPER <username> [-pubkey] */
/* SYNTAX: PING */
/* SYNTAX: SCONNECT <server> [<port>] */
/* SYNTAX: USERS <channel> */
-/* SYNTAX: FILE SEND <filename> <nickname> */
+/* SYNTAX: FILE SEND <filepath> <nickname> [<local IP> [<local port>]] */
/* SYNTAX: FILE RECEIVE [<nickname>] */
/* SYNTAX: FILE CLOSE [<nickname>] */
-/* SYNTAX: FILE SHOW */
+/* SYNTAX: FILE */
+/* SYNTAX: JOIN <channel> [<passphrase>] [-cipher <cipher>] [-hmac <hmac>] [-founder <-pubkey|passwd>] */
void silc_command_exec(SILC_SERVER_REC *server,
const char *command, const char *args)
{
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
char *data, *tmpcmd;
- SilcClientCommand *cmd;
+ SilcClientCommand cmd;
SilcClientCommandContext ctx;
g_return_if_fail(server != NULL);
tmpcmd = g_strdup(command);
g_strup(tmpcmd);
- cmd = silc_client_command_find(tmpcmd);
+ cmd = silc_client_command_find(silc_client, tmpcmd);
g_free(tmpcmd);
if (cmd == NULL)
return;
-
+
/* Now parse all arguments */
data = g_strconcat(command, " ", args, NULL);
silc_parse_command_line(data, &argv, &argv_lens,
ctx->argv_types = argv_types;
/* Execute command */
- (*cmd->cb)(ctx, NULL);
+ silc_client_command_call(cmd, ctx);
}
/* Generic command function to call any SILC command directly. */
signal_stop();
}
-static void event_text(const char *line, SILC_SERVER_REC *server,
- WI_ITEM_REC *item)
-{
- char *str;
-
- g_return_if_fail(line != NULL);
-
- if (!IS_SILC_ITEM(item))
- return;
-
- str = g_strdup_printf("%s %s", item->name, line);
- signal_emit("command msg", 3, str, server, item);
- g_free(str);
-
- signal_stop();
-}
-
/* FILE command */
SILC_TASK_CALLBACK(silc_client_file_close_later)
static void silc_client_file_monitor(SilcClient client,
SilcClientConnection conn,
SilcClientMonitorStatus status,
- uint64 offset,
- uint64 filesize,
+ SilcClientFileError error,
+ SilcUInt64 offset,
+ SilcUInt64 filesize,
SilcClientEntry client_entry,
- uint32 session_id,
+ SilcUInt32 session_id,
const char *filepath,
void *context)
{
FtpSession ftp;
char fsize[32];
- snprintf(fsize, sizeof(fsize) - 1, "%llu", (filesize / 1024));
+ snprintf(fsize, sizeof(fsize) - 1, "%llu", ((filesize + 1023) / 1024));
silc_dlist_start(server->ftp_sessions);
while ((ftp = silc_dlist_get(server->ftp_sessions)) != SILC_LIST_END) {
- if (ftp->client_entry == client_entry) {
- ftp->session_id = session_id;
-
- if (!ftp->filepath)
+ if (ftp->session_id == session_id) {
+ if (!ftp->filepath && filepath)
ftp->filepath = strdup(filepath);
break;
}
}
+ if (ftp == SILC_LIST_END)
+ return;
+
+ if (status == SILC_CLIENT_FILE_MONITOR_ERROR) {
+ if (error == SILC_CLIENT_FILE_NO_SUCH_FILE)
+ printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+ SILCTXT_FILE_ERROR_NO_SUCH_FILE,
+ client_entry->nickname,
+ filepath ? filepath : "[N/A]");
+ else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED)
+ printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+ SILCTXT_FILE_ERROR_PERMISSION_DENIED,
+ client_entry->nickname);
+ else
+ printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+ SILCTXT_FILE_ERROR, client_entry->nickname);
+ silc_schedule_task_add(silc_client->schedule, 0,
+ silc_client_file_close_later, ftp,
+ 1, 0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+ if (ftp == server->current_session)
+ server->current_session = NULL;
+ silc_dlist_del(server->ftp_sessions, ftp);
+ }
+
+ if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) {
+ printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+ SILCTXT_FILE_KEY_EXCHANGE, client_entry->nickname);
+ }
+
+ /* Save some transmission data */
+ if (offset && filesize) {
+ unsigned long delta = time(NULL) - ftp->starttime;
+
+ ftp->percent = ((double)offset / (double)filesize) * (double)100.0;
+ if (delta)
+ ftp->kps = (double)((offset / (double)delta) + 1023) / (double)1024;
+ else
+ ftp->kps = (double)(offset + 1023) / (double)1024;
+ ftp->offset = offset;
+ ftp->filesize = filesize;
+ }
+
if (status == SILC_CLIENT_FILE_MONITOR_SEND) {
- if (offset == 0)
+ if (offset == 0) {
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_FILE_TRANSMIT, filepath, fsize,
client_entry->nickname);
+ ftp->starttime = time(NULL);
+ }
if (offset == filesize) {
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_FILE_TRANSMITTED, filepath, fsize,
- client_entry->nickname, "1024");
- if (ftp != SILC_LIST_END) {
- silc_schedule_task_add(silc_client->schedule, 0,
- silc_client_file_close_later, ftp,
- 1, 0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
- silc_dlist_del(server->ftp_sessions, ftp);
- }
+ client_entry->nickname, ftp->kps);
+ silc_schedule_task_add(silc_client->schedule, 0,
+ silc_client_file_close_later, ftp,
+ 1, 0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+ if (ftp == server->current_session)
+ server->current_session = NULL;
+ silc_dlist_del(server->ftp_sessions, ftp);
}
}
if (status == SILC_CLIENT_FILE_MONITOR_RECEIVE) {
- if (offset == 0)
+ if (offset == 0) {
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_FILE_RECEIVE, filepath, fsize,
client_entry->nickname);
+ ftp->starttime = time(NULL);
+ }
+
if (offset == filesize) {
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_FILE_RECEIVED, filepath, fsize,
- client_entry->nickname, "1024");
- if (ftp != SILC_LIST_END) {
- silc_schedule_task_add(silc_client->schedule, 0,
- silc_client_file_close_later, ftp,
- 1, 0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
- silc_dlist_del(server->ftp_sessions, ftp);
- }
+ client_entry->nickname, ftp->kps);
+ silc_schedule_task_add(silc_client->schedule, 0,
+ silc_client_file_close_later, ftp,
+ 1, 0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+ if (ftp == server->current_session)
+ server->current_session = NULL;
+ silc_dlist_del(server->ftp_sessions, ftp);
}
}
}
typedef struct {
SILC_SERVER_REC *server;
char *data;
+ char *nick;
WI_ITEM_REC *item;
} *FileGetClients;
-SILC_CLIENT_CMD_FUNC(file_get_clients)
+static void silc_client_command_file_get_clients(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientEntry *clients,
+ SilcUInt32 clients_count,
+ void *context)
{
FileGetClients internal = (FileGetClients)context;
+
+ if (!clients) {
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown nick: %s",
+ internal->nick);
+ silc_free(internal->data);
+ silc_free(internal->nick);
+ silc_free(internal);
+ return;
+ }
+
signal_emit("command file", 3, internal->data, internal->server,
internal->item);
+
silc_free(internal->data);
+ silc_free(internal->nick);
silc_free(internal);
}
WI_ITEM_REC *item)
{
SilcClientConnection conn;
- SilcClientEntry client_entry;
+ SilcClientEntry *entrys, client_entry;
+ SilcClientFileError ret;
+ SilcUInt32 entry_count;
char *nickname = NULL, *tmp;
unsigned char **argv;
- uint32 argc;
- uint32 *argv_lens, *argv_types;
- int type;
+ SilcUInt32 argc;
+ SilcUInt32 *argv_lens, *argv_types;
+ int type = 0;
FtpSession ftp;
+ char *local_ip = NULL;
+ SilcUInt32 local_port = 0;
+ SilcUInt32 session_id;
if (!server || !IS_SILC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
conn = server->conn;
/* Now parse all arguments */
- tmp = g_strconcat("KEY", " ", data, NULL);
- silc_parse_command_line(tmp, &argv, &argv_lens, &argv_types, &argc, 4);
+ tmp = g_strconcat("FILE", " ", data, NULL);
+ silc_parse_command_line(tmp, &argv, &argv_lens, &argv_types, &argc, 6);
g_free(tmp);
- if (argc < 2)
- cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
-
- type = 0;
- if (!strcasecmp(argv[1], "send"))
- type = 1;
- if (!strcasecmp(argv[1], "receive"))
- type = 2;
- if (!strcasecmp(argv[1], "close"))
- type = 3;
- if (!strcasecmp(argv[1], "show"))
+ if (argc == 1)
type = 4;
+
+ if (argc >= 2) {
+ if (!strcasecmp(argv[1], "send"))
+ type = 1;
+ if (!strcasecmp(argv[1], "receive"))
+ type = 2;
+ if (!strcasecmp(argv[1], "close"))
+ type = 3;
+ }
if (type == 0)
cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
}
/* Find client entry */
- client_entry = silc_idlist_get_client(silc_client, conn, nickname,
- argv[3], TRUE);
- if (!client_entry) {
+ entrys = silc_client_get_clients_local(silc_client, conn, nickname,
+ argv[3], &entry_count);
+ if (!entrys) {
FileGetClients inter = silc_calloc(1, sizeof(*inter));
inter->server = server;
inter->data = strdup(data);
+ inter->nick = strdup(nickname);
inter->item = item;
-
- /* Client entry not found, it was requested thus mark this to be
- pending command. */
- silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY,
- conn->cmd_ident,
- NULL, silc_client_command_file_get_clients,
- inter);
+ silc_client_get_clients(silc_client, conn, nickname, argv[3],
+ silc_client_command_file_get_clients, inter);
goto out;
}
+ client_entry = entrys[0];
+ silc_free(entrys);
+
+ if (argc >= 5)
+ local_ip = argv[4];
+ if (argc >= 6)
+ local_port = atoi(argv[5]);
+
+ ret =
+ silc_client_file_send(silc_client, conn, silc_client_file_monitor,
+ server, local_ip, local_port,
+ client_entry, argv[2], &session_id);
+ if (ret == SILC_CLIENT_FILE_OK) {
+ ftp = silc_calloc(1, sizeof(*ftp));
+ ftp->session_id = session_id;
- silc_client_file_send(silc_client, conn, silc_client_file_monitor,
- server, client_entry, argv[2]);
- printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
- SILCTXT_FILE_SEND, client_entry->nickname,
- argv[2]);
-
- ftp = silc_calloc(1, sizeof(*ftp));
- ftp->client_entry = client_entry;
- ftp->filepath = strdup(argv[2]);
- ftp->conn = conn;
- ftp->send = TRUE;
- silc_dlist_add(server->ftp_sessions, ftp);
- server->current_session = ftp;
+ printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+ SILCTXT_FILE_SEND, client_entry->nickname,
+ argv[2]);
+
+ ftp->client_entry = client_entry;
+ ftp->filepath = strdup(argv[2]);
+ ftp->conn = conn;
+ ftp->send = TRUE;
+ silc_dlist_add(server->ftp_sessions, ftp);
+ server->current_session = ftp;
+ } else {
+ if (ret == SILC_CLIENT_FILE_ALREADY_STARTED)
+ printformat_module("fe-common/silc", server, NULL,
+ MSGLEVEL_CRAP, SILCTXT_FILE_ALREADY_STARTED,
+ client_entry->nickname);
+ if (ret == SILC_CLIENT_FILE_NO_SUCH_FILE)
+ printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+ SILCTXT_FILE_ERROR_NO_SUCH_FILE,
+ client_entry->nickname, argv[2]);
+ }
break;
}
/* Find client entry */
- client_entry = silc_idlist_get_client(silc_client, conn, nickname,
- argv[2], TRUE);
- if (!client_entry) {
+ entrys = silc_client_get_clients_local(silc_client, conn, nickname,
+ argv[2], &entry_count);
+ if (!entrys) {
FileGetClients inter = silc_calloc(1, sizeof(*inter));
inter->server = server;
inter->data = strdup(data);
+ inter->nick = strdup(nickname);
inter->item = item;
-
- /* Client entry not found, it was requested thus mark this to be
- pending command. */
- silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY,
- conn->cmd_ident,
- NULL,
- silc_client_command_file_get_clients,
- inter);
+ silc_client_get_clients(silc_client, conn, nickname, argv[2],
+ silc_client_command_file_get_clients, inter);
goto out;
}
+ client_entry = entrys[0];
+ silc_free(entrys);
} else {
if (!server->current_session) {
printformat_module("fe-common/silc", server, NULL,
goto out;
}
- if (!silc_client_file_receive(silc_client, conn,
- silc_client_file_monitor, server,
- server->current_session->client_entry,
- server->current_session->session_id))
- printformat_module("fe-common/silc", server, NULL,
- MSGLEVEL_CRAP, SILCTXT_FILE_CLIENT_NA,
- server->current_session->client_entry->nickname);
+ ret = silc_client_file_receive(silc_client, conn,
+ silc_client_file_monitor, server,
+ server->current_session->session_id);
+ if (ret != SILC_CLIENT_FILE_OK) {
+ if (ret == SILC_CLIENT_FILE_ALREADY_STARTED)
+ printformat_module("fe-common/silc", server, NULL,
+ MSGLEVEL_CRAP, SILCTXT_FILE_ALREADY_STARTED,
+ server->current_session->client_entry->nickname);
+ else
+ printformat_module("fe-common/silc", server, NULL,
+ MSGLEVEL_CRAP, SILCTXT_FILE_CLIENT_NA,
+ server->current_session->client_entry->nickname);
+ }
goto out;
}
silc_dlist_start(server->ftp_sessions);
while ((ftp = silc_dlist_get(server->ftp_sessions)) != SILC_LIST_END) {
- if (ftp->client_entry == client_entry) {
- if (!silc_client_file_receive(silc_client, conn,
- silc_client_file_monitor, server,
- ftp->client_entry,
- ftp->session_id))
- printformat_module("fe-common/silc", server, NULL,
- MSGLEVEL_CRAP, SILCTXT_FILE_CLIENT_NA,
- server->current_session->client_entry->nickname);
+ if (ftp->client_entry == client_entry && !ftp->filepath) {
+ ret = silc_client_file_receive(silc_client, conn,
+ silc_client_file_monitor, server,
+ ftp->session_id);
+ if (ret != SILC_CLIENT_FILE_OK) {
+ if (ret == SILC_CLIENT_FILE_ALREADY_STARTED)
+ printformat_module("fe-common/silc", server, NULL,
+ MSGLEVEL_CRAP, SILCTXT_FILE_ALREADY_STARTED,
+ client_entry->nickname);
+ else
+ printformat_module("fe-common/silc", server, NULL,
+ MSGLEVEL_CRAP, SILCTXT_FILE_CLIENT_NA,
+ client_entry->nickname);
+ }
break;
}
}
}
/* Find client entry */
- client_entry = silc_idlist_get_client(silc_client, conn, nickname,
- argv[2], TRUE);
- if (!client_entry) {
+ entrys = silc_client_get_clients_local(silc_client, conn, nickname,
+ argv[2], &entry_count);
+ if (!entrys) {
FileGetClients inter = silc_calloc(1, sizeof(*inter));
inter->server = server;
inter->data = strdup(data);
+ inter->nick = strdup(nickname);
inter->item = item;
-
- /* Client entry not found, it was requested thus mark this to be
- pending command. */
- silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY,
- conn->cmd_ident,
- NULL,
- silc_client_command_file_get_clients,
- inter);
+ silc_client_get_clients(silc_client, conn, nickname, argv[2],
+ silc_client_command_file_get_clients, inter);
goto out;
}
+ client_entry = entrys[0];
+ silc_free(entrys);
} else {
if (!server->current_session) {
printformat_module("fe-common/silc", server, NULL,
MSGLEVEL_CRAP, SILCTXT_FILE_NA);
goto out;
}
-
- if (!silc_client_file_close(silc_client, conn,
- server->current_session->session_id))
- printformat_module("fe-common/silc", server, NULL,
- MSGLEVEL_CRAP, SILCTXT_FILE_CLIENT_NA,
- server->current_session->client_entry->nickname);
-
+
+ silc_client_file_close(silc_client, conn,
+ server->current_session->session_id);
+ printformat_module("fe-common/silc", server, NULL,
+ MSGLEVEL_CRAP, SILCTXT_FILE_CLOSED,
+ server->current_session->client_entry->nickname,
+ server->current_session->filepath ?
+ server->current_session->filepath : "[N/A]");
+ silc_dlist_del(server->ftp_sessions, server->current_session);
+ silc_free(server->current_session->filepath);
+ silc_free(server->current_session);
+ server->current_session = NULL;
goto out;
}
silc_dlist_start(server->ftp_sessions);
while ((ftp = silc_dlist_get(server->ftp_sessions)) != SILC_LIST_END) {
if (ftp->client_entry == client_entry) {
- if (!silc_client_file_close(silc_client, conn, ftp->session_id))
- printformat_module("fe-common/silc", server, NULL,
- MSGLEVEL_CRAP, SILCTXT_FILE_CLIENT_NA,
- server->current_session->client_entry->nickname);
+ silc_client_file_close(silc_client, conn, ftp->session_id);
+ printformat_module("fe-common/silc", server, NULL,
+ MSGLEVEL_CRAP, SILCTXT_FILE_CLOSED,
+ client_entry->nickname,
+ ftp->filepath ? ftp->filepath : "[N/A]");
+ if (ftp == server->current_session)
+ server->current_session = NULL;
silc_dlist_del(server->ftp_sessions, ftp);
silc_free(ftp->filepath);
silc_free(ftp);
printformat_module("fe-common/silc", server, NULL,
MSGLEVEL_CRAP, SILCTXT_FILE_SHOW_LINE,
ftp->client_entry->nickname,
- ftp->filepath ? ftp->filepath : "[unknown]",
- ftp->send ? "send" : "receive");
+ ftp->send ? "send" : "receive",
+ (SilcUInt32)(ftp->offset + 1023) / 1024,
+ (SilcUInt32)(ftp->filesize + 1023) / 1024,
+ ftp->percent, ftp->kps,
+ ftp->filepath ? ftp->filepath : "[N/A]");
}
break;
signal_add_first("server connected", (SIGNAL_FUNC) sig_connected);
signal_add("server disconnected", (SIGNAL_FUNC) sig_disconnected);
- signal_add("send text", (SIGNAL_FUNC) event_text);
command_bind("whois", MODULE_NAME, (SIGNAL_FUNC) command_self);
command_bind("whowas", MODULE_NAME, (SIGNAL_FUNC) command_self);
command_bind("nick", MODULE_NAME, (SIGNAL_FUNC) command_self);
signal_remove("server connected", (SIGNAL_FUNC) sig_connected);
signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected);
- signal_remove("send text", (SIGNAL_FUNC) event_text);
command_unbind("whois", (SIGNAL_FUNC) command_self);
command_unbind("whowas", (SIGNAL_FUNC) command_self);
command_unbind("nick", (SIGNAL_FUNC) command_self);
silc_dlist_del(server->ftp_sessions, ftp);
silc_free(ftp->filepath);
silc_free(ftp);
- break;
}
}
}