Ejemplo n.º 1
0
 internal PrivateChatManager(QuickbloxClient quickbloxClient, int otherUserId, string dialogId)
 {
     this.otherUserId     = otherUserId;
     this.otherUserJid    = ChatXmppClient.BuildJid(otherUserId, quickbloxClient.ApplicationId, quickbloxClient.ChatEndpoint);
     this.dialogId        = dialogId;
     this.quickbloxClient = quickbloxClient;
     quickbloxClient.ChatXmppClient.MessageReceived += MessagesClientOnOnMessageReceived;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Ices the candidates.
        /// <message to="..."  type="headline" id="...">
        ///<extraParams xmlns = "jabber:client" >
        ///< moduleIdentifier > WebRTCVideoChat </ moduleIdentifier >
        /// < signalType > iceCandidates </ signalType >
        /// < sessionID >...</ sessionID >
        /// < iceCandidates >
        ///    < iceCandidate >
        ///        < sdpMLineIndex >...</ sdpMLineIndex >
        ///        < sdpMid >...</ sdpMid >
        ///        < candidate >...</ candidate >
        ///    </ iceCandidate >
        ///    < iceCandidate >
        ///        < sdpMLineIndex >...</ sdpMLineIndex >
        ///       < sdpMid >...</ sdpMid >
        ///        < candidate >...</ candidate >
        ///     </ iceCandidate >
        /// </ iceCandidates >
        /// </ extraParams >
        /// </ message >
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="iceCandidates">The ice candidates.</param>
        /// <param name="caller">The caller.</param>
        /// <returns></returns>
        public IceCandidatesExtraParameter IceCandidates(string sessionId, int receiver, Collection <IceCandidate> iceCandidates)
        {
            var jid            = ChatXmppClient.BuildJid(receiver, client.ApplicationId, client.ChatEndpoint);
            var extraParameter = new IceCandidatesExtraParameter(sessionId, iceCandidates);

            this.client.ChatXmppClient.SendMessage(receiver, "IceCandidates", extraParameter.Build(), null, null, MessageType.Headline);
            return(extraParameter);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Accepts the specified session identifier.
        /// <message to="..."  type="headline" id="...">
        /// <extraParams xmlns = "jabber:client" >
        ///  < moduleIdentifier > WebRTCVideoChat </ moduleIdentifier >
        /// < signalType > accept </ signalType >
        /// < sessionID >...</ sessionID >
        /// < callType >...</ callType >
        /// < sdp >...</ sdp >
        /// < platform >...</ platform >
        /// </ extraParams >
        /// </ message >
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="sdp">The SDP.</param>
        /// <param name="platform">The platform.</param>
        /// <param name="caller">The caller.</param>
        /// <returns></returns>
        public AcceptExtraParameter Accept(string sessionId, string sdp, string platform, int receiver)
        {
            var jid            = ChatXmppClient.BuildJid(receiver, client.ApplicationId, client.ChatEndpoint);
            var extraParameter = new AcceptExtraParameter(sessionId, sdp, platform);

            this.client.ChatXmppClient.SendMessage(receiver, "Accept", extraParameter.Build(), null, null, MessageType.Headline);
            return(extraParameter);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Hangs up.
        /// <message to="..."  type="headline" id="...">
        /// <extraParams xmlns = "jabber:client" >
        ///  < moduleIdentifier > WebRTCVideoChat </ moduleIdentifier >
        /// < signalType > hangUp </ signalType >
        /// < sessionID >...</ sessionID >
        /// </ extraParams >
        /// </ message >
        /// </summary>
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="caller">The caller.</param>
        /// <returns></returns>
        public HangUpExtraParameter HangUp(string sessionId, int receiver)
        {
            var jid            = ChatXmppClient.BuildJid(receiver, client.ApplicationId, client.ChatEndpoint);
            var extraParameter = new HangUpExtraParameter(sessionId);

            this.client.ChatXmppClient.SendMessage(receiver, "HangUp", extraParameter.Build(), null, null, MessageType.Headline);
            return(extraParameter);
        }
Ejemplo n.º 5
0
        private void SendGroupInfoSystemMessage(int userId, Dialog dialogInfo)
        {
            var extraParams = new ExtraParams();

            extraParams.AddNew(ExtraParamsList.moduleIdentifier, SystemMessage.SystemMessageModuleIdentifier);
            extraParams.AddNew(ExtraParamsList.notification_type, NotificationTypes.GroupCreate.ToIntString());
            extraParams.AddNew(ExtraParamsList.date_sent, DateTime.UtcNow.ToUnixEpoch().ToString());
            extraParams.AddNew(ExtraParamsList.room_updated_date, dialogInfo.UpdateAt.ToUnixEpoch().ToString());
            extraParams.AddNew(ExtraParamsList.dialog_id, dialogInfo.Id);
            extraParams.AddNew(ExtraParamsList.room_name, dialogInfo.Name);
            extraParams.AddNew(ExtraParamsList.current_occupant_ids, string.Join(",", dialogInfo.OccupantsIds));
            extraParams.AddNew(ExtraParamsList.type, ((int)dialogInfo.Type).ToString());

            if (!string.IsNullOrEmpty(dialogInfo.Photo))
            {
                extraParams.AddNew(ExtraParamsList.room_photo, dialogInfo.Photo);
            }

            var userJid = ChatXmppClient.BuildJid(userId, quickbloxClient.ApplicationId, quickbloxClient.ChatEndpoint);

            quickbloxClient.ChatXmppClient.SendMessage(userJid, "Notification Message", extraParams, dialogId, null, MessageType.Headline);
        }