tRetrieve/Send nospam value as little-endian - ratox - FIFO based tox client
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f230db69ba81939b5e630e654ff21344cf3e11b2
 (DIR) parent c233413ccc73c58def0cd08862972ec824957758
 (HTM) Author: z3bra <contactatz3bradotorg>
       Date:   Thu, 10 Nov 2016 13:51:17 +0100
       
       Retrieve/Send nospam value as little-endian
       
       For readiness, nospam value is written in big endian in nospam/out.
       ttoxcore expect receiving it as little-endian, so we convert it upon
       calling the nospam get/setter.
       
       Diffstat:
         M ratox.c                             |       6 +++---
       
       1 file changed, 3 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/ratox.c b/ratox.c
       t@@ -1098,7 +1098,7 @@ localinit(void)
        
                /* Dump Nospam */
                ftruncate(gslots[NOSPAM].fd[OUT], 0);
       -        dprintf(gslots[NOSPAM].fd[OUT], "%08X\n", tox_self_get_nospam(tox));
       +        dprintf(gslots[NOSPAM].fd[OUT], "%08X\n", ntohl(tox_self_get_nospam(tox)));
        
                return 0;
        }
       t@@ -1505,8 +1505,8 @@ setnospam(void *data)
                        }
                }
        
       -        nsval = htonl(strtoul((char *)nospam, NULL, 16));
       -        tox_self_set_nospam(tox, nsval);
       +        nsval = strtoul((char *)nospam, NULL, 16);
       +        tox_self_set_nospam(tox, htonl(nsval));
                datasave();
                logmsg("Nospam > %08X\n", nsval);
                ftruncate(gslots[NOSPAM].fd[OUT], 0);