evolution-mapi r13 - trunk/src/libexchangemapi
- From: jkerihuel svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-mapi r13 - trunk/src/libexchangemapi
- Date: Sun, 23 Nov 2008 16:50:33 +0000 (UTC)
Author: jkerihuel
Date: Sun Nov 23 16:50:33 2008
New Revision: 13
URL: http://svn.gnome.org/viewvc/evolution-mapi?rev=13&view=rev
Log:
Fix recipient related functions: sending emails to EX or SMTP users work.
FIXME: The SetRecipientType function only uses MAPI_TO at the moment (hardcoded).
Can someone have a look and fix this call so we use the correct recipient class instead?
(MAPI_TO, MAPI_CC or MAPI_BCC).
Modified:
trunk/src/libexchangemapi/exchange-mapi-connection.c
Modified: trunk/src/libexchangemapi/exchange-mapi-connection.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-connection.c (original)
+++ trunk/src/libexchangemapi/exchange-mapi-connection.c Sun Nov 23 16:50:33 2008
@@ -85,7 +85,7 @@
g_print("\n%s(%d): %s: Already connected ", __FILE__, __LINE__, __PRETTY_FUNCTION__);
goto cleanup;
}
-
+
if (profname)
profile = profname;
else {
@@ -760,32 +760,60 @@
static void
set_recipient_properties (TALLOC_CTX *mem_ctx, struct SRow *aRow, ExchangeMAPIRecipient *recipient, gboolean is_external)
{
- uint32_t i;
+ struct SPropValue SPropValue;
+ uint32_t i;
if (is_external && recipient->in.ext_lpProps) {
- struct Binary_r *oneoff_eid;
- struct SPropValue sprop;
- const gchar *dn = NULL, *email = NULL;
+ const gchar *dn = NULL;
+ const gchar *email = NULL;
- for (i = 0; i < recipient->in.ext_cValues; ++i)
- SRow_addprop (aRow, recipient->in.ext_lpProps[i]);
-
- dn = (const gchar *) get_SPropValue (recipient->in.ext_lpProps, PR_DISPLAY_NAME);
- if (!dn)
- dn = "";
- email = (const gchar *) get_SPropValue (recipient->in.ext_lpProps, PR_SMTP_ADDRESS);
- if (!email)
- email = "";
- oneoff_eid = exchange_mapi_util_entryid_generate_oneoff (mem_ctx, dn, email, FALSE);
- set_SPropValue_proptag (&sprop, PR_ENTRYID, (const void *)(oneoff_eid));
- SRow_addprop (aRow, sprop);
+ /* retrieve dn and email */
+ dn = (const gchar *) get_SPropValue(recipient->in.ext_lpProps, PR_DISPLAY_NAME);
+ dn = (dn) ? dn : "";
+
+ email = (const gchar *) get_SPropValue(recipient->in.ext_lpProps, PR_SMTP_ADDRESS);
+ email = (email) ? email : "";
+
+ /* PR_OBJECT_TYPE */
+ SPropValue.ulPropTag = PR_OBJECT_TYPE;
+ SPropValue.value.l = MAPI_MAILUSER;
+ SRow_addprop(aRow, SPropValue);
+
+ /* PR_DISPLAY_TYPE */
+ SPropValue.ulPropTag = PR_DISPLAY_TYPE;
+ SPropValue.value.l = 0;
+ SRow_addprop(aRow, SPropValue);
+
+ /* PR_GIVEN_NAME */
+ SPropValue.ulPropTag = PR_GIVEN_NAME;
+ SPropValue.value.lpszA = dn;
+ SRow_addprop(aRow, SPropValue);
+
+ /* PR_DISPLAY_NAME */
+ SPropValue.ulPropTag = PR_DISPLAY_NAME;
+ SPropValue.value.lpszA = dn;
+ SRow_addprop(aRow, SPropValue);
+
+ /* PR_7BIT_DISPLAY_NAME */
+ SPropValue.ulPropTag = PR_7BIT_DISPLAY_NAME;
+ SPropValue.value.lpszA = dn;
+ SRow_addprop(aRow, SPropValue);
+
+ /* PR_SMTP_ADDRESS */
+ SPropValue.ulPropTag = PR_SMTP_ADDRESS;
+ SPropValue.value.lpszA = email;
+ SRow_addprop(aRow, SPropValue);
+
+ /* PR_ADDRTYPE */
+ SPropValue.ulPropTag = PR_ADDRTYPE;
+ SPropValue.value.lpszA = "SMTP";
+ SRow_addprop(aRow, SPropValue);
}
- for (i = 0; i < recipient->in.req_cValues; ++i)
- SRow_addprop (aRow, recipient->in.req_lpProps[i]);
+ /* FIXME: Temporary - I have not found where RecipClass is defined/used */
+ SetRecipientType(aRow, MAPI_TO);
}
-/* DON'T f***ing touch this function. */
static void
exchange_mapi_util_modify_recipients (TALLOC_CTX *mem_ctx, mapi_object_t *obj_message , GSList *recipients, gboolean remove_existing)
{
@@ -793,25 +821,21 @@
struct SPropTagArray *SPropTagArray = NULL;
struct SRowSet *SRowSet = NULL;
struct SPropTagArray *FlagList = NULL;
+ struct SPropValue SPropValue;
GSList *l;
const char **users = NULL;
uint32_t i, j, count = 0;
d(g_print("\n%s(%d): Entering %s ", __FILE__, __LINE__, __PRETTY_FUNCTION__));
- SPropTagArray = set_SPropTagArray(mem_ctx, 0x7,
+ SPropTagArray = set_SPropTagArray(mem_ctx, 0x6,
+ PR_OBJECT_TYPE,
PR_DISPLAY_TYPE,
- PR_OBJECT_TYPE,
-// PR_ADDRTYPE,
-// PR_EMAIL_ADDRESS,
- PR_SMTP_ADDRESS,
+ PR_7BIT_DISPLAY_NAME,
PR_DISPLAY_NAME,
- PR_GIVEN_NAME,
- PR_SURNAME,
- PR_7BIT_DISPLAY_NAME);
-// PR_ENTRYID,
-// PR_SEARCH_KEY,
-// PR_TRANSMITTABLE_DISPLAY_NAME);
+ PR_SMTP_ADDRESS,
+ PR_GIVEN_NAME);
+
SRowSet = talloc_zero(mem_ctx, struct SRowSet);
count = g_slist_length (recipients);
@@ -840,13 +864,12 @@
* However, if we do still get an ambiguous entry, we can't handle it :-( */
g_warning ("\n%s:%d %s() - '%s' is ambiguous ", __FILE__, __LINE__, __PRETTY_FUNCTION__, recipient->email_id);
} else if (FlagList->aulPropTag[i] == MAPI_UNRESOLVED) {
- /* This is currently a bug in libmapi that unresolved recipients are not added to the SRowSet.
- * Julien knows about it and would fix it. */
+ /* If the recipient is unresolved, consider it is a SMTP one */
SRowSet->aRow = talloc_realloc(mem_ctx, SRowSet->aRow, struct SRow, SRowSet->cRows + 1);
last = SRowSet->cRows;
SRowSet->aRow[last].cValues = 0;
SRowSet->aRow[last].lpProps = talloc_zero(mem_ctx, struct SPropValue);
- set_recipient_properties (mem_ctx, &SRowSet->aRow[last], recipient, TRUE);
+ set_recipient_properties(mem_ctx, &SRowSet->aRow[last], recipient, TRUE);
SRowSet->cRows += 1;
} else if (FlagList->aulPropTag[i] == MAPI_RESOLVED) {
set_recipient_properties (mem_ctx, &SRowSet->aRow[j], recipient, FALSE);
@@ -854,6 +877,10 @@
}
}
+ SPropValue.ulPropTag = PR_SEND_INTERNET_ENCODING;
+ SPropValue.value.l = 0;
+ SRowSet_propcpy(mem_ctx, SRowSet, SPropValue);
+
if (remove_existing) {
RemoveAllRecipients (obj_message);
if (retval != MAPI_E_SUCCESS) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]