Exemple #1
0
        public void AddMessage(string contentType, string message)
        {
            ExTraceGlobals.InstantMessagingTracer.TraceDebug((long)this.GetHashCode(), "InstantMessageQueue.AddMessage");
            Interlocked.CompareExchange <List <Tuple <string, string> > >(ref this.messageList, new List <Tuple <string, string> >(), null);
            bool flag = false;

            lock (this.lockObject)
            {
                if (this.messageList.Count < 20)
                {
                    if (string.IsNullOrWhiteSpace(contentType))
                    {
                        contentType = "text/plain;charset=utf-8";
                    }
                    this.messageList.Add(new Tuple <string, string>(contentType, message));
                }
                else
                {
                    flag = true;
                }
            }
            if (flag)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceError((long)this.GetHashCode(), "InstantMessageQueue.AddMessage. Message queued count: {0}", new object[]
                {
                    this.messageList.Count
                });
                InstantMessagePayloadUtilities.GenerateMessageNotDeliveredPayload(this.notifier, "InstantMessageQueue.AddMessage", this.Conversation.Cid, UserActivityType.FailedDelivery);
            }
        }
Exemple #2
0
        // Token: 0x06001B1F RID: 6943 RVA: 0x00066E90 File Offset: 0x00065090
        private bool ShouldSignIn(UserContext userContext)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            bool      result;

            try
            {
                if (this.signedInManually)
                {
                    InstantMessageUtilities.SetSignedOutFlag(base.MailboxIdentityMailboxSession, false);
                }
                else if (InstantMessageUtilities.IsSignedOut(base.MailboxIdentityMailboxSession))
                {
                    InstantMessageNotifier notifier = userContext.InstantMessageManager.Notifier;
                    if (notifier != null)
                    {
                        InstantMessagePayloadUtilities.GenerateUnavailablePayload(notifier, null, "Not signed in because IsSignedOutOfIM was true.", InstantMessageServiceError.ClientSignOut, false);
                    }
                    return(false);
                }
                result = true;
            }
            finally
            {
                stopwatch.Stop();
                OwaApplication.GetRequestDetailsLogger.Set(InstantMessageSignIn.LogMetadata.HandleSignOutFlag, stopwatch.ElapsedMilliseconds);
            }
            return(result);
        }
        public void SignOut()
        {
            ExTraceGlobals.InstantMessagingTracer.TraceDebug((long)this.GetHashCode(), "InstantMessageManager.SignOut.");
            InstantMessageProvider instantMessageProvider = Interlocked.Exchange <InstantMessageProvider>(ref this.provider, null);

            if (instantMessageProvider != null)
            {
                if (this.notifier != null)
                {
                    InstantMessagePayloadUtilities.GenerateUnavailablePayload(this.notifier, null, "Signed out manually.", InstantMessageServiceError.ClientSignOut, false);
                }
                instantMessageProvider.Dispose();
            }
        }
Exemple #4
0
        private void SendMessageCallback(IAsyncResult result)
        {
            IIMModality iimmodality = null;

            try
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug((long)this.GetHashCode(), "InstantMessageQueue.SendMessageCallback");
                iimmodality = (result.AsyncState as IIMModality);
                if (iimmodality == null)
                {
                    ExTraceGlobals.InstantMessagingTracer.TraceError((long)this.GetHashCode(), "InstantMessageQueue.SendMessageCallback. Instant Messaging Modality is null.");
                }
                else
                {
                    iimmodality.EndSendMessage(result);
                }
            }
            catch (InstantMessagingException ex)
            {
                InstantMessagePayloadUtilities.GenerateMessageNotDeliveredPayload(this.notifier, "InstantMessageQueue.SendMessageCallback", (iimmodality == null || iimmodality.Conversation == null) ? 0 : iimmodality.Conversation.Cid, ex);
                InstantMessagingError code = ex.Code;
                if (code <= 18102)
                {
                    if (code == 0)
                    {
                        goto IL_DB;
                    }
                    if (code == 18102)
                    {
                        InstantMessagingErrorSubCode subCode = ex.SubCode;
                        if (subCode != 9)
                        {
                            InstantMessageUtilities.SendWatsonReport("InstantMessageQueue.SendMessageCallback", this.userContext, ex);
                            goto IL_DB;
                        }
                        goto IL_DB;
                    }
                }
                else if (code == 18201 || code == 18204)
                {
                    goto IL_DB;
                }
                InstantMessageUtilities.SendWatsonReport("InstantMessageQueue.SendMessageCallback", this.userContext, ex);
                IL_DB :;
            }
            catch (Exception exception)
            {
                InstantMessageUtilities.SendWatsonReport("InstantMessageQueue.SendMessageCallback", this.userContext, exception);
            }
        }
        public void TerminateProvider(string reason)
        {
            ExTraceGlobals.InstantMessagingTracer.TraceDebug((long)this.GetHashCode(), "InstantMessageManager.TerminateProvider.");
            InstantMessageProvider instantMessageProvider = Interlocked.Exchange <InstantMessageProvider>(ref this.provider, null);

            if (instantMessageProvider != null)
            {
                if (this.notifier != null)
                {
                    InstantMessagePayloadUtilities.GenerateUnavailablePayload(this.notifier, null, "Disconnected from IM by server due to timeout: " + reason, InstantMessageServiceError.ServerTimeout, false);
                }
                instantMessageProvider.Dispose();
            }
        }
        // Token: 0x06000B8F RID: 2959 RVA: 0x0002CBB8 File Offset: 0x0002ADB8
        internal static void GenerateMessageNotDeliveredPayload(InstantMessageNotifier notifier, string methodName, int conversationId, Exception exception)
        {
            string arg = string.Empty;

            if (exception != null && exception.Message != null)
            {
                arg = exception.Message;
            }
            ExTraceGlobals.InstantMessagingTracer.TraceError <string, string>(0L, "{0} failed. {1}", methodName, arg);
            UserActivityType          alertType = UserActivityType.FailedDelivery;
            InstantMessagingException ex        = exception as InstantMessagingException;

            if (ex != null && ex.SubCode == 504)
            {
                alertType = UserActivityType.DeliveryTimeout;
            }
            InstantMessagePayloadUtilities.GenerateInstantMessageAlertPayload(notifier, conversationId, alertType);
        }
 // Token: 0x06000B8C RID: 2956 RVA: 0x0002C9F0 File Offset: 0x0002ABF0
 internal static void GenerateUnavailablePayload(InstantMessageNotifier notifier, Exception exception, string errorLocation, InstantMessageServiceError errorCode, bool recurseThroughException)
 {
     InstantMessagePayloadUtilities.GenerateUnavailablePayload(notifier, exception, errorLocation, errorCode, 0, recurseThroughException);
 }
 // Token: 0x06000B91 RID: 2961 RVA: 0x0002CC32 File Offset: 0x0002AE32
 internal static void GenerateInstantMessageAlertPayload(InstantMessageNotifier notifier, int chatId, UserActivityType alertType)
 {
     InstantMessagePayloadUtilities.GenerateInstantMessageAlertPayload(notifier, chatId, alertType, null);
 }
 // Token: 0x06000B90 RID: 2960 RVA: 0x0002CC15 File Offset: 0x0002AE15
 internal static void GenerateMessageNotDeliveredPayload(InstantMessageNotifier notifier, string methodName, int chatId, UserActivityType alertType)
 {
     ExTraceGlobals.InstantMessagingTracer.TraceError <string, UserActivityType>(0L, "{0} failed. {1}", methodName, alertType);
     InstantMessagePayloadUtilities.GenerateInstantMessageAlertPayload(notifier, chatId, alertType);
 }