/** When the socket reader receives a property update from runtime, it decodes object ID
         * property ID and the new value of the property. It then calls this method of
         * the target object, to update the new value in property cache. After updating the cache,
         * this method then fires appropriate event in skype.events to notify the UI of what has happened.
         * DispatchPropertyUpdate is executed in the socket reader thread.
         */
        internal override void DispatchPropertyUpdate(uint propId, object value, bool hasValue)
        {
            switch (propId)
            {
            case 100: /* Voicemail.P_TYPE */
                cache[0] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_type = (SktVoicemail.TYPE)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_TYPE = " + cache_type.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_TYPE - update without value");
                skypeRef.events.FireOnVoicemailType(this, cache_type);
                break;

            case 101: /* Voicemail.P_PARTNER_HANDLE */
                cache[1] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_partner_handle = (String)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_PARTNER_HANDLE = " + cache_partner_handle.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_PARTNER_HANDLE - update without value");
                skypeRef.events.FireOnVoicemailPartnerHandle(this, cache_partner_handle);
                break;

            case 102: /* Voicemail.P_PARTNER_DISPNAME */
                cache[2] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_partner_dispname = (String)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_PARTNER_DISPNAME = " + cache_partner_dispname.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_PARTNER_DISPNAME - update without value");
                skypeRef.events.FireOnVoicemailPartnerDispname(this, cache_partner_dispname);
                break;

            case 103: /* Voicemail.P_STATUS */
                cache[3] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_status = (SktVoicemail.STATUS)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_STATUS = " + cache_status.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_STATUS - update without value");
                skypeRef.events.FireOnVoicemailStatus(this, cache_status);
                break;

            case 104: /* Voicemail.P_FAILUREREASON */
                cache[4] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_failurereason = (SktVoicemail.FAILUREREASON)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_FAILUREREASON = " + cache_failurereason.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_FAILUREREASON - update without value");
                skypeRef.events.FireOnVoicemailFailurereason(this, cache_failurereason);
                break;

            case 105: /* Voicemail.P_SUBJECT */
                cache[5] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_subject = (String)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_SUBJECT = " + cache_subject.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_SUBJECT - update without value");
                skypeRef.events.FireOnVoicemailSubject(this, cache_subject);
                break;

            case 106: /* Voicemail.P_TIMESTAMP */
                cache[6] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_timestamp = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_TIMESTAMP = " + cache_timestamp.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_TIMESTAMP - update without value");
                skypeRef.events.FireOnVoicemailTimestamp(this, skypeRef.UnixTimestampToDateTime(cache_timestamp));
                break;

            case 107: /* Voicemail.P_DURATION */
                cache[7] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_duration = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_DURATION = " + cache_duration.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_DURATION - update without value");
                skypeRef.events.FireOnVoicemailDuration(this, cache_duration);
                break;

            case 108: /* Voicemail.P_ALLOWED_DURATION */
                cache[8] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_allowed_duration = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_ALLOWED_DURATION = " + cache_allowed_duration.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_ALLOWED_DURATION - update without value");
                skypeRef.events.FireOnVoicemailAllowedDuration(this, cache_allowed_duration);
                break;

            case 109: /* Voicemail.P_PLAYBACK_PROGRESS */
                cache[9] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_playback_progress = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_PLAYBACK_PROGRESS = " + cache_playback_progress.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_PLAYBACK_PROGRESS - update without value");
                skypeRef.events.FireOnVoicemailPlaybackProgress(this, cache_playback_progress);
                break;

            case 830: /* Voicemail.P_CONVO_ID */
                cache[10] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_convo_id = (SktConversation)value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_CONVO_ID = " + cache_convo_id.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_CONVO_ID - update without value");
                skypeRef.events.FireOnVoicemailConvoId(this, cache_convo_id);
                break;

            case 831: /* Voicemail.P_CHATMSG_GUID */
                cache[11] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_chatmsg_guid = (byte[])value;
                    if (skypeRef.logging) skypeRef.Log("Voicemail.P_CHATMSG_GUID = binary size " + cache_chatmsg_guid.Length.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Voicemail.P_CHATMSG_GUID - update without value");
                skypeRef.events.FireOnVoicemailChatmsgGuid(this, cache_chatmsg_guid);
                break;

            default:
                skypeRef.Error(String.Format("Invalid Voicemail class property ID ({0})received from socket.", propId)); break;
            }
        }
 internal void FetchStatusFromRuntime()
 {
     if (skypeRef.logging) skypeRef.Log("Fetching P_STATUS from runtime");
     skypeRef.transport.SubmitPropertyRequest(7, 103, this.OID);
     if (skypeRef.transport.PropResponseWasOk(103))
     {
     cache_status = (SktVoicemail.STATUS)skypeRef.decoder.DecodeUint();
     cache[3] = true;
     }
     skypeRef.transport.ResumeSocketReaderFromPropRequest();
 }
 public OnVoicemailStatusArgs(SktVoicemail sender, SktVoicemail.STATUS newValue)
 {
     this.sender = sender;  value = newValue;
 }