Ejemplo n.º 1
0
        /** 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 80: /* Transfer.P_TYPE */
                cache[0] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_type = (SktTransfer.TYPE)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_TYPE = " + cache_type.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_TYPE - update without value");
                skypeRef.events.FireOnTransferType(this, cache_type);
                break;

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

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

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

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

            case 85: /* Transfer.P_STARTTIME */
                cache[5] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_starttime = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_STARTTIME = " + cache_starttime.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_STARTTIME - update without value");
                skypeRef.events.FireOnTransferStarttime(this, skypeRef.UnixTimestampToDateTime(cache_starttime));
                break;

            case 86: /* Transfer.P_FINISHTIME */
                cache[6] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_finishtime = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_FINISHTIME = " + cache_finishtime.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_FINISHTIME - update without value");
                skypeRef.events.FireOnTransferFinishtime(this, skypeRef.UnixTimestampToDateTime(cache_finishtime));
                break;

            case 87: /* Transfer.P_FILEPATH */
                cache[7] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_filepath = (String)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_FILEPATH = " + cache_filepath.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_FILEPATH - update without value");
                skypeRef.events.FireOnTransferFilepath(this, cache_filepath);
                break;

            case 88: /* Transfer.P_FILENAME */
                cache[8] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_filename = (String)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_FILENAME = " + cache_filename.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_FILENAME - update without value");
                skypeRef.events.FireOnTransferFilename(this, cache_filename);
                break;

            case 89: /* Transfer.P_FILESIZE */
                cache[9] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_filesize = (String)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_FILESIZE = " + cache_filesize.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_FILESIZE - update without value");
                skypeRef.events.FireOnTransferFilesize(this, cache_filesize);
                break;

            case 90: /* Transfer.P_BYTESTRANSFERRED */
                cache[10] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_bytestransferred = (String)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_BYTESTRANSFERRED = " + cache_bytestransferred.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_BYTESTRANSFERRED - update without value");
                skypeRef.events.FireOnTransferBytestransferred(this, cache_bytestransferred);
                break;

            case 91: /* Transfer.P_BYTESPERSECOND */
                cache[11] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_bytespersecond = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_BYTESPERSECOND = " + cache_bytespersecond.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_BYTESPERSECOND - update without value");
                skypeRef.events.FireOnTransferBytespersecond(this, cache_bytespersecond);
                break;

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

            case 93: /* Transfer.P_CHATMSG_INDEX */
                cache[13] = hasValue; // if no value - invalidate cache
                if (hasValue)
                {
                    cache_chatmsg_index = (uint)value;
                    if (skypeRef.logging) skypeRef.Log("Transfer.P_CHATMSG_INDEX = " + cache_chatmsg_index.ToString());
                }
                else if (skypeRef.logging) skypeRef.Log("Transfer.P_CHATMSG_INDEX - update without value");
                skypeRef.events.FireOnTransferChatmsgIndex(this, cache_chatmsg_index);
                break;

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

            default:
                skypeRef.Error(String.Format("Invalid Transfer class property ID ({0})received from socket.", propId)); break;
            }
        }
Ejemplo n.º 2
0
 internal void FetchStatusFromRuntime()
 {
     if (skypeRef.logging) skypeRef.Log("Fetching P_STATUS from runtime");
     skypeRef.transport.SubmitPropertyRequest(6, 83, this.OID);
     if (skypeRef.transport.PropResponseWasOk(83))
     {
     cache_status = (SktTransfer.STATUS)skypeRef.decoder.DecodeUint();
     cache[3] = true;
     }
     skypeRef.transport.ResumeSocketReaderFromPropRequest();
 }
Ejemplo n.º 3
0
 public OnTransferStatusArgs(SktTransfer sender, SktTransfer.STATUS newValue)
 {
     this.sender = sender;  value = newValue;
 }