Use a tokenizer for ParseRoomNetConfigFile() because StrBufSipLine() is skipping...
authorArt Cancro <ajc@citadel.org>
Fri, 1 Apr 2016 21:53:57 +0000 (17:53 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 1 Apr 2016 21:53:57 +0000 (17:53 -0400)
citadel/modules/rssclient/serv_rssclient.c
citadel/netconfig.c

index 4daba9bddb52e548a948250b0e3c7cdf24afc4bf..e482fff07aab7697b3376c57eec3ba1273c4a358 100644 (file)
@@ -793,6 +793,7 @@ void rssclient_scan_room(struct ctdlroom *qrbuf, void *data, OneRoomNetCfg *OneR
 
        while (RSSCfg != NULL)
        {
+               // syslog(LOG_DEBUG, "\033[32m RSSCfg %s for %s %d \033[0m", ((RSSCfg == NULL) ? "IS NULL" : "IS NOT NULL"), qrbuf->QRname, __LINE__);
                pthread_mutex_lock(&RSSQueueMutex);
                GetHash(RSSFetchUrls,
                        SKEY(RSSCfg->Url),
index 239ab731d06842069149011b281cb4ed28690c92..94b638bcb267179dc4bc527250bc31f7118c343a 100644 (file)
@@ -27,6 +27,7 @@
 # endif
 #endif
 #include <dirent.h>
+#include <assert.h>
 
 #include <libcitadel.h>
 
@@ -57,8 +58,9 @@ void RegisterRoomCfgType(const char* Name, long len, RoomNetCfg eCfg, CfgLinePar
        pCfg->Str.len = len;
        pCfg->IsSingleLine = uniq;
        pCfg->nSegments = nSegments;
-       if (CfgTypeHash == NULL)
+       if (CfgTypeHash == NULL) {
                CfgTypeHash = NewHash(1, NULL);
+       }
        Put(CfgTypeHash, Name, len, pCfg, NULL);
 }
 
@@ -235,12 +237,13 @@ char *LoadRoomNetConfigFile(long roomnum)
 OneRoomNetCfg *ParseRoomNetConfigFile(char *serialized_data)
 {
        const char *Pos = NULL;
-        const char *CPos = NULL;
        const CfgLineType *pCfg = NULL;
        StrBuf *Line = NULL;
        StrBuf *InStr = NULL;
        StrBuf *Cfg = NULL;
        OneRoomNetCfg *OneRNCfg = NULL;
+       int num_lines = 0;
+       int i = 0;
 
        OneRNCfg = malloc(sizeof(OneRoomNetCfg));
        memset(OneRNCfg, 0, sizeof(OneRoomNetCfg));
@@ -248,9 +251,10 @@ OneRoomNetCfg *ParseRoomNetConfigFile(char *serialized_data)
        Line = NewStrBuf();
        InStr = NewStrBuf();
         Cfg = NewStrBufPlain(serialized_data, -1);
+       num_lines = num_tokens(ChrPtr(Cfg), '\n');
 
-        while (StrBufSipLine(Line, Cfg, &CPos)) {
-
+       for (i=0; i<num_lines; ++i) {
+               StrBufExtract_token(Line, Cfg, i, '\n');
                if (StrLength(Line) > 0) {
                        Pos = NULL;
                        StrBufExtract_NextToken(InStr, Line, &Pos, '|');