From 29283b52b56239766bc1d9d450c979e4323c4cea Mon Sep 17 00:00:00 2001 From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz> Date: Thu, 22 Apr 2021 18:00:40 +0200 Subject: [PATCH] Working with long messages --- not2osd | 4 ++-- osdd-run | 2 +- osdd.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/not2osd b/not2osd index 7c87578..d26465e 100755 --- a/not2osd +++ b/not2osd @@ -73,8 +73,8 @@ class NotificationFetcher(dbus.service.Object): #print("body", body) #print("actions", actions) #print("expire_timeout", expire_timeout) - su = strip_tags((summary)).split("\n") - bo = strip_tags((body)).split("\n") + su = strip_tags(summary[0:300]).split("\n") + bo = strip_tags(body[0:500]).split("\n") for i in range(len(su)): if su[i]!="" and su[i][0]=='-': su[i] = ' '+su[i]; diff --git a/osdd-run b/osdd-run index 26d6d66..5ce1ebc 100755 --- a/osdd-run +++ b/osdd-run @@ -3,7 +3,7 @@ cd "$(dirname "$0")" killall osdd pkill -f not2osd -not2osd & +./not2osd & tmp=$(mktemp) echo "Xft.render: False" > $tmp XENVIRONMENT=$tmp \ diff --git a/osdd.c b/osdd.c index 0ffa5f4..f4e56b8 100644 --- a/osdd.c +++ b/osdd.c @@ -250,11 +250,12 @@ parse_msg(unsigned char *buf, int len) msg->alocated_data=line; bool is_output_set=0; - while (*line) + while (line && *line) { // The parser is destructive, but it does not do any harm, since we display each message only once. char *nl = strchr(line, '\n'); - *nl++ = 0; + if(nl) *nl++ = 0; + else fprintf(stderr,"MISSING END NL!\n"); char *key; char *val = strchr(line, ':'); -- GitLab