/*
- client_prvmsg.c
+ client_prvmsg.c
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2002 Pekka Riikonen
+ Copyright (C) 1997 - 2004 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
SilcClientConnection conn,
SilcClientEntry client_entry,
SilcMessageFlags flags,
- unsigned char *data,
- SilcUInt32 data_len,
+ unsigned char *data,
+ SilcUInt32 data_len,
bool force_send)
{
SilcSocketConnection sock;
silc_client_packet_send(client, sock, SILC_PACKET_PRIVATE_MESSAGE,
client_entry->id, SILC_ID_CLIENT, NULL, NULL,
buffer->data, buffer->len, force_send);
+ ret = TRUE;
goto out;
}
data_len = SILC_PACKET_DATALEN(data_len, SILC_PACKET_HEADER_LEN +
packetdata.src_id_len +
packetdata.dst_id_len);
- packetdata.truelen = data_len + SILC_PACKET_HEADER_LEN +
+ packetdata.truelen = data_len + SILC_PACKET_HEADER_LEN +
packetdata.src_id_len + packetdata.dst_id_len;
SILC_PACKET_PADLEN((SILC_PACKET_HEADER_LEN +
packetdata.src_id_len +
packetdata.dst_id_len), block_len, packetdata.padlen);
/* Create the outgoing packet */
- if (!silc_packet_assemble(&packetdata, client->rng, cipher, hmac, sock,
+ if (!silc_packet_assemble(&packetdata, client->rng, cipher, hmac, sock,
data, data_len, (const SilcBuffer)&packet)) {
SILC_LOG_ERROR(("Error assembling packet"));
goto out;
silc_buffer_free(buffer);
return ret;
-}
+}
static void silc_client_private_message_cb(SilcClient client,
SilcClientConnection conn,
/* Private message received. This processes the private message and
finally displays it on the screen. */
-void silc_client_private_message(SilcClient client,
- SilcSocketConnection sock,
+void silc_client_private_message(SilcClient client,
+ SilcSocketConnection sock,
SilcPacketContext *packet)
{
SilcClientConnection conn = (SilcClientConnection)sock->user_data;
if (packet->src_id_type != SILC_ID_CLIENT)
goto out;
- remote_id = silc_id_str2id(packet->src_id, packet->src_id_len,
+ remote_id = silc_id_str2id(packet->src_id, packet->src_id_len,
SILC_ID_CLIENT);
if (!remote_id)
goto out;
/* Print some info for application */
client->internal->ops->say(
- client, conn, SILC_CLIENT_MESSAGE_AUDIT,
- "Received private message key from %s%s%s %s%s%s",
+ client, conn, SILC_CLIENT_MESSAGE_AUDIT,
+ "Received private message key from %s%s%s %s%s%s",
clients[0]->nickname,
clients[0]->server ? "@" : "",
clients[0]->server ? clients[0]->server : "",
if (packet->src_id_type != SILC_ID_CLIENT)
return;
- remote_id = silc_id_str2id(packet->src_id, packet->src_id_len,
+ remote_id = silc_id_str2id(packet->src_id, packet->src_id_len,
SILC_ID_CLIENT);
if (!remote_id)
return;
It is not necessary to set key for normal private message usage. If the
key is not set then the private messages are encrypted using normal
- session keys. Setting the private key, however, increases the security.
+ session keys. Setting the private key, however, increases the security.
Returns FALSE if the key is already set for the `client_entry', TRUE
otherwise. */
/* Produce the key material as the protocol defines */
keymat = silc_calloc(1, sizeof(*keymat));
- if (silc_ske_process_key_material_data(key, key_len, 16, 256, 16,
- client->sha1hash, keymat)
+ if (silc_ske_process_key_material_data(key, key_len, 16, 256, 16,
+ client->sha1hash, keymat)
!= SILC_SKE_STATUS_OK)
return FALSE;
silc_buffer_pull_tail(buffer, SILC_BUFFER_END(buffer));
silc_buffer_format(buffer,
SILC_STR_UI_SHORT(client_entry->key_len),
- SILC_STR_UI_XNSTRING(client_entry->key,
+ SILC_STR_UI_XNSTRING(client_entry->key,
client_entry->key_len),
SILC_STR_UI_SHORT(cipher_len),
SILC_STR_UI_XNSTRING(cipher,
/* Returns array of set private message keys associated to the connection
`conn'. Returns allocated SilcPrivateMessageKeys array and the array
count to the `key_count' argument. The array must be freed by the caller
- by calling the silc_client_free_private_message_keys function. Note:
+ by calling the silc_client_free_private_message_keys function. Note:
the keys returned in the array is in raw format. It might not be desired
to show the keys as is. The application might choose not to show the keys
at all or to show the fingerprints of the keys. */
to anyone who sends private message. The `message' will be sent
automatically back to the the client who send private message. If
away message is already set this replaces the old message with the
- new one. If `message' is NULL the old away message is removed.
+ new one. If `message' is NULL the old away message is removed.
The sender may freely free the memory of the `message'. */
void silc_client_set_away_message(SilcClient client,