summaryrefslogtreecommitdiff
path: root/regexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'regexp.c')
-rw-r--r--regexp.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/regexp.c b/regexp.c
index bf446f3..4631cbd 100644
--- a/regexp.c
+++ b/regexp.c
@@ -252,32 +252,41 @@ bool cRegexp::Apply(cEvent *Event)
while (i < 10) {
if (pcre_get_named_substring(re, tmpstring, ovector, rc, strBackrefs[i], &string) != PCRE_ERROR_NOSUBSTRING) {
switch (i) {
- case TITLE:
- Event->SetTitle(string);
- break;
case ATITLE:
- Event->SetTitle(*cString::sprintf("%s %s", Event->Title(), string));
- break;
case PTITLE:
- Event->SetTitle(*cString::sprintf("%s %s", string, Event->Title()));
- break;
- case SHORTTEXT:
- Event->SetShortText(string);
+ if (Event->Title()) {
+ if (i == ATITLE)
+ Event->SetTitle(*cString::sprintf("%s %s", Event->Title(), string));
+ else
+ Event->SetTitle(*cString::sprintf("%s %s", string, Event->Title()));
+ break;
+ }
+ case TITLE:
+ Event->SetTitle(string);
break;
case ASHORTTEXT:
- Event->SetShortText(*cString::sprintf("%s %s", Event->ShortText(), string));
- break;
case PSHORTTEXT:
- Event->SetShortText(*cString::sprintf("%s %s", string, Event->ShortText()));
- break;
- case DESCRIPTION:
- Event->SetDescription(string);
+ if (Event->ShortText()) {
+ if (i == ASHORTTEXT)
+ Event->SetShortText(*cString::sprintf("%s %s", Event->ShortText(), string));
+ else
+ Event->SetShortText(*cString::sprintf("%s %s", string, Event->ShortText()));
+ break;
+ }
+ case SHORTTEXT:
+ Event->SetShortText(string);
break;
case ADESCRIPTION:
- Event->SetDescription(*cString::sprintf("%s %s", Event->Description(), string));
- break;
case PDESCRIPTION:
- Event->SetDescription(*cString::sprintf("%s %s", string, Event->Description()));
+ if (Event->Description()) {
+ if (i == ADESCRIPTION)
+ Event->SetDescription(*cString::sprintf("%s %s", Event->Description(), string));
+ else
+ Event->SetDescription(*cString::sprintf("%s %s", string, Event->Description()));
+ break;
+ }
+ case DESCRIPTION:
+ Event->SetDescription(string);
break;
case RATING:
Event->SetParentalRating(atoi(string));