Commit f3a6b7a8 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

inetcomm: Implement IMimeInternational_GetCodePageCharset.

parent 3dd46c36
...@@ -120,12 +120,61 @@ static HRESULT WINAPI MimeInternat_GetDefaultCharset(IMimeInternational *iface, ...@@ -120,12 +120,61 @@ static HRESULT WINAPI MimeInternat_GetDefaultCharset(IMimeInternational *iface,
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT mlang_getcodepageinfo(UINT cp, MIMECPINFO *mlang_cp_info)
{
HRESULT hr;
IMultiLanguage *ml;
hr = get_mlang(&ml);
if(SUCCEEDED(hr))
{
hr = IMultiLanguage_GetCodePageInfo(ml, cp, mlang_cp_info);
IMultiLanguage_Release(ml);
}
return hr;
}
static HRESULT WINAPI MimeInternat_GetCodePageCharset(IMimeInternational *iface, CODEPAGEID cpiCodePage, static HRESULT WINAPI MimeInternat_GetCodePageCharset(IMimeInternational *iface, CODEPAGEID cpiCodePage,
CHARSETTYPE ctCsetType, CHARSETTYPE ctCsetType,
LPHCHARSET phCharset) LPHCHARSET phCharset)
{ {
FIXME("stub\n"); HRESULT hr;
return E_NOTIMPL; MIMECPINFO mlang_cp_info;
TRACE("(%p)->(%d, %d, %p)\n", iface, cpiCodePage, ctCsetType, phCharset);
*phCharset = NULL;
if(ctCsetType < CHARSET_BODY || ctCsetType > CHARSET_WEB)
return MIME_E_INVALID_CHARSET_TYPE;
hr = mlang_getcodepageinfo(cpiCodePage, &mlang_cp_info);
if(SUCCEEDED(hr))
{
const WCHAR *charset_nameW = NULL;
char *charset_name;
DWORD len;
switch(ctCsetType)
{
case CHARSET_BODY:
charset_nameW = mlang_cp_info.wszBodyCharset;
break;
case CHARSET_HEADER:
charset_nameW = mlang_cp_info.wszHeaderCharset;
break;
case CHARSET_WEB:
charset_nameW = mlang_cp_info.wszWebCharset;
break;
}
len = WideCharToMultiByte(CP_ACP, 0, charset_nameW, -1, NULL, 0, NULL, NULL);
charset_name = HeapAlloc(GetProcessHeap(), 0, len);
WideCharToMultiByte(CP_ACP, 0, charset_nameW, -1, charset_name, len, NULL, NULL);
hr = IMimeInternational_FindCharset(iface, charset_name, phCharset);
HeapFree(GetProcessHeap(), 0, charset_name);
}
return hr;
} }
static HRESULT mlang_getcsetinfo(const char *charset, MIMECSETINFO *mlang_info) static HRESULT mlang_getcsetinfo(const char *charset, MIMECSETINFO *mlang_info)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment