private void HandleSessionArchiveMessage(vx_evt_base_t eventMessage) { vx_evt_session_archive_message_t evt = eventMessage; Debug.Assert(evt != null); if (evt.session_handle != _sessionHandle) { return; } DateTime parsedReceivedTime; if (!DateTime.TryParse(evt.time_stamp, out parsedReceivedTime)) { VivoxDebug.Instance.DebugMessage($"{GetType().Name}: {eventMessage.GetType().Name} invalid message: Bad time format", vx_log_level.log_error); Debug.Assert(false); return; } ChannelParticipant p = _participants[evt.participant_uri] as ChannelParticipant; var message = new SessionArchiveMessage() { ChannelSession = this, Key = evt.message_id, MessageId = evt.message_id, QueryId = evt.query_id, ReceivedTime = parsedReceivedTime, Sender = p != null ? p.Account : new AccountId(evt.participant_uri), Message = evt.message_body, FromSelf = (evt.is_current_user != 0), Language = evt.language }; _sessionArchive.Enqueue(message); }
private void HandleSessionMessage(vx_evt_base_t eventMessage) { vx_evt_message_t evt = eventMessage; Debug.Assert(evt != null); if (evt.session_handle != _sessionHandle) { return; } var message = new ChannelTextMessage() { Sender = _participants.ContainsKey(evt.participant_uri) ? _participants[evt.participant_uri].Account : new AccountId(evt.participant_uri), Message = evt.message_body, ReceivedTime = DateTime.Now, Key = _nextTextId++.ToString("D8"), ApplicationStanzaBody = evt.application_stanza_body, ApplicationStanzaNamespace = evt.application_stanza_namespace, Language = evt.language, ChannelSession = this, FromSelf = (evt.is_current_user != 0) }; _messageLog.Enqueue(message); }
private void HandleAccountArchiveMessage(vx_evt_base_t eventMessage) { vx_evt_account_archive_message_t evt = eventMessage; if (evt.account_handle != _accountHandle) { return; } DateTime parsedReceivedTime; if (!DateTime.TryParse(evt.time_stamp, out parsedReceivedTime)) { VivoxDebug.Instance.DebugMessage($"{GetType().Name}: {eventMessage.GetType().Name} invalid message: Bad time format", vx_log_level.log_error); Debug.Assert(false); return; } var message = new AccountArchiveMessage() { LoginSession = this, Key = evt.message_id, MessageId = evt.message_id, QueryId = evt.query_id, ReceivedTime = parsedReceivedTime, Message = evt.message_body, Inbound = (evt.is_inbound != 0), Language = evt.language, RemoteParticipant = new AccountId(evt.participant_uri), Channel = new ChannelId(evt.channel_uri) }; _accountArchive.Enqueue(message); }
private void HandleSubscription(vx_evt_base_t eventMessage) { vx_evt_subscription_t evt = eventMessage; Debug.Assert(evt != null); if (evt.account_handle != _accountHandle) { return; } _incomingSubscriptionRequests.Enqueue(new AccountId(evt.buddy_uri)); }
private void HandleUserToUserMessage(vx_evt_base_t eventMessage) { vx_evt_user_to_user_message_t evt = eventMessage; if (evt.account_handle != _accountHandle) { return; } Debug.Assert(evt != null); _directedMessages.Enqueue(new DirectedTextMessage { ReceivedTime = DateTime.Now, Message = evt.message_body, Sender = new AccountId(evt.from_uri), ApplicationStanzaBody = evt.application_stanza_body, ApplicationStanzaNamespace = evt.application_stanza_namespace, Language = evt.language, LoginSession = this }); }
private void HandleSessionTranscribedMessage(vx_evt_base_t eventMessage) { vx_evt_transcribed_message_t evt = eventMessage; Debug.Assert(evt != null); if (evt.session_handle != _sessionHandle) { return; } TranscribedMessage message = new TranscribedMessage( _participants.ContainsKey(evt.participant_uri) ? _participants[evt.participant_uri].Account : new AccountId(evt.participant_uri), evt.text, _nextTranscriptiontId++.ToString("D8"), evt.language, this, (evt.is_current_user != 0) ); _transcribedLog.Enqueue(message); }
private void HandleAccountSendMessageFailed(vx_evt_base_t eventMessage) { vx_evt_account_send_message_failed_t evt = eventMessage; Debug.Assert(evt != null); AssertLoggedIn(); if (evt.account_handle != _accountHandle) { return; } if (_directedMessageResult.RequestId != evt.request_id) { return; } _failedDirectedMessages.Enqueue(new FailedDirectedTextMessage { Sender = new AccountId(evt.account_handle), RequestId = evt.request_id, StatusCode = evt.status_code }); }