X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcclient%2Fclient_prvmsg.c;h=d0b72c97ccda970a3aaa20306794a02b99c0afb5;hb=413da0f8686910f5e627393157566ae729ca99c4;hp=aff49a2362f63d4d0318b5f72026dd2917e46a58;hpb=054c9b2c9b21c3cbe87e53c0e0bacb2bff918e68;p=silc.git diff --git a/lib/silcclient/client_prvmsg.c b/lib/silcclient/client_prvmsg.c index aff49a23..d0b72c97 100644 --- a/lib/silcclient/client_prvmsg.c +++ b/lib/silcclient/client_prvmsg.c @@ -32,7 +32,7 @@ message. The `data' is the private message. If the `force_send' is TRUE the packet is sent immediately. */ -void silc_client_send_private_message(SilcClient client, +bool silc_client_send_private_message(SilcClient client, SilcClientConnection conn, SilcClientEntry client_entry, SilcMessageFlags flags, @@ -47,6 +47,7 @@ void silc_client_send_private_message(SilcClient client, SilcCipher cipher; SilcHmac hmac; int block_len; + bool ret = FALSE; assert(client && conn && client_entry); sock = conn->sock; @@ -58,7 +59,12 @@ void silc_client_send_private_message(SilcClient client, !client_entry->generated, TRUE, client_entry->send_key, client_entry->hmac_send, - client->rng); + client->rng, NULL, client->private_key, + client->sha1hash); + if (!buffer) { + SILC_LOG_ERROR(("Error encoding private message")); + return FALSE; + } /* If we don't have private message specific key then private messages are just as any normal packet thus call normal packet sending. If @@ -125,8 +131,12 @@ void silc_client_send_private_message(SilcClient client, silc_free(packetdata.dst_id); + ret = TRUE; + out: silc_buffer_free(buffer); + + return ret; } static void silc_client_private_message_cb(SilcClient client, @@ -211,8 +221,8 @@ void silc_client_private_message(SilcClient client, /* Pass the private message to application */ message = silc_message_get_data(payload, &message_len); - client->internal->ops->private_message(client, conn, remote_client, flags, - message, message_len); + client->internal->ops->private_message(client, conn, remote_client, payload, + flags, message, message_len); /* See if we are away (gone). If we are away we will reply to the sender with the set away message. */ @@ -382,7 +392,7 @@ bool silc_client_add_private_message_key(SilcClient client, /* 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->md5hash, keymat) + client->sha1hash, keymat) != SILC_SKE_STATUS_OK) return FALSE;