/** 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 960: /* Message.P_CONVO_ID */ cache[0] = hasValue; // if no value - invalidate cache if (hasValue) { cache_convo_id = (SktConversation)value; if (skypeRef.logging) skypeRef.Log("Message.P_CONVO_ID = " + cache_convo_id.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_CONVO_ID - update without value"); skypeRef.events.FireOnMessageConvoId(this, cache_convo_id); break; case 120: /* Message.P_CONVO_GUID */ cache[1] = hasValue; // if no value - invalidate cache if (hasValue) { cache_convo_guid = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_CONVO_GUID = " + cache_convo_guid.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_CONVO_GUID - update without value"); skypeRef.events.FireOnMessageConvoGuid(this, cache_convo_guid); break; case 122: /* Message.P_AUTHOR */ cache[2] = hasValue; // if no value - invalidate cache if (hasValue) { cache_author = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_AUTHOR = " + cache_author.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_AUTHOR - update without value"); skypeRef.events.FireOnMessageAuthor(this, cache_author); break; case 123: /* Message.P_AUTHOR_DISPLAYNAME */ cache[3] = hasValue; // if no value - invalidate cache if (hasValue) { cache_author_displayname = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_AUTHOR_DISPLAYNAME = " + cache_author_displayname.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_AUTHOR_DISPLAYNAME - update without value"); skypeRef.events.FireOnMessageAuthorDisplayname(this, cache_author_displayname); break; case 792: /* Message.P_GUID */ cache[4] = hasValue; // if no value - invalidate cache if (hasValue) { cache_guid = (byte[])value; if (skypeRef.logging) skypeRef.Log("Message.P_GUID = binary size " + cache_guid.Length.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_GUID - update without value"); skypeRef.events.FireOnMessageGuid(this, cache_guid); break; case 790: /* Message.P_ORIGINALLY_MEANT_FOR */ cache[5] = hasValue; // if no value - invalidate cache if (hasValue) { cache_originally_meant_for = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_ORIGINALLY_MEANT_FOR = " + cache_originally_meant_for.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_ORIGINALLY_MEANT_FOR - update without value"); skypeRef.events.FireOnMessageOriginallyMeantFor(this, cache_originally_meant_for); break; case 121: /* Message.P_TIMESTAMP */ cache[6] = hasValue; // if no value - invalidate cache if (hasValue) { cache_timestamp = (uint)value; if (skypeRef.logging) skypeRef.Log("Message.P_TIMESTAMP = " + cache_timestamp.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_TIMESTAMP - update without value"); skypeRef.events.FireOnMessageTimestamp(this, skypeRef.UnixTimestampToDateTime(cache_timestamp)); break; case 961: /* Message.P_TYPE */ cache[7] = hasValue; // if no value - invalidate cache if (hasValue) { cache_type = (SktMessage.TYPE)value; if (skypeRef.logging) skypeRef.Log("Message.P_TYPE = " + cache_type.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_TYPE - update without value"); skypeRef.events.FireOnMessageType(this, cache_type); break; case 962: /* Message.P_SENDING_STATUS */ cache[8] = hasValue; // if no value - invalidate cache if (hasValue) { cache_sending_status = (SktMessage.SENDING_STATUS)value; if (skypeRef.logging) skypeRef.Log("Message.P_SENDING_STATUS = " + cache_sending_status.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_SENDING_STATUS - update without value"); skypeRef.events.FireOnMessageSendingStatus(this, cache_sending_status); break; case 968: /* Message.P_CONSUMPTION_STATUS */ cache[9] = hasValue; // if no value - invalidate cache if (hasValue) { cache_consumption_status = (SktMessage.CONSUMPTION_STATUS)value; if (skypeRef.logging) skypeRef.Log("Message.P_CONSUMPTION_STATUS = " + cache_consumption_status.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_CONSUMPTION_STATUS - update without value"); skypeRef.events.FireOnMessageConsumptionStatus(this, cache_consumption_status); break; case 222: /* Message.P_EDITED_BY */ cache[10] = hasValue; // if no value - invalidate cache if (hasValue) { cache_edited_by = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_EDITED_BY = " + cache_edited_by.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_EDITED_BY - update without value"); skypeRef.events.FireOnMessageEditedBy(this, cache_edited_by); break; case 223: /* Message.P_EDIT_TIMESTAMP */ cache[11] = hasValue; // if no value - invalidate cache if (hasValue) { cache_edit_timestamp = (uint)value; if (skypeRef.logging) skypeRef.Log("Message.P_EDIT_TIMESTAMP = " + cache_edit_timestamp.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_EDIT_TIMESTAMP - update without value"); skypeRef.events.FireOnMessageEditTimestamp(this, skypeRef.UnixTimestampToDateTime(cache_edit_timestamp)); break; case 963: /* Message.P_PARAM_KEY */ cache[12] = hasValue; // if no value - invalidate cache if (hasValue) { cache_param_key = (uint)value; if (skypeRef.logging) skypeRef.Log("Message.P_PARAM_KEY = " + cache_param_key.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_PARAM_KEY - update without value"); skypeRef.events.FireOnMessageParamKey(this, cache_param_key); break; case 964: /* Message.P_PARAM_VALUE */ cache[13] = hasValue; // if no value - invalidate cache if (hasValue) { cache_param_value = (uint)value; if (skypeRef.logging) skypeRef.Log("Message.P_PARAM_VALUE = " + cache_param_value.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_PARAM_VALUE - update without value"); skypeRef.events.FireOnMessageParamValue(this, cache_param_value); break; case 127: /* Message.P_BODY_XML */ cache[14] = hasValue; // if no value - invalidate cache if (hasValue) { cache_body_xml = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_BODY_XML = " + cache_body_xml.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_BODY_XML - update without value"); skypeRef.events.FireOnMessageBodyXml(this, cache_body_xml); break; case 125: /* Message.P_IDENTITIES */ cache[15] = hasValue; // if no value - invalidate cache if (hasValue) { cache_identities = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_IDENTITIES = " + cache_identities.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_IDENTITIES - update without value"); skypeRef.events.FireOnMessageIdentities(this, cache_identities); break; case 966: /* Message.P_REASON */ cache[16] = hasValue; // if no value - invalidate cache if (hasValue) { cache_reason = (String)value; if (skypeRef.logging) skypeRef.Log("Message.P_REASON = " + cache_reason.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_REASON - update without value"); skypeRef.events.FireOnMessageReason(this, cache_reason); break; case 126: /* Message.P_LEAVEREASON */ cache[17] = hasValue; // if no value - invalidate cache if (hasValue) { cache_leavereason = (SktSkype.LEAVE_REASON)value; if (skypeRef.logging) skypeRef.Log("Message.P_LEAVEREASON = " + cache_leavereason.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_LEAVEREASON - update without value"); skypeRef.events.FireOnMessageLeavereason(this, cache_leavereason); break; case 982: /* Message.P_PARTICIPANT_COUNT */ cache[18] = hasValue; // if no value - invalidate cache if (hasValue) { cache_participant_count = (uint)value; if (skypeRef.logging) skypeRef.Log("Message.P_PARTICIPANT_COUNT = " + cache_participant_count.ToString()); } else if (skypeRef.logging) skypeRef.Log("Message.P_PARTICIPANT_COUNT - update without value"); skypeRef.events.FireOnMessageParticipantCount(this, cache_participant_count); break; default: skypeRef.Error(String.Format("Invalid Message class property ID ({0})received from socket.", propId)); break; } }
internal void FetchConsumptionStatusFromRuntime() { if (skypeRef.logging) skypeRef.Log("Fetching P_CONSUMPTION_STATUS from runtime"); skypeRef.transport.SubmitPropertyRequest(9, 968, this.OID); if (skypeRef.transport.PropResponseWasOk(968)) { cache_consumption_status = (SktMessage.CONSUMPTION_STATUS)skypeRef.decoder.DecodeUint(); cache[9] = true; } skypeRef.transport.ResumeSocketReaderFromPropRequest(); }
public OnMessageConsumptionStatusArgs(SktMessage sender, SktMessage.CONSUMPTION_STATUS newValue) { this.sender = sender; value = newValue; }