]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/pop3client/serv_pop3client.c
POP3Client: escape URL parts
[citadel.git] / citadel / modules / pop3client / serv_pop3client.c
index 9784798cc6a58a4fcc4f8b24e199e3d58ced7ffa..764293c317eb8e80b548b7de0296cd16c964316e 100644 (file)
@@ -1067,11 +1067,15 @@ void pop3client_scan_room(struct ctdlroom *qrbuf, void *data)
                                                                        &lPtr,
                                                                        '|');
 
-                               StrBufPrintf(cptr->Url, "pop3://%s:%s@%s/%s",
-                                            ChrPtr(cptr->pop3user),
-                                            ChrPtr(cptr->pop3pass),
-                                            ChrPtr(Tmp),
-                                            ChrPtr(cptr->RoomName));
+                               StrBufAppendBufPlain(cptr->Url, HKEY("pop3://"), 0);
+                               StrBufUrlescAppend(cptr->Url, cptr->pop3user, NULL);
+                               StrBufAppendBufPlain(cptr->Url, HKEY(":"), 0);
+                               StrBufUrlescAppend(cptr->Url, cptr->pop3pass, NULL);
+                               StrBufAppendBufPlain(cptr->Url, HKEY("@"), 0);
+                               StrBufAppendBuf(cptr->Url, Tmp, 0);
+                               StrBufAppendBufPlain(cptr->Url, HKEY("/"), 0);
+                               StrBufUrlescAppend(cptr->Url, cptr->RoomName, NULL);
+
                                FreeStrBuf(&Tmp);
                                ParseURL(&cptr->IO.ConnectMe, cptr->Url, 110);
 
@@ -1214,9 +1218,9 @@ void pop3_cleanup(void)
 
 
 
-void LogDebugEnablePOP3Client(void)
+void LogDebugEnablePOP3Client(const int n)
 {
-       POP3ClientDebugEnabled = 1;
+       POP3ClientDebugEnabled = n;
 }
 
 CTDL_MODULE_INIT(pop3client)
@@ -1229,7 +1233,7 @@ CTDL_MODULE_INIT(pop3client)
                POP3FetchUrls = NewHash(1, NULL);
                CtdlRegisterSessionHook(pop3client_scan, EVT_TIMER);
                CtdlRegisterEVCleanupHook(pop3_cleanup);
-               CtdlRegisterDebugFlagHook(HKEY("pop3client"), LogDebugEnablePOP3Client);
+               CtdlRegisterDebugFlagHook(HKEY("pop3client"), LogDebugEnablePOP3Client, &POP3ClientDebugEnabled);
        }
 
        /* return our module id for the log */