diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2022-02-14 21:24:37 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2022-02-14 21:24:37 +0100 |
commit | aaff3fb225290e639780bbdcd0a8d0f5c0121a50 (patch) | |
tree | c1c8b763a803706e6f27c89f4914046c13b4e8d4 /src/main.c | |
parent | grem spat, ni testirano (diff) | |
download | discord.c-aaff3fb225290e639780bbdcd0a8d0f5c0121a50.tar discord.c-aaff3fb225290e639780bbdcd0a8d0f5c0121a50.tar.gz discord.c-aaff3fb225290e639780bbdcd0a8d0f5c0121a50.tar.bz2 discord.c-aaff3fb225290e639780bbdcd0a8d0f5c0121a50.tar.lz discord.c-aaff3fb225290e639780bbdcd0a8d0f5c0121a50.tar.xz discord.c-aaff3fb225290e639780bbdcd0a8d0f5c0121a50.tar.zst discord.c-aaff3fb225290e639780bbdcd0a8d0f5c0121a50.zip |
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -11,6 +11,12 @@ void dc_signal (int i) { dc_interrupted++; return; } +enum dc_status dc_print_message (struct dc_api_io o, void * n) { + fprintf(stderr, "dc_print_message: %s#%s %s#%04d: %s\n", o.message->channel->guild->name, + o.message->channel->name, o.message->user->username, + o.message->user->discriminator, o.message->message); + return DC_OK; +} 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])); @@ -28,6 +34,11 @@ int main (int argc, char * argv[]) { }; dc_api_i(i); signal(SIGINT, dc_signal); + i.type = DC_API_ATTACH; + i.attached_function = dc_attached_function_init(); + i.attached_function->type = DC_API_MESSAGE; + i.attached_function->function = dc_print_message; + dc_api_i(i); while (!dc_interrupted) i = dc_api_o(i); /* dc_ui(argc, argv); */ |