Beispiel #1
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            /* if user isnt owner of session, dont delete the session */
            if (c.currentSessionOwner().getId() != c.participant.getId())
            {
                return;
            }

            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.DELETE_SESSION_REQUEST;

            Request_DeleteSession_PB cs_pb = new Request_DeleteSession_PB();

            cs_pb.account_gmail  = c.getAccountGmail();
            cs_pb.access_token   = c.getAccessToken();
            cs_pb.participant_id = c.participant.getId();
            cs_pb.session_id     = c.currentSessionID();

            CollabrifyParticipant owner   = c.currentSessionOwner();
            HttpWebRequest        request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("BeginGetRequestStream FAILED:\n" + e.Message);
            }
        } // make_request
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj, byte[] data, string eventType)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.ADD_EVENT_REQUEST;

            Request_AddEvent_PB cs_pb = new Request_AddEvent_PB();

            cs_pb.account_gmail  = c.getAccountGmail();
            cs_pb.access_token   = c.getAccessToken();
            cs_pb.event_data     = data;
            cs_pb.event_type     = eventType;
            cs_pb.session_id     = c.currentSessionID();
            cs_pb.participant_id = c.participant.getId();

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } //make_request
Beispiel #3
0
        // -------------------------------------------------------------------------

        /// <summary>
        /// makes a warmup request to the server and returns a response object in the form of RESPONSE_
        /// </summary>
        public static void make_request(CollabrifyClient c, HttpRequest__Object obj)
        {
            CollabrifyRequest_PB req_pb = new CollabrifyRequest_PB();

            req_pb.request_type = CollabrifyRequestType_PB.REMOVE_PARTICIPANT_REQUEST;

            Request_RemoveParticipant_PB cs_pb = new Request_RemoveParticipant_PB();

            cs_pb.account_gmail = c.getAccountGmail();
            cs_pb.access_token  = c.getAccessToken();
            cs_pb.session_id    = c.currentSessionID();

            if (c.getSession().getIsPasswordProtected())
            {
                cs_pb.session_password = "";
            }

            cs_pb.accessing_participant_id     = c.participant.getId();
            cs_pb.to_be_removed_participant_id = c.participant.getId();

            HttpWebRequest request = obj.BuildRequest(req_pb, cs_pb);

            try
            {
                request.BeginGetRequestStream(new AsyncCallback(obj.getReqStream), request);
            }
            catch (WebException e)
            {
                System.Diagnostics.Debug.WriteLine("  -- EXCEPTION THROWN \n" + e.Message);
            }
        } // make_request