From 46c5c1a93af64ca570d6d7330c0ea7a056def4a1 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 7 Nov 2008 15:06:26 +0100 Subject: [PATCH] inetcomm: Add an implementation of IPOP3Transport::CommandRETR. --- dlls/inetcomm/pop3transport.c | 52 +++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/dlls/inetcomm/pop3transport.c b/dlls/inetcomm/pop3transport.c index 36ae1359b21..8162fce3b7a 100644 --- a/dlls/inetcomm/pop3transport.c +++ b/dlls/inetcomm/pop3transport.c @@ -460,6 +460,40 @@ static void POP3Transport_CallbackRecvRSETResp(IInternetTransport *iface, char * InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackProcessRSETResp); } +void POP3Transport_CallbackProcessRETRResp(IInternetTransport *iface, char *pBuffer, int cbBuffer) +{ + POP3Transport *This = (POP3Transport *)iface; + POP3RESPONSE response; + HRESULT hr; + + TRACE("\n"); + + hr = POP3Transport_ParseResponse(This, pBuffer, &response); + if (FAILED(hr)) + { + /* FIXME: handle error */ + return; + } + + IPOP3Callback_OnResponse((IPOP3Callback *)This->InetTransport.pCallback, &response); + + if (!response.fDone) + { + InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackProcessRETRResp); + return; + } + + IPOP3Callback_OnResponse((IPOP3Callback *)This->InetTransport.pCallback, &response); +} + +static void POP3Transport_CallbackRecvRETRResp(IInternetTransport *iface, char *pBuffer, int cbBuffer) +{ + POP3Transport *This = (POP3Transport *)iface; + + TRACE("\n"); + InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackProcessRETRResp); +} + static void POP3Transport_CallbackProcessLISTResp(IInternetTransport *iface, char *pBuffer, int cbBuffer) { POP3Transport *This = (POP3Transport *)iface; @@ -956,8 +990,22 @@ static HRESULT WINAPI POP3Transport_CommandDELE( static HRESULT WINAPI POP3Transport_CommandRETR( IPOP3Transport *iface, POP3CMDTYPE cmdtype, DWORD dwPopId) { - FIXME("(%u, %u)\n", cmdtype, dwPopId); - return E_NOTIMPL; + static char retr[] = "RETR %u\r\n"; + POP3Transport *This = (POP3Transport *)iface; + char *command; + int len; + + TRACE("(%u, %u)\n", cmdtype, dwPopId); + + len = sizeof(retr) + 10 + 2; /* "4294967296" + "\r\n" */ + if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE; + sprintf(command, retr, dwPopId); + + init_parser(This, POP3_RETR, cmdtype); + InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvRETRResp); + + HeapFree(GetProcessHeap(), 0, command); + return S_OK; } static const IPOP3TransportVtbl POP3TransportVtbl =