- CitContext *SubC;
-
- cpptr->IO.Data = cpptr;
-
- cpptr->IO.SendDone = POP3_C_DispatchWriteDone;
- cpptr->IO.ReadDone = POP3_C_DispatchReadDone;
- cpptr->IO.Terminate = POP3_C_Terminate;
- cpptr->IO.LineReader = POP3_C_ReadServerStatus;
- cpptr->IO.ConnFail = POP3_C_ConnFail;
- cpptr->IO.Timeout = POP3_C_Timeout;
- cpptr->IO.ShutdownAbort = POP3_C_Shutdown;
-
- cpptr->IO.SendBuf.Buf = NewStrBufPlain(NULL, 1024);
- cpptr->IO.RecvBuf.Buf = NewStrBufPlain(NULL, 1024);
- cpptr->IO.IOBuf = NewStrBuf();
-
- cpptr->IO.NextState = eReadMessage;
-/* TODO
- CtdlLogPrintf(CTDL_DEBUG, "POP3: %s %s %s <password>\n", roomname, pop3host, pop3user);
- CtdlLogPrintf(CTDL_NOTICE, "Connecting to <%s>\n", pop3host);
-*/
-
- SubC = CloneContext (&pop3_client_CC);
- SubC->session_specific_data = (char*) cpptr;
- cpptr->IO.CitContext = SubC;
+ InitIOStruct(&cpptr->IO,
+ cpptr,
+ eReadMessage,
+ POP3_C_ReadServerStatus,
+ POP3_C_DNSFail,
+ POP3_C_DispatchWriteDone,
+ POP3_C_DispatchReadDone,
+ POP3_C_Terminate,
+ POP3_C_ConnFail,
+ POP3_C_Timeout,
+ POP3_C_Shutdown);
+
+ safestrncpy(((CitContext *)cpptr->IO.CitContext)->cs_host,
+ ChrPtr(cpptr->Url),
+ sizeof(((CitContext *)cpptr->IO.CitContext)->cs_host));