* html_to_ascii appends a \n, we don't like that neither in our subjects nor in our...
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 19 Sep 2010 10:45:15 +0000 (12:45 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 19 Sep 2010 10:45:15 +0000 (12:45 +0200)
citadel/modules/rssclient/serv_rssclient.c

index f59571db14586dd23ec636c45d5c51f3d44c88db..9a1a7688e1483dde839b25ff249c7f2f6e33896a 100644 (file)
@@ -409,14 +409,21 @@ void rss_save_item(rss_item *ri)
                        StrBuf *EmailAddress;
                        StrBuf *EncBuf;
                        int FromAt;
+                       int FromLen;
                        
                        UserName = NewStrBuf();
                        EmailAddress = NewStrBuf();
                        EncBuf = NewStrBuf();
 ////TODO!
+                       StrBufTrim(ri->author_or_creator);
                        From = html_to_ascii(ChrPtr(ri->author_or_creator),
                                             StrLength(ri->author_or_creator), 
                                             512, 0);
+                       FromLen = strlen(From);
+                       if (From[FromLen - 1] == '\n')
+                       {
+                               From[FromLen - 1] = '\0';
+                       }
                        FromAt = strchr(From, '@') != NULL;
                        if (!FromAt && StrLength (ri->author_email) > 0)
                        {
@@ -473,7 +480,13 @@ void rss_save_item(rss_item *ri)
                        StrBufSpaceToBlank(ri->title);
                        len = StrLength(ri->title);
                        Sbj = html_to_ascii(ChrPtr(ri->title), len, 512, 0);
-                       Encoded = NewStrBufPlain(Sbj, -1);
+                       len = strlen(Sbj);
+                       if (Sbj[len - 1] == '\n')
+                       {
+                               len --;
+                               Sbj[len] = '\0';
+                       }
+                       Encoded = NewStrBufPlain(Sbj, len);
                        free(Sbj);
 
                        StrBufTrim(Encoded);