projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updates.
[silc.git]
/
lib
/
silccore
/
silcprivate.c
diff --git
a/lib/silccore/silcprivate.c
b/lib/silccore/silcprivate.c
index 45e81d8544408dcb0fc5f9b2bf7fd417997f3c6e..41d948e2daeddec433a9238ce9b3ab84cbd7bd42 100644
(file)
--- a/
lib/silccore/silcprivate.c
+++ b/
lib/silccore/silcprivate.c
@@
-32,9
+32,9
@@
/* Private Message Payload structure. Contents of this structure is parsed
from SILC packets. */
struct SilcPrivateMessagePayloadStruct {
/* Private Message Payload structure. Contents of this structure is parsed
from SILC packets. */
struct SilcPrivateMessagePayloadStruct {
+ unsigned short flags;
unsigned short nickname_len;
unsigned char *nickname;
unsigned short nickname_len;
unsigned char *nickname;
- unsigned short flags;
unsigned short message_len;
unsigned char *message;
};
unsigned short message_len;
unsigned char *message;
};
@@
-59,9
+59,9
@@
silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher)
/* Parse the Private Message Payload. Ignore the padding. */
ret = silc_buffer_unformat(buffer,
/* Parse the Private Message Payload. Ignore the padding. */
ret = silc_buffer_unformat(buffer,
+ SILC_STR_UI_SHORT(&new->flags),
SILC_STR_UI16_NSTRING_ALLOC(&new->nickname,
&new->nickname_len),
SILC_STR_UI16_NSTRING_ALLOC(&new->nickname,
&new->nickname_len),
- SILC_STR_UI_SHORT(&new->flags),
SILC_STR_UI16_NSTRING_ALLOC(&new->message,
&new->message_len),
SILC_STR_END);
SILC_STR_UI16_NSTRING_ALLOC(&new->message,
&new->message_len),
SILC_STR_END);
@@
-86,9
+86,9
@@
silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher)
the cipher is provided the packet is also encrypted here. It is provided
if the private message private keys are used. */
the cipher is provided the packet is also encrypted here. It is provided
if the private message private keys are used. */
-SilcBuffer silc_private_message_payload_encode(unsigned int nickname_len,
+SilcBuffer silc_private_message_payload_encode(unsigned short flags,
+ unsigned int nickname_len,
unsigned char *nickname,
unsigned char *nickname,
- unsigned short flags,
unsigned short data_len,
unsigned char *data,
SilcCipher cipher)
unsigned short data_len,
unsigned char *data,
SilcCipher cipher)
@@
-100,7
+100,7
@@
SilcBuffer silc_private_message_payload_encode(unsigned int nickname_len,
SILC_LOG_DEBUG(("Encoding private message payload"));
SILC_LOG_DEBUG(("Encoding private message payload"));
- len =
2 + nickname_len + 4
+ data_len;
+ len =
4 + nickname_len + 2
+ data_len;
if (cipher) {
/* Calculate length of padding. */
if (cipher) {
/* Calculate length of padding. */
@@
-117,9
+117,9
@@
SilcBuffer silc_private_message_payload_encode(unsigned int nickname_len,
/* Encode the Channel Message Payload */
silc_buffer_pull_tail(buffer, SILC_BUFFER_END(buffer));
silc_buffer_format(buffer,
/* Encode the Channel Message Payload */
silc_buffer_pull_tail(buffer, SILC_BUFFER_END(buffer));
silc_buffer_format(buffer,
+ SILC_STR_UI_SHORT(flags),
SILC_STR_UI_SHORT(nickname_len),
SILC_STR_UI_XNSTRING(nickname, nickname_len),
SILC_STR_UI_SHORT(nickname_len),
SILC_STR_UI_XNSTRING(nickname, nickname_len),
- SILC_STR_UI_SHORT(flags),
SILC_STR_UI_SHORT(data_len),
SILC_STR_UI_XNSTRING(data, data_len),
SILC_STR_UI_XNSTRING(pad, pad_len),
SILC_STR_UI_SHORT(data_len),
SILC_STR_UI_XNSTRING(data, data_len),
SILC_STR_UI_XNSTRING(pad, pad_len),
@@
-147,6
+147,14
@@
void silc_private_message_payload_free(SilcPrivateMessagePayload payload)
silc_free(payload);
}
silc_free(payload);
}
+/* Return flags */
+
+unsigned short
+silc_private_message_get_flags(SilcPrivateMessagePayload payload)
+{
+ return payload->flags;
+}
+
/* Return nickname */
unsigned char *
/* Return nickname */
unsigned char *
@@
-170,11
+178,3
@@
silc_private_message_get_message(SilcPrivateMessagePayload payload,
return payload->message;
}
return payload->message;
}
-
-/* Return flags */
-
-unsigned short
-silc_private_message_get_flags(SilcPrivateMessagePayload payload)
-{
- return payload->flags;
-}