Hans Leidekker : inetcomm: Add an implementation of IPOP3Transport:: CommandTOP.
Alexandre Julliard
julliard at winehq.org
Mon Nov 10 07:43:50 CST 2008
Module: wine
Branch: master
Commit: ba1ae62bd290a1104a9d24cf87b10a9f93501cd5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ba1ae62bd290a1104a9d24cf87b10a9f93501cd5
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Nov 7 15:06:39 2008 +0100
inetcomm: Add an implementation of IPOP3Transport::CommandTOP.
---
dlls/inetcomm/pop3transport.c | 53 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/dlls/inetcomm/pop3transport.c b/dlls/inetcomm/pop3transport.c
index 8162fce..c11d00d 100644
--- a/dlls/inetcomm/pop3transport.c
+++ b/dlls/inetcomm/pop3transport.c
@@ -494,6 +494,40 @@ static void POP3Transport_CallbackRecvRETRResp(IInternetTransport *iface, char *
InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackProcessRETRResp);
}
+static void POP3Transport_CallbackProcessTOPResp(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_CallbackProcessTOPResp);
+ return;
+ }
+
+ IPOP3Callback_OnResponse((IPOP3Callback *)This->InetTransport.pCallback, &response);
+}
+
+static void POP3Transport_CallbackRecvTOPResp(IInternetTransport *iface, char *pBuffer, int cbBuffer)
+{
+ POP3Transport *This = (POP3Transport *)iface;
+
+ TRACE("\n");
+ InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackProcessTOPResp);
+}
+
static void POP3Transport_CallbackProcessLISTResp(IInternetTransport *iface, char *pBuffer, int cbBuffer)
{
POP3Transport *This = (POP3Transport *)iface;
@@ -902,8 +936,23 @@ static HRESULT WINAPI POP3Transport_CommandLIST(
static HRESULT WINAPI POP3Transport_CommandTOP(
IPOP3Transport *iface, POP3CMDTYPE cmdtype, DWORD dwPopId, DWORD cPreviewLines)
{
- FIXME("(%u, %u, %u)\n", cmdtype, dwPopId, cPreviewLines);
- return E_NOTIMPL;
+ static char top[] = "TOP %u %u\r\n";
+ POP3Transport *This = (POP3Transport *)iface;
+ char *command;
+ int len;
+
+ TRACE("(%u, %u, %u)\n", cmdtype, dwPopId, cPreviewLines);
+
+ len = sizeof(top) + 20 + 2; /* 2 * "4294967296" + "\r\n" */
+ if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE;
+ sprintf(command, top, dwPopId, cPreviewLines);
+
+ This->preview_lines = cPreviewLines;
+ init_parser(This, POP3_TOP, cmdtype);
+ InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvTOPResp);
+
+ HeapFree(GetProcessHeap(), 0, command);
+ return S_OK;
}
static HRESULT WINAPI POP3Transport_CommandQUIT(IPOP3Transport *iface)
More information about the wine-cvs
mailing list