inetcomm: Only set the command type when the command expects a reply.

This commit is contained in:
Alexandre Julliard 2013-06-17 12:47:18 +02:00
parent ee66470477
commit 1020a7b00f
1 changed files with 19 additions and 15 deletions

View File

@ -311,11 +311,10 @@ static HRESULT parse_top_response(POP3Transport *This, POP3TOP *top)
}
}
static void init_parser(POP3Transport *This, POP3COMMAND command, POP3CMDTYPE type)
static void init_parser(POP3Transport *This, POP3COMMAND command)
{
This->state = STATE_NONE;
This->command = command;
This->type = type;
}
static HRESULT POP3Transport_ParseResponse(POP3Transport *This, char *pszResponse, POP3RESPONSE *pResponse)
@ -659,7 +658,7 @@ static void POP3Transport_CallbackProcessUSERResp(IInternetTransport *iface, cha
strcat(command, This->InetTransport.ServerInfo.szPassword);
strcat(command, "\r\n");
init_parser(This, POP3_PASS, POP3_NONE);
init_parser(This, POP3_PASS);
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvPASSResp);
HeapFree(GetProcessHeap(), 0, command);
@ -800,7 +799,7 @@ static HRESULT WINAPI POP3Transport_Connect(IPOP3Transport *iface,
if (FAILED(hr))
return hr;
init_parser(This, POP3_USER, POP3_NONE);
init_parser(This, POP3_USER);
return InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackSendUSERCmd);
}
@ -885,7 +884,7 @@ static HRESULT WINAPI POP3Transport_CommandUSER(IPOP3Transport *iface, LPSTR use
strcat(command, username);
strcat(command, "\r\n");
init_parser(This, POP3_USER, POP3_NONE);
init_parser(This, POP3_USER);
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvUSERResp);
HeapFree(GetProcessHeap(), 0, command);
@ -908,7 +907,7 @@ static HRESULT WINAPI POP3Transport_CommandPASS(IPOP3Transport *iface, LPSTR pas
strcat(command, password);
strcat(command, "\r\n");
init_parser(This, POP3_PASS, POP3_NONE);
init_parser(This, POP3_PASS);
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvPASSResp);
HeapFree(GetProcessHeap(), 0, command);
@ -934,7 +933,8 @@ static HRESULT WINAPI POP3Transport_CommandLIST(
}
else command = list_all;
init_parser(This, POP3_LIST, cmdtype);
init_parser(This, POP3_LIST);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvLISTResp);
if (dwPopId) HeapFree(GetProcessHeap(), 0, command);
@ -956,7 +956,8 @@ static HRESULT WINAPI POP3Transport_CommandTOP(
sprintf(command, top, dwPopId, cPreviewLines);
This->preview_lines = cPreviewLines;
init_parser(This, POP3_TOP, cmdtype);
init_parser(This, POP3_TOP);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvTOPResp);
HeapFree(GetProcessHeap(), 0, command);
@ -972,7 +973,7 @@ static HRESULT WINAPI POP3Transport_CommandQUIT(IPOP3Transport *iface)
InternetTransport_ChangeStatus(&This->InetTransport, IXP_DISCONNECTING);
init_parser(This, POP3_QUIT, POP3_NONE);
init_parser(This, POP3_QUIT);
return InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvQUITResp);
}
@ -983,7 +984,7 @@ static HRESULT WINAPI POP3Transport_CommandSTAT(IPOP3Transport *iface)
TRACE("\n");
init_parser(This, POP3_STAT, POP3_NONE);
init_parser(This, POP3_STAT);
InternetTransport_DoCommand(&This->InetTransport, stat, POP3Transport_CallbackRecvSTATResp);
return S_OK;
}
@ -995,7 +996,7 @@ static HRESULT WINAPI POP3Transport_CommandNOOP(IPOP3Transport *iface)
TRACE("\n");
init_parser(This, POP3_NOOP, POP3_NONE);
init_parser(This, POP3_NOOP);
InternetTransport_DoCommand(&This->InetTransport, noop, POP3Transport_CallbackRecvNOOPResp);
return S_OK;
}
@ -1007,7 +1008,7 @@ static HRESULT WINAPI POP3Transport_CommandRSET(IPOP3Transport *iface)
TRACE("\n");
init_parser(This, POP3_RSET, POP3_NONE);
init_parser(This, POP3_RSET);
InternetTransport_DoCommand(&This->InetTransport, rset, POP3Transport_CallbackRecvRSETResp);
return S_OK;
}
@ -1031,7 +1032,8 @@ static HRESULT WINAPI POP3Transport_CommandUIDL(
}
else command = uidl_all;
init_parser(This, POP3_UIDL, cmdtype);
init_parser(This, POP3_UIDL);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvUIDLResp);
if (dwPopId) HeapFree(GetProcessHeap(), 0, command);
@ -1052,7 +1054,8 @@ static HRESULT WINAPI POP3Transport_CommandDELE(
if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE;
sprintf(command, dele, dwPopId);
init_parser(This, POP3_DELE, cmdtype);
init_parser(This, POP3_DELE);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvDELEResp);
HeapFree(GetProcessHeap(), 0, command);
@ -1073,7 +1076,8 @@ static HRESULT WINAPI POP3Transport_CommandRETR(
if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE;
sprintf(command, retr, dwPopId);
init_parser(This, POP3_RETR, cmdtype);
init_parser(This, POP3_RETR);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvRETRResp);
HeapFree(GetProcessHeap(), 0, command);