X-Git-Url: https://git.wpitchoune.net/gitweb/?p=prss.git;a=blobdiff_plain;f=src%2Fttrss_ws.c;h=f34aaf1b04688c30f2ca02b954966809bddcfe2e;hp=cdd7296880ad9866a9e247d91e82a76f3574511b;hb=09a826a93753ebb1b82fbc30574c034f084e02b8;hpb=ba998dd7b5a61fc2a1fa25538dc370eff0368c2c diff --git a/src/ttrss_ws.c b/src/ttrss_ws.c index cdd7296..f34aaf1 100644 --- a/src/ttrss_ws.c +++ b/src/ttrss_ws.c @@ -24,6 +24,7 @@ #include #include "http.h" +#include "log.h" #include "ttrss_ws.h" #include "url.h" @@ -142,14 +143,15 @@ char *ws_login() rp = ws_execute(rq); json_object_put(rq); + str = NULL; if (rp) { j = json_object_object_get(rp, "session_id"); - str = strdup(json_object_get_string(j)); + + if (j) + str = strdup(json_object_get_string(j)); json_object_put(rp); - } else { - str = NULL; - } + } return str; } @@ -165,7 +167,7 @@ int ws_open_session() if (session_id) { version = ws_get_api_version(); - printf("API version: %d\n", version); + log_debug("API version= %d", version); if (version > 0) { result = 1; @@ -266,7 +268,7 @@ struct feed **ws_update_feeds(struct feed **feeds) struct feed *feed, **tmp; const char *title, *url; - printf("ttrss_get_feeds\n"); + log_debug("ttrss_get_feeds()"); rq = ws_request_new("getFeeds"); @@ -296,8 +298,6 @@ struct feed **ws_update_feeds(struct feed **feeds) tmp = feeds_add(feeds, feed); free(feeds); feeds = tmp; - } else { - printf("found!\n"); } j = json_object_object_get(jfeed, "unread"); @@ -310,7 +310,7 @@ struct feed **ws_update_feeds(struct feed **feeds) json_object_put(rp); - printf("ttrss_get_feeds ended\n"); + log_debug("ttrss_get_feeds() done"); return feeds; }