]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/pop3client/serv_pop3client.c
POP3Client: stop client / db watchers before switching the context.
[citadel.git] / citadel / modules / pop3client / serv_pop3client.c
index 9784798cc6a58a4fcc4f8b24e199e3d58ced7ffa..2f6e69c0cd6962ec862cf287116e0c6b54b7a485 100644 (file)
@@ -386,7 +386,7 @@ eNextState POP3_FetchNetworkUsetableEntry(AsyncIO *IO)
                /* ok, now we know them all,
                 * continue with reading the actual messages. */
                DeleteHashPos(&RecvMsg->Pos);
-
+               StopDBWatchers(IO);
                return QueueEventContext(IO, POP3_C_ReAttachToFetchMessages);
        }
 }
@@ -524,7 +524,7 @@ eNextState POP3C_StoreMsgRead(AsyncIO *IO)
                  StrLength(RecvMsg->CurrMsg->MsgUID),
                  &ut,
                  sizeof(struct UseTable) );
-
+       StopDBWatchers(IO);
        return QueueEventContext(&RecvMsg->IO, POP3_C_ReAttachToFetchMessages);
 }
 eNextState POP3C_SaveMsg(AsyncIO *IO)
@@ -555,7 +555,7 @@ eNextState POP3C_ReadMessageBody(pop3aggr *RecvMsg)
        EVP3CM_syslog(LOG_DEBUG, "Converting message...");
        RecvMsg->CurrMsg->Msg =
                convert_internet_message_buf(&RecvMsg->IO.ReadMsg->MsgBuf);
-
+       StopClientWatchers(IO);
        return QueueDBOperation(&RecvMsg->IO, POP3C_SaveMsg);
 }
 
@@ -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);
+                               StrBufUrlescUPAppend(cptr->Url, cptr->pop3user, NULL);
+                               StrBufAppendBufPlain(cptr->Url, HKEY(":"), 0);
+                               StrBufUrlescUPAppend(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 */