msg = silc_memdup(silc_buffer_data(&packet->buffer),
silc_buffer_len(&packet->buffer));
if (msg)
- client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT, msg);
+ client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR, msg);
silc_free(msg);
silc_packet_free(packet);
chu = silc_client_on_channel(channel, conn->local_entry);
if (silc_unlikely(!chu)) {
+ conn->context_type = SILC_ID_CHANNEL;
+ conn->channel_entry = channel;
client->internal->ops->say(conn->client, conn,
- SILC_CLIENT_MESSAGE_AUDIT,
+ SILC_CLIENT_MESSAGE_ERROR,
"Cannot talk to channel: not joined");
+ conn->context_type = SILC_ID_NONE;
return FALSE;
}
/* Get channel cipher */
cipher = silc_channel_key_get_cipher(payload, NULL);
if (!silc_cipher_alloc(cipher, &channel->internal.send_key)) {
+ conn->context_type = SILC_ID_CHANNEL;
+ conn->channel_entry = channel;
client->internal->ops->say(
conn->client, conn,
- SILC_CLIENT_MESSAGE_AUDIT,
+ SILC_CLIENT_MESSAGE_ERROR,
"Cannot talk to channel: unsupported cipher %s",
cipher);
+ conn->context_type = SILC_ID_NONE;
silc_client_unref_channel(client, conn, channel);
silc_channel_key_payload_free(payload);
return FALSE;
}
if (!silc_cipher_alloc(cipher, &channel->internal.receive_key)) {
+ conn->context_type = SILC_ID_CHANNEL;
+ conn->channel_entry = channel;
client->internal->ops->say(
conn->client, conn,
- SILC_CLIENT_MESSAGE_AUDIT,
+ SILC_CLIENT_MESSAGE_ERROR,
"Cannot talk to channel: unsupported cipher %s",
cipher);
+ conn->context_type = SILC_ID_NONE;
silc_client_unref_channel(client, conn, channel);
silc_channel_key_payload_free(payload);
return FALSE;
(char *)silc_hmac_get_name(channel->internal.hmac) :
SILC_DEFAULT_HMAC);
if (!silc_hmac_alloc(hmac, NULL, &channel->internal.hmac)) {
+ conn->context_type = SILC_ID_CHANNEL;
+ conn->channel_entry = channel;
client->internal->ops->say(
conn->client, conn,
- SILC_CLIENT_MESSAGE_AUDIT,
+ SILC_CLIENT_MESSAGE_ERROR,
"Cannot talk to channel: unsupported HMAC %s",
hmac);
+ conn->context_type = SILC_ID_NONE;
silc_client_unref_channel(client, conn, channel);
silc_channel_key_payload_free(payload);
return FALSE;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 - 2007 Pekka Riikonen
+ Copyright (C) 2001 - 2014 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
session->fd = silc_file_open(path, O_RDWR | O_CREAT | O_EXCL);
if (session->fd < 0) {
/* Call monitor callback */
+ session->conn->context_type = SILC_ID_CLIENT;
+ session->conn->client_entry = session->client_entry;
session->client->internal->ops->say(session->client, session->conn,
SILC_CLIENT_MESSAGE_ERROR,
"File `%s' open failed: %s",
session->filepath,
strerror(errno));
+ session->conn->context_type = SILC_ID_NONE;
if (session->monitor)
(*session->monitor)(session->client, session->conn,
silc_client_ftp_connect_completion,
session);
if (!session->listener) {
+ conn->context_type = SILC_ID_CLIENT;
+ conn->client_entry = session->client_entry;
client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener for file transfer: "
"%s", strerror(errno));
+ conn->context_type = SILC_ID_NONE;
silc_free(session);
return SILC_CLIENT_FILE_NO_MEMORY;
}
/* Add the listener for the key agreement */
SILC_LOG_DEBUG(("Creating listener for file transfer"));
if (!params || (!params->local_ip && !params->bind_ip)) {
+ session->conn->context_type = SILC_ID_CLIENT;
+ session->conn->client_entry = session->client_entry;
session->client->internal->ops->say(session->client, session->conn,
SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener for file "
"transfer; IP address and/or port "
"not provided");
+ session->conn->context_type = SILC_ID_NONE;
silc_free(session);
return SILC_CLIENT_FILE_ERROR;
}
silc_client_ftp_connect_completion,
session);
if (!session->listener) {
+ session->conn->context_type = SILC_ID_CLIENT;
+ session->conn->client_entry = session->client_entry;
client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener for file transfer: "
"%s", strerror(errno));
+ session->conn->context_type = SILC_ID_NONE;
silc_free(session);
return SILC_CLIENT_FILE_NO_MEMORY;
}
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2000 - 2008 Pekka Riikonen
+ Copyright (C) 2000 - 2014 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
void *callback_context; /* Connection context */
SilcClient client; /* Pointer back to SilcClient */
+ /* Current say() operation associated context, identifies the client,
+ channel or server the message is related to. Application can use
+ this information to target the message better. */
+ union {
+ SilcClientEntry client_entry;
+ SilcChannelEntry channel_entry;
+ SilcServerEntry server_entry;
+ };
+ SilcIdType context_type; /* Defines which pointer is set
+ in the union. If SILC_ID_NONE
+ pointer is NULL. */
+
/* Application specific data. Application may set here whatever it wants. */
void *context;
The `type' indicates the type of the message sent by the library.
The application can for example filter the message according the
type. The variable argument list is arguments to the formatted
- message that `msg' may be. */
+ message `msg'. A SilcClientEntry, SilcChannelEntry or SilcServerEntry
+ can be associated with the message inside the `conn' by the library,
+ and application may use it to better target the message. */
void (*say)(SilcClient client, SilcClientConnection conn,
SilcClientMessageType type, char *msg, ...);