X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=cgi%2Fcgi_blerg.c;h=ee0672b4b360a6db648913b335f58bdcae0ea427;hb=3e3138025852408ef03f3213972e042e12841bed;hp=8bd5189acbbc4fc760b739259d28b7b2cdad231f;hpb=5e89558c1afec270c54f4827380817e3ef8591f4;p=blerg.git diff --git a/cgi/cgi_blerg.c b/cgi/cgi_blerg.c index 8bd5189..ee0672b 100644 --- a/cgi/cgi_blerg.c +++ b/cgi/cgi_blerg.c @@ -404,14 +404,13 @@ int main(int argc, char *argv[]) { if (path[7] == 0) { /* No username */ const char *clear = cgi_getentrystr("clear"); - if (strncmp(clear, "feed", 4) == 0) { + if (clear != NULL) { struct blerg *b = blerg_open(username); - blerg_set_subscription_mark(b); - blerg_close(b); - respond_JSON_Success(); - } else if (strncmp(clear, "mentioned", 9) == 0) { - struct blerg *b = blerg_open(username); - blerg_set_status(b, BLERGSTATUS_MENTIONED, 0); + if (strncmp(clear, "feed", 4) == 0) { + blerg_set_subscription_mark(b); + } else if (strncmp(clear, "mentioned", 9) == 0) { + blerg_set_status(b, BLERGSTATUS_MENTIONED, 0); + } blerg_close(b); respond_JSON_Success(); } else { @@ -423,7 +422,7 @@ int main(int argc, char *argv[]) { int mentioned = blerg_get_status(b, BLERGSTATUS_MENTIONED); blerg_close(b); - yajl_gen_string(g, (unsigned char *)"feed_new", 7); + yajl_gen_string(g, (unsigned char *)"feed_new", 8); yajl_gen_integer(g, subscription_count_items(username) - subscription_mark); yajl_gen_string(g, (unsigned char *)"mentioned", 9); @@ -472,4 +471,6 @@ int main(int argc, char *argv[]) { } cgi_quit(); + + return 0; }