示例#1
0
        //HAckValue à faire
        /// <summary>
        /// The client MUST be connected to access to this service.
        /// Allow a hubapp client to create a hMessage with a hAck payload.
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="ref"></param>
        /// <param name="ackValue">
        /// The following values are authorized :
        /// “recv” / HAckValue.RECV : means that the message has been received by the participant (on at least one of its devices)
        /// “read” / HAckValue.READ : means that the message has been read by the participant
        /// </param>
        /// <param name="mOptions"></param>
        /// <returns></returns>
        public HMessage BuildAck(string actor, string @ref, string ackValue, HMessageOptions mOptions)
        {
            if (actor == null || actor.Length <= 0)
            {
                throw new MissingAttrException("actor");
            }
            if (@ref == null || @ref.Length <= 0)
            {
                throw new MissingAttrException("ref");
            }
            if (ackValue == null)
            {
                throw new MissingAttrException("ack");
            }
            if (HUtil.CheckAck(ackValue))
            {
                throw new Exception("only 'recv' and 'read' are authorized for ack");
            }

            HAck hack = new HAck();

            hack.SetAck(ackValue);
            if (mOptions == null)
            {
                mOptions = new HMessageOptions();
            }
            mOptions.Ref = @ref;
            HMessage message = BuildMessage(actor, "hAck", hack, mOptions);

            return(message);
        }
示例#2
0
 public HMessage BuildMessage(string actor, string type, HAck payload, HMessageOptions mOptions)
 {
     return(InnerBuildMessage(actor, type, payload, mOptions));
 }