diff options
Diffstat (limited to '')
-rw-r--r-- | close_direct_conversations/CMakeLists.txt | 6 | ||||
-rw-r--r-- | close_direct_conversations/main.c (renamed from close_im/main.c) | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/close_direct_conversations/CMakeLists.txt b/close_direct_conversations/CMakeLists.txt new file mode 100644 index 0000000..7aba3e4 --- /dev/null +++ b/close_direct_conversations/CMakeLists.txt @@ -0,0 +1,6 @@ +file(GLOB_RECURSE SOURCES *.c) + +ADD_EXECUTABLE(rocket_close_direct_conversations ${SOURCES}) +target_link_libraries(rocket_close_direct_conversations common restapi) + +install(TARGETS rocket_close_direct_conversations DESTINATION bin) diff --git a/close_im/main.c b/close_direct_conversations/main.c index c54ab25..0938982 100644 --- a/close_im/main.c +++ b/close_direct_conversations/main.c @@ -1,12 +1,19 @@ -#include "common/util.h" #include <stdlib.h> #include <stdio.h> #include <termios.h> #include <unistd.h> #include "common/config.h" +#include "common/util.h" #include "restapi/auth.h" #include "restapi/im.h" +#include "restapi/subscriptions.h" + +void print_subscription(const struct subscription* sub) +{ + if (sub->type == SUBSCRIPTION_DIRECT) + printf("\t%s\n", sub->name); +} int main(void) { @@ -51,10 +58,16 @@ int main(void) } if (restapi_login(login, password) == 0) { + struct subscription* subscriptions = restapi_subscriptions_get(); + + printf("Active direct conversations :\n"); + common_subscriptions_const_walk(subscriptions, &print_subscription); + common_subscriptions_free(subscriptions); + while(1) { char* buff = NULL; size_t len2; - printf("IM to close: "); + printf("Direct conversation to close: "); ssize_t entry = getline(&buff, &len2, stdin); if (entry > 1) { buff[entry-1] = 0; |