client = va_arg(va, SilcClientEntry);
message = va_arg(va, char *);
+ silc_server_free_ftp(server, client);
+
memset(userhost, 0, sizeof(userhost));
if (client->username)
snprintf(userhost, sizeof(userhost) - 1, "%s@%s",
topic = va_arg(va, char *);
channel = va_arg(va, SilcChannelEntry);
+ silc_server_free_ftp(server, client);
+
chanrec = silc_channel_find_entry(server, channel);
if (chanrec != NULL) {
g_free_not_null(chanrec->topic);
switch(status) {
case SILC_KEY_AGREEMENT_OK:
- printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_NOTICES,
+ printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_CRAP,
SILCTXT_KEY_AGREEMENT_OK, client_entry->nickname);
if (i->type == 1) {
silc_client_del_private_message_key(client, conn, client_entry);
silc_client_add_private_message_key_ske(client, conn, client_entry,
NULL, key, i->responder);
- printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_NOTICES,
+ printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_CRAP,
SILCTXT_KEY_AGREEMENT_PRIVMSG,
client_entry->nickname);
silc_ske_free_key_material(key);
break;
case SILC_KEY_AGREEMENT_ERROR:
- printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_NOTICES,
+ printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_CRAP,
SILCTXT_KEY_AGREEMENT_ERROR, client_entry->nickname);
break;
case SILC_KEY_AGREEMENT_FAILURE:
- printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_NOTICES,
+ printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_CRAP,
SILCTXT_KEY_AGREEMENT_FAILURE, client_entry->nickname);
break;
case SILC_KEY_AGREEMENT_TIMEOUT:
- printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_NOTICES,
+ printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_CRAP,
SILCTXT_KEY_AGREEMENT_TIMEOUT, client_entry->nickname);
break;
typedef struct {
SILC_SERVER_REC *server;
char *data;
+ char *nick;
WI_ITEM_REC *item;
} *KeyGetClients;
/* Callback to be called after client information is resolved from the
server. */
-SILC_CLIENT_CMD_FUNC(key_get_clients)
+static void silc_client_command_key_get_clients(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientEntry *clients,
+ uint32 clients_count,
+ void *context)
{
KeyGetClients internal = (KeyGetClients)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 key", 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 = NULL;
+ SilcClientEntry *entrys, client_entry = NULL;
+ uint32 entry_count;
SilcChannelEntry channel_entry = NULL;
char *nickname = NULL, *tmp;
int command = 0, port = 0, type = 0;
silc_parse_command_line(tmp, &argv, &argv_lens, &argv_types, &argc, 7);
g_free(tmp);
- if (argc < 4) {
- silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
- "Usage: /KEY msg|channel <nickname|channel> "
- "set|unset|agreement|negotiate [<arguments>]");
- return;
- }
+ if (argc < 4)
+ cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
/* Get type */
if (!strcasecmp(argv[1], "msg"))
if (!strcasecmp(argv[1], "channel"))
type = 2;
- if (type == 0) {
- silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
- "Usage: /KEY msg|channel <nickname|channel> "
- "set|unset|agreement|negotiate [<arguments>]");
- return;
- }
+ if (type == 0)
+ cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
if (type == 1) {
if (argv[2][0] == '*') {
}
/* 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) {
KeyGetClients 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_key_get_clients,
- inter);
+ silc_client_get_clients(silc_client, conn, nickname, argv[2],
+ silc_client_command_key_get_clients, inter);
goto out;
}
+ client_entry = entrys[0];
+ silc_free(entrys);
}
}
}
if (command == 4 && client_entry) {
- printformat_module("fe-common/silc", server, NULL, MSGLEVEL_NOTICES,
+ printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
SILCTXT_KEY_AGREEMENT, argv[2]);
internal->responder = TRUE;
silc_client_send_key_agreement(silc_client, conn, client_entry, hostname,
}
if (command == 5 && client_entry && hostname) {
- printformat_module("fe-common/silc", server, NULL, MSGLEVEL_NOTICES,
+ printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
SILCTXT_KEY_AGREEMENT_NEGOTIATE, argv[2]);
internal->responder = FALSE;
silc_client_perform_key_agreement(silc_client, conn, client_entry,