---------- Forwarded Message ----------
Subject: GetProps/GetPropsAll always non-unicode
Date: Thursday 18 March 2010, 12:26:36 am
From: Milan Crha <[email protected]>
To: [email protected]
Hi,
while I was investigating [1] I realized that GetPropsAll is not
requesting PT_UNICODE properties, but only PT_STRING8. It breaks strings
with UTF8 letters.
The attached patch adds an API to request session to use unicode in
GetProps/GetPropsAll. Even I do not know whether it worth anything to
request no-unicode strings, I did it rather configurable, with a default
behavior as of before the patch. Maybe there are more places where this
flag can be used within openchange, I do not know.
Anyway, it would be nice to have this sorted out before 0.10 release.
Thanks and bye,
Milan
[1] https://bugzilla.gnome.org/show_bug.cgi?id=600389
-----------------------------------------
Index: libmapi/IMAPIProp.c
===================================================================
--- libmapi/IMAPIProp.c (revision 1730)
+++ libmapi/IMAPIProp.c (working copy)
@@ -54,7 +54,7 @@
- MAPI_E_CALL_FAILED: A network problem was encountered during the
transaction
- \sa SetProps, GetPropList, GetPropsAll, DeleteProps, GetLastError
+ \sa SetProps, GetPropList, GetPropsAll, DeleteProps, GetLastError, mapi_session_set_use_unicode
*/
_PUBLIC_ enum MAPISTATUS GetProps(mapi_object_t *obj,
struct SPropTagArray *SPropTagArray,
@@ -110,7 +110,7 @@
/* Fill the GetProps operation */
request.PropertySizeLimit = 0x0;
size += sizeof (uint16_t);
- request.WantUnicode = 0x0;
+ request.WantUnicode = mapi_session_get_use_unicode (session);
size += sizeof (uint16_t);
request.prop_count = (uint16_t) SPropTagArray->cValues;
size += sizeof (uint16_t);
@@ -478,7 +478,7 @@
- MAPI_E_CALL_FAILED: A network problem was encountered during the
transaction
- \sa GetProps, GetPropList, GetLastError
+ \sa GetProps, GetPropList, GetLastError, mapi_session_set_use_unicode
*/
_PUBLIC_ enum MAPISTATUS GetPropsAll(mapi_object_t *obj,
struct mapi_SPropValue_array *properties)
@@ -511,7 +511,7 @@
/* Fill the GetPropsAll operation */
request.PropertySizeLimit = 0;
size += sizeof (uint16_t);
- request.WantUnicode = 0;
+ request.WantUnicode = mapi_session_get_use_unicode (session);
size += sizeof (uint16_t);
/* Fill the MAPI_REQ request */
Index: libmapi/mapi_provider.h
===================================================================
--- libmapi/mapi_provider.h (revision 1730)
+++ libmapi/mapi_provider.h (working copy)
@@ -51,6 +51,7 @@
struct mapi_notify_ctx *notify_ctx;
struct mapi_objects *objects;
uint8_t logon_ids[255];
+ bool use_unicode;
struct mapi_session *next;
struct mapi_session *prev;
Index: libmapi/cdo_mapi.c
===================================================================
--- libmapi/cdo_mapi.c (revision 1730)
+++ libmapi/cdo_mapi.c (working copy)
@@ -350,3 +350,36 @@
return MAPI_E_SUCCESS;
}
+
+/**
+ \details Sets MAPI session's use_unicode property
+
+ \param session pointer to a MAPI session object
+ \param use_unicode whether should session request unicode properties in \ref GetProps and \ref GetPropsAll calls
+
+ \return MAPI_E_SUCCESS on success, otherwise MAPI_E_INVALID_PARAMETER
+ */
+_PUBLIC_ enum MAPISTATUS mapi_session_set_use_unicode (struct mapi_session *session, bool use_unicode)
+{
+ OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+
+ session->use_unicode = use_unicode;
+
+ return MAPI_E_SUCCESS;
+}
+
+/**
+ \details Gets MAPI session's use_unicode property
+
+ \param session pointer to a MAPI session object
+
+ \return whether requests unicode properties in \ref GetProps and \ref GetPropsAll calls
+
+ \note default value is false
+ */
+_PUBLIC_ bool mapi_session_get_use_unicode (struct mapi_session *session)
+{
+ OPENCHANGE_RETVAL_IF(!session, false, NULL);
+
+ return session->use_unicode;
+}
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel