Commit b2b8dbd9 authored by mku's avatar mku

ZP-472 #comment username is being shown when an item is created on a mobile device #time 1h 30m

git-svn-id: https://z-push.org/svn/z-push/trunk@1780 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 7242bc8d
...@@ -1242,10 +1242,13 @@ class MAPIProvider { ...@@ -1242,10 +1242,13 @@ class MAPIProvider {
$representingprops = $this->getProps($mapimessage, $p); $representingprops = $this->getProps($mapimessage, $p);
if (!isset($representingprops[$appointmentprops["representingentryid"]])) { if (!isset($representingprops[$appointmentprops["representingentryid"]])) {
$props[$appointmentprops["representingname"]] = Request::GetAuthUser(); $storeProps = mapi_getprops($this->store, array(PR_MAILBOX_OWNER_ENTRYID));
$props[$appointmentprops["representingentryid"]] = $storeProps[PR_MAILBOX_OWNER_ENTRYID];
$displayname = $this->getFullnameFromEntryID($storeProps[PR_MAILBOX_OWNER_ENTRYID]);
$props[$appointmentprops["representingname"]] = ($displayname !== false) ? $displayname : Request::GetAuthUser();
$props[$appointmentprops["sentrepresentingemail"]] = Request::GetAuthUser(); $props[$appointmentprops["sentrepresentingemail"]] = Request::GetAuthUser();
$props[$appointmentprops["sentrepresentingaddt"]] = "ZARAFA"; $props[$appointmentprops["sentrepresentingaddt"]] = "ZARAFA";
$props[$appointmentprops["representingentryid"]] = mapi_createoneoff(Request::GetAuthUser(), "ZARAFA", Request::GetAuthUser());
$props[$appointmentprops["sentrepresentinsrchk"]] = $props[$appointmentprops["sentrepresentingaddt"]].":".$props[$appointmentprops["sentrepresentingemail"]]; $props[$appointmentprops["sentrepresentinsrchk"]] = $props[$appointmentprops["sentrepresentingaddt"]].":".$props[$appointmentprops["sentrepresentingemail"]];
if(isset($appointment->attendees) && is_array($appointment->attendees) && !empty($appointment->attendees)) { if(isset($appointment->attendees) && is_array($appointment->attendees) && !empty($appointment->attendees)) {
...@@ -2038,6 +2041,28 @@ class MAPIProvider { ...@@ -2038,6 +2041,28 @@ class MAPIProvider {
return ""; return "";
} }
/**
* Returns fullname from an entryid
*
* @param binary $entryid
* @return string fullname or false on error
*/
private function getFullnameFromEntryID($entryid) {
$addrbook = $this->getAddressbook();
$mailuser = mapi_ab_openentry($addrbook, $entryid);
if(!$mailuser) {
ZLog::Write(LOGLEVEL_ERROR, sprintf("Unable to get mailuser for getFullnameFromEntryID (0x%X)", mapi_last_hresult()));
return false;
}
$props = mapi_getprops($mailuser, array(PR_DISPLAY_NAME));
if (isset($props[PR_DISPLAY_NAME])) {
return $props[PR_DISPLAY_NAME];
}
ZLog::Write(LOGLEVEL_ERROR, sprintf("Unable to get fullname for getFullnameFromEntryID (0x%X)", mapi_last_hresult()));
return false;
}
/** /**
* Builds a displayname from several separated values * Builds a displayname from several separated values
* *
......
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