X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=lib%2Fsilcclient%2Fclient_prvmsg.c;h=e472853fecf10f8487623d4d9bfee40fe472caab;hp=9dc862141099d1fa5172677136133e067fc63f66;hb=a818c5b5411bbc4436d1c5f011236985c96bb787;hpb=9a85416f729ef965606a688fffb6baa9d22927a5 diff --git a/lib/silcclient/client_prvmsg.c b/lib/silcclient/client_prvmsg.c index 9dc86214..e472853f 100644 --- a/lib/silcclient/client_prvmsg.c +++ b/lib/silcclient/client_prvmsg.c @@ -21,7 +21,8 @@ /* This file includes the private message sending and receiving routines and private message key handling routines. */ -#include "clientlibincludes.h" +#include "silcincludes.h" +#include "silcclient.h" #include "client_internal.h" /* Sends private message to remote client. If private message key has @@ -37,7 +38,7 @@ void silc_client_send_private_message(SilcClient client, SilcClientEntry client_entry, SilcMessageFlags flags, unsigned char *data, - uint32 data_len, + SilcUInt32 data_len, int force_send) { SilcSocketConnection sock = conn->sock; @@ -124,7 +125,7 @@ void silc_client_send_private_message(SilcClient client, static void silc_client_private_message_cb(SilcClient client, SilcClientConnection conn, SilcClientEntry *clients, - uint32 clients_count, + SilcUInt32 clients_count, void *context) { SilcPacketContext *packet = (SilcPacketContext *)context; @@ -147,7 +148,6 @@ void silc_client_private_message(SilcClient client, { SilcClientConnection conn = (SilcClientConnection)sock->user_data; SilcPrivateMessagePayload payload = NULL; - SilcIDCacheEntry id_cache = NULL; SilcClientID *remote_id = NULL; SilcClientEntry remote_client; SilcMessageFlags flags; @@ -162,11 +162,8 @@ void silc_client_private_message(SilcClient client, /* Check whether we know this client already */ remote_client = silc_client_get_client_by_id(client, conn, remote_id); - if (!remote_client || - ((SilcClientEntry)id_cache->context)->nickname == NULL) { - + if (!remote_client || !remote_client->nickname) { if (remote_client) { - remote_client = (SilcClientEntry)id_cache->context; if (remote_client->status & SILC_CLIENT_STATUS_RESOLVING) { remote_client->status &= ~SILC_CLIENT_STATUS_RESOLVING; goto out; @@ -224,12 +221,12 @@ void silc_client_private_message(SilcClient client, static void silc_client_private_message_key_cb(SilcClient client, SilcClientConnection conn, SilcClientEntry *clients, - uint32 clients_count, + SilcUInt32 clients_count, void *context) { SilcPacketContext *packet = (SilcPacketContext *)context; unsigned char *key; - uint16 key_len; + SilcUInt16 key_len; unsigned char *cipher; int ret; @@ -316,12 +313,12 @@ int silc_client_add_private_message_key(SilcClient client, SilcClientEntry client_entry, char *cipher, unsigned char *key, - uint32 key_len, + SilcUInt32 key_len, bool generate_key, bool responder) { unsigned char private_key[32]; - uint32 len; + SilcUInt32 len; int i; SilcSKEKeyMaterial *keymat; @@ -348,8 +345,7 @@ int silc_client_add_private_message_key(SilcClient client, } /* Save the key */ - client_entry->key = silc_calloc(key_len, sizeof(*client_entry->key)); - memcpy(client_entry->key, key, key_len); + client_entry->key = silc_memdup(key, key_len); client_entry->key_len = key_len; /* Produce the key material as the protocol defines */ @@ -522,10 +518,10 @@ int silc_client_del_private_message_key(SilcClient client, SilcPrivateMessageKeys silc_client_list_private_message_keys(SilcClient client, SilcClientConnection conn, - uint32 *key_count) + SilcUInt32 *key_count) { SilcPrivateMessageKeys keys; - uint32 count = 0; + SilcUInt32 count = 0; SilcIDCacheEntry id_cache; SilcIDCacheList list; SilcClientEntry entry; @@ -566,7 +562,7 @@ silc_client_list_private_message_keys(SilcClient client, silc_client_list_private_message_keys. */ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys, - uint32 key_count) + SilcUInt32 key_count) { silc_free(keys); }