Exemple #1
0
        /// <summary>
        /// We are sender
        /// </summary>
        /// <param name="p2pSession"></param>
        public ObjectTransfer(P2PSession p2pSession)
            : base(p2pSession)
        {
            msnObject = new MSNObject();
            msnObject.SetContext(p2pSession.Invitation.BodyValues["Context"].Value, true);

            if (msnObject.ObjectType == MSNObjectType.UserDisplay ||
                msnObject.ObjectType == MSNObjectType.Unknown)
            {
                msnObject = NSMessageHandler.Owner.DisplayImage;
                objStream = NSMessageHandler.Owner.DisplayImage.OpenStream();
            }
            else if (msnObject.ObjectType == MSNObjectType.Scene)
            {
                msnObject = NSMessageHandler.Owner.SceneImage;
                objStream = NSMessageHandler.Owner.SceneImage.OpenStream();
            }
            else if (msnObject.ObjectType == MSNObjectType.Emoticon &&
                Local.Emoticons.ContainsKey(msnObject.Sha))
            {
                msnObject = Local.Emoticons[msnObject.Sha];
                objStream = ((Emoticon)msnObject).OpenStream();
            }

            sending = true;

            if (p2pSession.Invitation.BodyValues.ContainsKey("AppID"))
                applicationId = uint.Parse(p2pSession.Invitation.BodyValues["AppID"]);
        }
Exemple #2
0
        /// <summary>
        /// We are receiver
        /// </summary>
        public ObjectTransfer(MSNObject obj, Contact remote)
            : base(remote.P2PVersionSupported, remote, remote.SelectBestEndPointId())
        {
            msnObject = obj;

            if (msnObject.ObjectType == MSNObjectType.UserDisplay)
            {
                msnObject = new DisplayImage();
                applicationId = 12;
                msnObject.SetContext(remote.UserTileLocation, false);
            }
            else if (msnObject.ObjectType == MSNObjectType.Scene)
            {
                msnObject = new SceneImage();
                applicationId = 12;
                msnObject.SetContext(remote.SceneContext, false);
            }
            else if (msnObject.ObjectType == MSNObjectType.Emoticon ||
                msnObject.ObjectType == MSNObjectType.Wink)
            {
                applicationId = 11;
            }
            else
            {
                applicationId = 1;
            }

            sending = false;
        }
Exemple #3
0
        public override bool ValidateInvitation(SLPMessage invite)
        {
            bool ret = base.ValidateInvitation(invite);

            if (ret)
            {
                MSNObject validObject = new MSNObject();
                validObject.SetContext(invite.BodyValues["Context"].Value, true);

                if (validObject.ObjectType == MSNObjectType.UserDisplay ||
                    validObject.ObjectType == MSNObjectType.Unknown)
                {
                    msnObject = Local.DisplayImage;
                    objStream = Local.DisplayImage.OpenStream();
                    ret |= true;
                }
                else if (validObject.ObjectType == MSNObjectType.Scene)
                {
                    msnObject = Local.SceneImage;
                    objStream = Local.SceneImage.OpenStream();
                    ret |= true;
                }
                else if (validObject.ObjectType == MSNObjectType.Emoticon &&
                    Local.Emoticons.ContainsKey(validObject.Sha))
                {
                    msnObject = Local.Emoticons[msnObject.Sha];
                    objStream = ((Emoticon)msnObject).OpenStream();

                    ret |= true;
                }
            }

            return ret;
        }