From 583cf346017c05df6e06d552313608a1789943a0 Mon Sep 17 00:00:00 2001 From: sijanec Date: Thu, 18 Mar 2021 14:25:47 +0100 Subject: removed network debugger --- README.md | 7 ++++++- src/api.c | 10 ++++++---- src/main.c | 7 +++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e5b15da..295148c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ an alternative client for the discord messaging platform, written in the C progr * GNU compiler collection * GNU Make * libcurl 7.17.0 or newer with HTTPS support -* ncursesw +* ncursesw 6 ## instructions @@ -17,3 +17,8 @@ an alternative client for the discord messaging platform, written in the C progr make ./discord.c -e email@address.example -p password ``` + +## missing features + +* direct messages +* check for permissions before join diff --git a/src/api.c b/src/api.c index e456e53..3460edb 100644 --- a/src/api.c +++ b/src/api.c @@ -285,8 +285,10 @@ cJSON * dc_api (struct dc_client * c, char * body, int isfmt, char * endpoint, . } else { curl_easy_getinfo(c->curl, CURLINFO_RESPONSE_CODE, &response_code); } +#ifdef DC_NETREQ fprintf(netreq, "%s\n%s\n%s\n%s====================================\n", endpoint_formatted ? endpoint_formatted : endpoint, body ? body : "GET", h->ptr, s->ptr); fflush(netreq); +#endif char * cp = strstr(h->ptr, "\nx-ratelimit-reset-after: "); if (cp == NULL) goto norlheaders; @@ -480,17 +482,17 @@ int dc_fetch_channels (struct dc_guild * g) { goto rc; } cJSON * channel = NULL; - cJSON * perms = NULL; - cJSON * perm = NULL; + /* cJSON * perms = NULL; */ /* I'll rather not remove the channels with perms and let the user get banned for joining a channel without perms */ + /* cJSON * perm = NULL; */ /* we lock all client guilds when doing stuff with channels */ if (DC_CWLE(c, c->guilds_lock)) {rs = -7; goto rc;} cJSON_ArrayForEach(channel, json) { int skip = 0; - if (cJSON_IsArray(perms = cJSON_GetObjectItem(channel, "permission_overwrites"))); /* not supported */ + /* if (cJSON_IsArray(perms = cJSON_GetObjectItem(channel, "permission_overwrites"))); cJSON_ArrayForEach(perm, perms) { skip++; } - if (skip) continue; + if (skip) continue; */ char * topic = cJSON_GetStringValue(cJSON_GetObjectItem(channel, "topic")); char * name = cJSON_GetStringValue(cJSON_GetObjectItem(channel, "name")); char * id = cJSON_GetStringValue(cJSON_GetObjectItem(channel, "id")); diff --git a/src/main.c b/src/main.c index 340af42..df55b80 100644 --- a/src/main.c +++ b/src/main.c @@ -1,10 +1,15 @@ #define _XOPEN_SOURCE 600 #include +/* #define DC_NETREQ */ +#ifdef DC_NETREQ FILE * netreq; +#endif #include int main (int argc, char ** argv) { srand(time(NULL)); +#ifdef DC_NETREQ netreq = fopen("netreq.log", "w"); +#endif int rs = 0; int opt; pthread_t api_thread, ui_thread; @@ -67,7 +72,9 @@ int main (int argc, char ** argv) { pthread_join(api_thread, NULL); pthread_join(ui_thread, NULL); rc: +#ifdef DC_NETREQ fclose(netreq); +#endif dc_client_free(c); if (api_ret || ui_ret); /* to hide warnings */ return rs; -- cgit v1.2.3