+ } else if (strcmp(action, "item_title") == EQUAL) {
+ if (act_par < data->item_count) {
+ str = data->items[act_par].title;
+ // remove trailing new line if one exists
+ if (str && strlen(str) > 0) {
+ if (str[strlen(str) - 1] == '\n') {
+ str[strlen(str) - 1] = 0;
+ }
+ snprintf(p, p_max_size, "%s", str);
+ }
+ }
+ } else if (strcmp(action, "item_desc") == EQUAL) {
+ if (act_par < data->item_count) {
+ str =
+ data->items[act_par].description;
+ // remove trailing new line if one exists
+ if (str && strlen(str) > 0) {
+ if (str[strlen(str) - 1] == '\n') {
+ str[strlen(str) - 1] = 0;
+ }
+ snprintf(p, p_max_size, "%s", str);
+ }
+ }
+ } else if (strcmp(action, "item_titles") == EQUAL) {
+ if (data->item_count > 0) {
+ int itmp;
+ int show;
+ //'tmpspaces' is a string with spaces too be placed in front of each title
+ char *tmpspaces = malloc(nrspaces + 1);
+ memset(tmpspaces, ' ', nrspaces);
+ tmpspaces[nrspaces]=0;
+
+ if (act_par > data->item_count) {
+ show = data->item_count;
+ } else {
+ show = act_par;
+ }
+ for (itmp = 0; itmp < show; itmp++) {
+ PRSS_Item *item = &data->items[itmp];
+
+ str = item->title;
+ if (str) {
+ // don't add new line before first item
+ if (itmp > 0) {
+ strncat(p, "\n", p_max_size);
+ }
+ /* remove trailing new line if one exists,
+ * we have our own */
+ if (strlen(str) > 0 && str[strlen(str) - 1] == '\n') {
+ str[strlen(str) - 1] = 0;
+ }
+ strncat(p, tmpspaces, p_max_size);
+ strncat(p, str, p_max_size);
+ }
+ }
+ free(tmpspaces);
+ }
+ } else {
+ NORM_ERR("rss: Invalid action '%s'", action);