Skip to content

Commit

Permalink
Clarified and fixed save format of friends.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinlinden committed Nov 21, 2016
1 parent aa5e3ab commit 10382ca
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/tox/Network/Tox.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -3459,23 +3459,18 @@ Friend:
Some of the integers in this structure are stored in Big Endian. This is
denoted with "(BE)".

Unfortunately, toxcore copies the friend structure directly from memory to the
state file. This makes the state format platform dependent because the way a
structure is laid out in memory differs across platforms and compilers. A
common layout of this structure in memory (GCC on x86 and x86\_64) is described
below and should be accounted for both when serializing and deserializing the
state file.

\begin{tabular}{l|l}
Length & Contents \\
\hline
\texttt{1} & \texttt{uint8_t} Status \\
\texttt{32} & Long term public key \\
\texttt{1024} & Friend request message as a UTF-8 encoded string \\
\texttt{1024} & Friend request message as a byte string \\
\texttt{1} & PADDING \\
\texttt{2} & \texttt{uint16_t} Size of the friend request message (BE) \\
\texttt{128} & Name as a UTF-8 encoded string \\
\texttt{128} & Name as a byte string \\
\texttt{2} & \texttt{uint16_t} Size of the name (BE) \\
\texttt{1007} & Status message as a UTF-8 encoded string \\
\texttt{1007} & Status message as a byte string \\
\texttt{1} & PADDING \\
\texttt{2} & \texttt{uint16_t} Size of the status message (BE) \\
\texttt{1} & \texttt{uint8_t} User status (see also: \texttt{USERSTATUS}) \\
\texttt{3} & PADDING \\
Expand Down

0 comments on commit 10382ca

Please sign in to comment.