mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 00:13:01 +01:00
Merge pull request #292 from Ansa89/trivial-fix
Update for toxcore API break
This commit is contained in:
commit
428e1e4100
@ -150,7 +150,7 @@ static int save_blocklist(char *path)
|
||||
memset(&tmp, 0, sizeof(BlockedFriend));
|
||||
tmp.namelength = htons(Blocked.list[i].namelength);
|
||||
memcpy(tmp.name, Blocked.list[i].name, Blocked.list[i].namelength + 1);
|
||||
memcpy(tmp.pub_key, Blocked.list[i].pub_key, TOX_CLIENT_ID_SIZE);
|
||||
memcpy(tmp.pub_key, Blocked.list[i].pub_key, TOX_PUBLIC_KEY_SIZE);
|
||||
|
||||
uint8_t lastonline[sizeof(uint64_t)];
|
||||
memcpy(lastonline, &Blocked.list[i].last_on, sizeof(uint64_t));
|
||||
@ -232,7 +232,7 @@ int load_blocklist(char *path)
|
||||
Blocked.list[i].num = i;
|
||||
Blocked.list[i].namelength = ntohs(tmp.namelength);
|
||||
memcpy(Blocked.list[i].name, tmp.name, Blocked.list[i].namelength + 1);
|
||||
memcpy(Blocked.list[i].pub_key, tmp.pub_key, TOX_CLIENT_ID_SIZE);
|
||||
memcpy(Blocked.list[i].pub_key, tmp.pub_key, TOX_PUBLIC_KEY_SIZE);
|
||||
|
||||
uint8_t lastonline[sizeof(uint64_t)];
|
||||
memcpy(lastonline, &tmp.last_on, sizeof(uint64_t));
|
||||
@ -448,7 +448,7 @@ static void friendlist_add_blocked(Tox *m, int32_t fnum, int32_t bnum)
|
||||
Friends.list[i].namelength = Blocked.list[bnum].namelength;
|
||||
update_friend_last_online(i, Blocked.list[bnum].last_on);
|
||||
memcpy(Friends.list[i].name, Blocked.list[bnum].name, Friends.list[i].namelength + 1);
|
||||
memcpy(Friends.list[i].pub_key, Blocked.list[bnum].pub_key, TOX_CLIENT_ID_SIZE);
|
||||
memcpy(Friends.list[i].pub_key, Blocked.list[bnum].pub_key, TOX_PUBLIC_KEY_SIZE);
|
||||
|
||||
if (i == Friends.max_idx)
|
||||
++Friends.max_idx;
|
||||
@ -644,7 +644,7 @@ void block_friend(Tox *m, int32_t fnum)
|
||||
Blocked.list[i].num = i;
|
||||
Blocked.list[i].namelength = Friends.list[fnum].namelength;
|
||||
Blocked.list[i].last_on = Friends.list[fnum].last_online.last_on;
|
||||
memcpy(Blocked.list[i].pub_key, Friends.list[fnum].pub_key, TOX_CLIENT_ID_SIZE);
|
||||
memcpy(Blocked.list[i].pub_key, Friends.list[fnum].pub_key, TOX_PUBLIC_KEY_SIZE);
|
||||
memcpy(Blocked.list[i].name, Friends.list[fnum].name, Friends.list[fnum].namelength + 1);
|
||||
|
||||
++Blocked.num_blocked;
|
||||
@ -823,7 +823,7 @@ static void blocklist_onDraw(ToxWindow *self, Tox *m, int y2, int x2)
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < TOX_CLIENT_ID_SIZE; ++i)
|
||||
for (i = 0; i < TOX_PUBLIC_KEY_SIZE; ++i)
|
||||
wprintw(self->window, "%02X", Blocked.list[selected_num].pub_key[i] & 0xff);
|
||||
}
|
||||
|
||||
@ -1012,7 +1012,7 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < TOX_CLIENT_ID_SIZE; ++i)
|
||||
for (i = 0; i < TOX_PUBLIC_KEY_SIZE; ++i)
|
||||
wprintw(self->window, "%02X", Friends.list[selected_num].pub_key[i] & 0xff);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ typedef struct {
|
||||
int namelength;
|
||||
char statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH + 1];
|
||||
uint16_t statusmsg_len;
|
||||
char pub_key[TOX_CLIENT_ID_SIZE];
|
||||
char pub_key[TOX_PUBLIC_KEY_SIZE];
|
||||
int32_t num;
|
||||
int chatwin;
|
||||
bool active;
|
||||
@ -77,7 +77,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
char name[TOXIC_MAX_NAME_LENGTH + 1];
|
||||
int namelength;
|
||||
char pub_key[TOX_CLIENT_ID_SIZE];
|
||||
char pub_key[TOX_PUBLIC_KEY_SIZE];
|
||||
int32_t num;
|
||||
bool active;
|
||||
uint64_t last_on;
|
||||
|
@ -507,9 +507,9 @@ void cmd_requests(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
|
||||
if (!FrndRequests.request[i].active)
|
||||
continue;
|
||||
|
||||
char id[TOX_CLIENT_ID_SIZE * 2 + 1] = {0};
|
||||
char id[TOX_PUBLIC_KEY_SIZE * 2 + 1] = {0};
|
||||
|
||||
for (j = 0; j < TOX_CLIENT_ID_SIZE; ++j) {
|
||||
for (j = 0; j < TOX_PUBLIC_KEY_SIZE; ++j) {
|
||||
char d[3];
|
||||
snprintf(d, sizeof(d), "%02X", FrndRequests.request[i].key[j] & 0xff);
|
||||
strcat(id, d);
|
||||
|
@ -145,7 +145,7 @@ static int add_friend_request(const char *public_key, const char *data)
|
||||
for (i = 0; i <= FrndRequests.max_idx; ++i) {
|
||||
if (!FrndRequests.request[i].active) {
|
||||
FrndRequests.request[i].active = true;
|
||||
memcpy(FrndRequests.request[i].key, public_key, TOX_CLIENT_ID_SIZE);
|
||||
memcpy(FrndRequests.request[i].key, public_key, TOX_PUBLIC_KEY_SIZE);
|
||||
snprintf(FrndRequests.request[i].msg, sizeof(FrndRequests.request[i].msg), "%s", data);
|
||||
|
||||
if (i == FrndRequests.max_idx)
|
||||
|
@ -31,7 +31,7 @@
|
||||
struct friend_request {
|
||||
bool active;
|
||||
char msg[MAX_STR_SIZE];
|
||||
uint8_t key[TOX_CLIENT_ID_SIZE];
|
||||
uint8_t key[TOX_PUBLIC_KEY_SIZE];
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -324,13 +324,13 @@ static Tox *init_tox(void)
|
||||
#define MIN_NODE_LINE 50 /* IP: 7 + port: 5 + key: 38 + spaces: 2 = 70. ! (& e.g. tox.im = 6) */
|
||||
#define MAX_NODE_LINE 256 /* Approx max number of chars in a sever line (name + port + key) */
|
||||
#define MAXNODES 50
|
||||
#define NODELEN (MAX_NODE_LINE - TOX_CLIENT_ID_SIZE - 7)
|
||||
#define NODELEN (MAX_NODE_LINE - TOX_PUBLIC_KEY_SIZE - 7)
|
||||
|
||||
static struct toxNodes {
|
||||
int lines;
|
||||
char nodes[MAXNODES][NODELEN];
|
||||
uint16_t ports[MAXNODES];
|
||||
char keys[MAXNODES][TOX_CLIENT_ID_SIZE];
|
||||
char keys[MAXNODES][TOX_PUBLIC_KEY_SIZE];
|
||||
} toxNodes;
|
||||
|
||||
static int load_nodelist(const char *filename)
|
||||
@ -360,7 +360,7 @@ static int load_nodelist(const char *filename)
|
||||
toxNodes.ports[toxNodes.lines] = atoi(port);
|
||||
|
||||
char *key_binary = hex_string_to_bin(key_ascii);
|
||||
memcpy(toxNodes.keys[toxNodes.lines], key_binary, TOX_CLIENT_ID_SIZE);
|
||||
memcpy(toxNodes.keys[toxNodes.lines], key_binary, TOX_PUBLIC_KEY_SIZE);
|
||||
free(key_binary);
|
||||
|
||||
toxNodes.lines++;
|
||||
|
Loading…
Reference in New Issue
Block a user