Example #1
0
        public static void SetPrivateStatus(int ThreadNodeId)
        {
            ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(ThreadNodeId);

            if (settings.Contains(ForumThreadNodeSetting.Outgoing))
            {
                settings.Remove(ForumThreadNodeSetting.Outgoing);
            }
            if (settings.Contains(ForumThreadNodeSetting.Incoming))
            {
                settings.Remove(ForumThreadNodeSetting.Incoming);
            }

            settings.Add(ForumThreadNodeSetting.Internal, "1");
        }
Example #2
0
        /// <summary>
        /// Processes the X ibn headers.
        /// </summary>
        /// <param name="IncidentId">The incident id.</param>
        /// <param name="ThreadNodeId">The thread node id.</param>
        /// <param name="Msg">The MSG.</param>
        /// <returns></returns>
        public static bool ProcessXIbnHeaders(int IncidentId, int ThreadNodeId, Pop3Message Msg)
        {
            bool bRetVal = true;

            ForumStorage.NodeType nodeType = ForumStorage.NodeType.Internal;

            ForumThreadNodeSettingCollection settings = new ForumThreadNodeSettingCollection(ThreadNodeId);

            if (settings.Contains(ForumThreadNodeSetting.Incoming))
            {
                nodeType = ForumStorage.NodeType.Incoming;
            }
            else if (settings.Contains(ForumThreadNodeSetting.Outgoing))
            {
                nodeType = ForumStorage.NodeType.Outgoing;
            }

            bool         bSetIncidentState = false;
            ObjectStates cmdObjectStates   = ObjectStates.Active;
            int          newResponsibleId  = 0;

            foreach (string HeaderName in Msg.Headers.AllKeys)
            {
                string UpHeaderName = HeaderName.ToUpper();

                if (UpHeaderName.StartsWith("X-IBN-"))
                {
                    switch (UpHeaderName)
                    {
                    case "X-IBN-STATE":
                        if (Msg.Headers[HeaderName].Trim() != "0")
                        {
                            cmdObjectStates = (ObjectStates)Enum.Parse(typeof(ObjectStates), Msg.Headers[HeaderName]);

                            if (cmdObjectStates >= ObjectStates.Upcoming &&
                                cmdObjectStates <= ObjectStates.OnCheck)
                            {
                                bSetIncidentState = true;
                            }
                            else
                            {
                                // OZ: Wrong Object State
                                cmdObjectStates = ObjectStates.Active;
                            }
                        }
                        break;

                    case "X-IBN-PRIVATEMSG":
                        if (Msg.Headers[HeaderName].Trim() != "0")
                        {
                            XIbnHeaderCommand.SetPrivateStatus(ThreadNodeId);
                            nodeType = ForumStorage.NodeType.Internal;
                            bRetVal  = false;
                        }
                        break;

                    case "X-IBN-RESOLUTION":
                        if (Msg.Headers[HeaderName].Trim() != "0")
                        {
                            XIbnHeaderCommand.SetResolutionStatus(ThreadNodeId);
                        }
                        break;

                    case "X-IBN-WORKAROUND":
                        if (Msg.Headers[HeaderName].Trim() != "0")
                        {
                            XIbnHeaderCommand.SetWorkaroundStatus(ThreadNodeId);
                        }
                        break;

                    case "X-IBN-RESPONSIBLE":
                        if (Msg.Headers[HeaderName].Trim() != "0")
                        {
                            newResponsibleId = int.Parse(Msg.Headers[HeaderName]);
                        }
                        break;

                    default:
                        XIbnHeaderCommand.Unknown(IncidentId, Msg.Headers[HeaderName]);
                        break;
                    }
                }
            }

            // Set Default IBN Object State
            if (!bSetIncidentState)
            {
                if (nodeType == ForumStorage.NodeType.Incoming)
                {
                    IncidentBoxDocument document = IncidentBoxDocument.Load(Incident.GetIncidentBox(IncidentId));

                    switch (document.EMailRouterBlock.IncomingEMailAction)
                    {
                    case ExternalEMailActionType.None:
                        break;

                    case ExternalEMailActionType.SetReOpenState:
                        XIbnHeaderCommand.SetIncidentState(nodeType, document, IncidentId, ThreadNodeId, ObjectStates.ReOpen);
                        break;
                    }
                }
                else if (nodeType == ForumStorage.NodeType.Outgoing)
                {
                    IncidentBoxDocument document = IncidentBoxDocument.Load(Incident.GetIncidentBox(IncidentId));

                    switch (document.EMailRouterBlock.OutgoingEMailAction)
                    {
                    case InternalEMailActionType.None:
                        break;

                    case InternalEMailActionType.SendToCheck:
                        XIbnHeaderCommand.SetIncidentState(nodeType, document, IncidentId, ThreadNodeId, ObjectStates.OnCheck);
                        break;

                    case InternalEMailActionType.SetCompletedState:
                        XIbnHeaderCommand.SetIncidentState(nodeType, document, IncidentId, ThreadNodeId, ObjectStates.Completed);
                        break;

                    case InternalEMailActionType.SetSuspendState:
                        XIbnHeaderCommand.SetIncidentState(nodeType, document, IncidentId, ThreadNodeId, ObjectStates.Suspended);
                        break;
                    }
                }
            }
            else
            {
                IncidentBoxDocument document = IncidentBoxDocument.Load(Incident.GetIncidentBox(IncidentId));
                XIbnHeaderCommand.SetIncidentState(nodeType, document, IncidentId, ThreadNodeId, cmdObjectStates);
            }


            // OZ: 2008-11-24 ChangeResponsible, -1 = NotSet, -2 = Group
            if (newResponsibleId != 0)
            {
                XIbnHeaderCommand.ChangeResponsible(IncidentId, newResponsibleId);
            }


            return(bRetVal);
        }