blob: b202cdc538bc8cfcdfa64f8a95ae467f036fc216 (
plain) (
tree)
|
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <libwebsockets.h>
#include <assert.h>
#include <signal.h>
#include <lib.c>
#include <ui.c>
#include <api.c>
void dc_signal (int i) {
dc_interrupted++;
return;
}
int main (int argc, char * argv[]) {
if (DC_JSON_PATHS_LENGTH != sizeof(dc_json_paths)/sizeof(dc_json_paths[0]) || DC_JSON_PATHS_LENGTH > 255) {
fprintf(stderr, "json paths enum: %d, array: %d (255 is max, must be same)\n", DC_JSON_PATHS_LENGTH, sizeof(dc_json_paths)/sizeof(dc_json_paths[0]));
return 1;
}
struct dc_program * p = dc_program_init();
struct dc_client * client = dc_client_init();
lws_set_log_level(0xFF /* all message types */, NULL /* not change output location - cerr */);
client->email = strdup(getenv("DC_E"));
client->password = strdup(getenv("DC_P"));
struct dc_api_io i = {
.program = p,
.type = DC_API_LOGIN,
.client = client
};
dc_api_i(i);
signal(SIGINT, dc_signal);
while (!dc_interrupted)
i = dc_api_o(i);
/* dc_ui(argc, argv); */
dc_program_free(p, DC_UNSET);
return 0;
}
|