SILC_LOG_DEBUG(("Sending private message"));
/* Encode private message payload */
- buffer = silc_private_message_payload_encode(flags, strlen(conn->nickname),
- conn->nickname,
+ buffer = silc_private_message_payload_encode(flags,
data_len, data,
client_entry->send_key);
/* Get data used in the encryption */
cipher = client_entry->send_key;
- hmac = conn->hmac;
+ hmac = conn->hmac_send;
/* Set the packet context pointers. */
packetdata.flags = SILC_PACKET_FLAG_PRIVMSG_KEY;
packetdata.type = SILC_PACKET_PRIVATE_MESSAGE;
packetdata.src_id = conn->local_id_data;
- packetdata.src_id_len = SILC_ID_CLIENT_LEN;
+ packetdata.src_id_len = silc_id_get_len(conn->local_id, SILC_ID_CLIENT);
packetdata.src_id_type = SILC_ID_CLIENT;
packetdata.dst_id = silc_id_id2str(client_entry->id, SILC_ID_CLIENT);
- packetdata.dst_id_len = SILC_ID_CLIENT_LEN;
+ packetdata.dst_id_len = silc_id_get_len(client_entry->id, SILC_ID_CLIENT);
packetdata.dst_id_type = SILC_ID_CLIENT;
packetdata.truelen = buffer->len + SILC_PACKET_HEADER_LEN +
packetdata.src_id_len + packetdata.dst_id_len;
sock->outbuf->data, sock->outbuf->len);
/* Now actually send the packet */
- silc_client_packet_send_real(client, sock, force_send);
+ silc_client_packet_send_real(client, sock, force_send, FALSE);
silc_free(packetdata.dst_id);
out:
goto out;
/* Check whether we know this client already */
- if (!silc_idcache_find_by_id_one(conn->client_cache, remote_id,
- SILC_ID_CLIENT, &id_cache)) {
+ if (!silc_idcache_find_by_id_one_ext(conn->client_cache, (void *)remote_id,
+ NULL, NULL,
+ silc_hash_client_id_compare, NULL,
+ &id_cache)) {
/* Resolve the client info */
silc_client_get_client_by_id_resolve(client, conn, remote_id,
silc_client_private_message_cb,
sender with the set away message. */
if (conn->away && conn->away->away) {
/* If it's me, ignore */
- if (!SILC_ID_CLIENT_COMPARE(remote_id, conn->local_id))
+ if (SILC_ID_CLIENT_COMPARE(remote_id, conn->local_id))
goto out;
/* Send the away message */
SilcIDCacheList list;
SilcClientEntry entry;
- if (!silc_idcache_find_by_id(conn->client_cache, SILC_ID_CACHE_ANY,
- SILC_ID_CLIENT, &list))
+ if (!silc_idcache_get_all(conn->client_cache, &list))
return NULL;
if (!silc_idcache_list_count(list)) {