public void SendMessage(string callerUserName, string calleeUserName, string messageText, int tenantId, string domain)
        {
            if (enableSignalr != "true" || !IsAvailable()) return;

            using (var service = new SignalrServiceClientWcf())
            {
                if (service != null)
                {
                    try
                    {
                        if (fromTeamlabToOnlyOffice == "true" && domain.EndsWith(fromServerInJid))
                        {
                            int place = domain.LastIndexOf(fromServerInJid);
                            if (place >= 0)
                            {
                                domain = domain.Remove(place, fromServerInJid.Length).Insert(place, toServerInJid);
                            }
                        }
                        log.DebugFormat("Send Message callerUserName={0}, calleeUserName={1}, messageText={2}, tenantId={3}, domain={4}",
                            callerUserName, calleeUserName, messageText, tenantId, domain);
                        service.SendMessage(callerUserName, calleeUserName, messageText, tenantId, domain);
                    }
                    catch (Exception error)
                    {
                        ProcessError(error);
                    }
                }
            }
        }
Beispiel #2
0
        private SignalrServiceClientWcf GetService()
        {
            var service = new SignalrServiceClientWcf();

            try
            {
                service.Open();
            }
            catch (Exception error)
            {
                ProcessError(error);
                service.Close();
                service = null;
            }
            return(service);
        }
 private SignalrServiceClientWcf GetService()
 {
     var service = new SignalrServiceClientWcf();
     try
     {
         service.Open();
     }
     catch (Exception error)
     {
         ProcessError(error);
         service.Close();
         service = null;
     }
     return service;
 }
        public void SendMailNotification(int tenant, string userId, int state)
        {
            if (enableSignalr != "true" || !IsAvailable()) return;

            using (var service = new SignalrServiceClientWcf())
            {
                if (service != null)
                {
                    try
                    {
                        log.Debug("Send Mail Notification");
                        service.SendMailNotification(tenant, userId, state);
                    }
                    catch (Exception error)
                    {
                        ProcessError(error);
                    }
                }
            }
        }
        public void SendUnreadUsers(Dictionary<int, HashSet<Guid>> unreadUsers)
        {
            if (enableSignalr != "true" || !IsAvailable()) return;

            using (var service = new SignalrServiceClientWcf())
            {
                if (service != null)
                {
                    try
                    {
                        log.Debug("Send Unread Users");
                        service.SendUnreadUsers(unreadUsers);
                    }
                    catch (Exception error)
                    {
                        ProcessError(error);
                    }
                }
            }
        }
        public void SendUnreadCounts(Dictionary<string, int> unreadCounts, string domain)
        {
            if (enableSignalr != "true" || !IsAvailable()) return;

            using (var service = new SignalrServiceClientWcf())
            {
                if (service != null)
                {
                    try
                    {
                        if (fromTeamlabToOnlyOffice == "true" && domain.EndsWith(fromServerInJid))
                        {
                            int place = domain.LastIndexOf(fromServerInJid);
                            if (place >= 0)
                            {
                                domain = domain.Remove(place, fromServerInJid.Length).Insert(place, toServerInJid);
                            }
                        }
                        log.DebugFormat("SendUnreadCounts domain={0}", domain);
                        service.SendUnreadCounts(unreadCounts, domain);
                    }
                    catch (Exception error)
                    {
                        ProcessError(error);
                    }
                }
            }
        }
        public void SendOfflineMessages(string callerUserName, List<string> users, int tenantId)
        {
            if (enableSignalr != "true" || !IsAvailable()) return;

            using (var service = new SignalrServiceClientWcf())
            {
                if (service != null)
                {
                    log.DebugFormat("SendOfflineMessages callerUserName={0}, tenantId={1}", callerUserName, tenantId);
                    try
                    {
                        service.SendOfflineMessages(callerUserName, users, tenantId);
                    }
                    catch (Exception error)
                    {
                        ProcessError(error);
                    }
                }
            }
        }