Exemple #1
0
        // Token: 0x06000C3D RID: 3133 RVA: 0x000402AC File Offset: 0x0003E4AC
        internal MailboxItemFetchProvider(SyncStateStorage syncStateStorage, int protocolVersion, MailboxSession mailboxSession)
        {
            this.disposeTracker = this.GetDisposeTracker();
            AirSyncCounters.NumberOfMailboxItemFetches.Increment();
            this.syncStateStorage = syncStateStorage;
            this.mailboxSession   = mailboxSession;
            IAirSyncVersionFactory airSyncVersionFactory = AirSyncProtocolVersionParserBuilder.FromVersion(protocolVersion);

            this.syncStates             = new Dictionary <string, FolderSyncState>();
            this.schemaStates           = new Dictionary <string, AirSyncSchemaState>();
            this.bodyPreferences        = new List <BodyPreference>();
            this.bodyPartPreferences    = new List <BodyPartPreference>();
            this.schemaConverterOptions = new Hashtable();
            this.schemaStates.Add("Email", airSyncVersionFactory.CreateEmailSchema(null));
            this.schemaStates.Add("Calendar", airSyncVersionFactory.CreateCalendarSchema());
            this.schemaStates.Add("Contacts", airSyncVersionFactory.CreateContactsSchema());
            this.schemaStates.Add("Tasks", airSyncVersionFactory.CreateTasksSchema());
            AirSyncSchemaState airSyncSchemaState = airSyncVersionFactory.CreateNotesSchema();

            if (airSyncSchemaState != null)
            {
                this.schemaStates.Add("Notes", airSyncSchemaState);
            }
            airSyncSchemaState = airSyncVersionFactory.CreateSmsSchema();
            if (airSyncSchemaState != null)
            {
                this.schemaStates.Add("SMS", airSyncSchemaState);
            }
        }
        public QueryFilter ParseTopLevelClassAndFolders(XmlNode queryNode, bool contentIndexingEnabled, IAirSyncVersionFactory versionFactory, IAirSyncContext context)
        {
            this.Clear();
            if (queryNode.ChildNodes.Count != 1)
            {
                throw new SearchFilterTooComplexException
                      {
                          ErrorStringForProtocolLogger = "SearchTooComplexError1"
                      };
            }
            XmlNode xmlNode = queryNode.ChildNodes[0];

            if ("Search:" != xmlNode.NamespaceURI || "And" != xmlNode.Name)
            {
                throw new SearchFilterTooComplexException
                      {
                          ErrorStringForProtocolLogger = "SearchTooComplexError1"
                      };
            }
            List <string>  list  = new List <string>();
            List <string>  list2 = new List <string>();
            List <XmlNode> list3 = new List <XmlNode>();

            this.contentIndexingEnabled = contentIndexingEnabled;
            foreach (object obj in xmlNode.ChildNodes)
            {
                XmlNode xmlNode2 = (XmlNode)obj;
                if ("AirSync:" == xmlNode2.NamespaceURI && "CollectionId" == xmlNode2.Name)
                {
                    if (xmlNode2.ChildNodes.Count != 1 || xmlNode2.FirstChild.NodeType != XmlNodeType.Text)
                    {
                        throw new SearchProtocolErrorException
                              {
                                  ErrorStringForProtocolLogger = "SearchProtocolError1"
                              };
                    }
                    list2.Add(xmlNode2.InnerText);
                }
                else if ("AirSync:" == xmlNode2.NamespaceURI && "Class" == xmlNode2.Name)
                {
                    if (xmlNode2.ChildNodes.Count != 1 || xmlNode2.FirstChild.NodeType != XmlNodeType.Text)
                    {
                        throw new SearchProtocolErrorException
                              {
                                  ErrorStringForProtocolLogger = "SearchProtocolError2"
                              };
                    }
                    list.Add(xmlNode2.InnerText);
                }
                else
                {
                    list3.Add(xmlNode2);
                }
            }
            if (list3.Count < 1)
            {
                throw new SearchProtocolErrorException
                      {
                          ErrorStringForProtocolLogger = "SearchProtocolError3"
                      };
            }
            this.folderScope    = list2;
            this.airSyncClasses = list;
            this.schemaCache    = new Dictionary <string, MailboxSearchCriteriaBuilder.SchemaCacheItem>();
            List <QueryFilter> list4 = new List <QueryFilter>();

            new List <QueryFilter>();
            if (list.Count == 0)
            {
                list.Add("Email");
                list.Add("Calendar");
                list.Add("Contacts");
                list.Add("Tasks");
                if (context.Request.Version >= 140)
                {
                    list.Add("Notes");
                    list.Add("SMS");
                }
            }
            foreach (string text in list)
            {
                string key;
                switch (key = text)
                {
                case "Email":
                    this.schemaCache["Email"] = new MailboxSearchCriteriaBuilder.SchemaCacheItem(versionFactory.CreateEmailSchema(null), versionFactory.CreateMissingPropertyStrategy(null));
                    continue;

                case "Calendar":
                    this.schemaCache["Calendar"] = new MailboxSearchCriteriaBuilder.SchemaCacheItem(versionFactory.CreateCalendarSchema(), versionFactory.CreateMissingPropertyStrategy(null));
                    continue;

                case "Contacts":
                    this.schemaCache["Contacts"] = new MailboxSearchCriteriaBuilder.SchemaCacheItem(versionFactory.CreateContactsSchema(), versionFactory.CreateMissingPropertyStrategy(null));
                    continue;

                case "Tasks":
                    this.schemaCache["Tasks"] = new MailboxSearchCriteriaBuilder.SchemaCacheItem(versionFactory.CreateTasksSchema(), versionFactory.CreateMissingPropertyStrategy(null));
                    continue;

                case "Notes":
                    if (context.Request.Version < 140)
                    {
                        throw new SearchProtocolErrorException
                              {
                                  ErrorStringForProtocolLogger = "SearchProtocolError4"
                              };
                    }
                    this.schemaCache["Notes"] = new MailboxSearchCriteriaBuilder.SchemaCacheItem(versionFactory.CreateNotesSchema(), versionFactory.CreateMissingPropertyStrategy(null));
                    continue;

                case "SMS":
                    if (context.Request.Version < 140)
                    {
                        throw new SearchProtocolErrorException
                              {
                                  ErrorStringForProtocolLogger = "SearchProtocolError5"
                              };
                    }
                    this.schemaCache["SMS"] = new MailboxSearchCriteriaBuilder.SchemaCacheItem(versionFactory.CreateSmsSchema(), versionFactory.CreateMissingPropertyStrategy(null));
                    continue;
                }
                throw new SearchProtocolErrorException
                      {
                          ErrorStringForProtocolLogger = "SearchProtocolError6"
                      };
            }
            foreach (XmlNode node in list3)
            {
                QueryFilter queryFilter = this.ParseSearchNamespace(node);
                if (queryFilter == null)
                {
                    return(null);
                }
                list4.Add(queryFilter);
            }
            return(MailboxSearchCriteriaBuilder.ConstructAndOrOperator(list4, "And"));
        }
Exemple #3
0
 public override void SetFolderSyncOptions(IAirSyncVersionFactory versionFactory, bool isQuarantineMailAvailable, GlobalInfo globalInfo)
 {
 }
Exemple #4
0
        public override void SetSchemaConverterOptions(IDictionary schemaConverterOptions, IAirSyncVersionFactory versionFactory)
        {
            AirSyncEntitySchemaState        airSyncEntitySchemaState = (AirSyncEntitySchemaState)base.SchemaState;
            IAirSyncMissingPropertyStrategy missingPropertyStrategy  = versionFactory.CreateMissingPropertyStrategy(base.SupportedTags);

            base.ChangeTrackFilter = ChangeTrackingFilterFactory.CreateFilter(base.ClassType, base.ProtocolVersion);
            base.AirSyncDataObject = airSyncEntitySchemaState.GetAirSyncDataObject(schemaConverterOptions, missingPropertyStrategy);
            this.EntityDataObject  = airSyncEntitySchemaState.GetEntityDataObject();
        }
        // Token: 0x0600184D RID: 6221 RVA: 0x0008E8B4 File Offset: 0x0008CAB4
        private static bool ParseSupportedTags(int version, List <TagNode> tags, StoreObjectType type)
        {
            if (tags.Count == 0 || version < 21)
            {
                return(true);
            }
            Dictionary <string, bool> dictionary = new Dictionary <string, bool>(tags.Count);

            foreach (TagNode tagNode in tags)
            {
                if (tagNode.NameSpace == 2)
                {
                    tagNode.NameSpace = 1;
                }
                else
                {
                    if (tagNode.NameSpace != 3)
                    {
                        return(false);
                    }
                    tagNode.NameSpace = 4;
                }
                int    tag  = (int)tagNode.NameSpace << 8 | (int)(tagNode.Tag + 4);
                string name = TiSyncUpgrade.wbxmlSchema.GetName(tag);
                dictionary.Add(name, false);
            }
            IAirSyncVersionFactory airSyncVersionFactory = AirSyncProtocolVersionParserBuilder.FromVersion(version);
            AirSyncSchemaState     airSyncSchemaState;

            switch (type)
            {
            case StoreObjectType.Folder:
                airSyncSchemaState = airSyncVersionFactory.CreateEmailSchema(null);
                break;

            case StoreObjectType.CalendarFolder:
                airSyncSchemaState = airSyncVersionFactory.CreateCalendarSchema();
                break;

            case StoreObjectType.ContactsFolder:
                airSyncSchemaState = airSyncVersionFactory.CreateContactsSchema();
                break;

            case StoreObjectType.TasksFolder:
                airSyncSchemaState = airSyncVersionFactory.CreateTasksSchema();
                break;

            default:
                return(false);
            }
            AirSyncSetToDefaultStrategy airSyncSetToDefaultStrategy = new AirSyncSetToDefaultStrategy(dictionary);
            AirSyncDataObject           airSyncDataObject           = airSyncSchemaState.GetAirSyncDataObject(new Hashtable(), airSyncSetToDefaultStrategy);

            try
            {
                airSyncSetToDefaultStrategy.Validate(airSyncDataObject);
            }
            catch (ConversionException)
            {
                return(false);
            }
            return(true);
        }
        public override void SetSchemaConverterOptions(IDictionary schemaConverterOptions, IAirSyncVersionFactory versionFactory)
        {
            AirSyncRecipientInfoCacheSchemaState airSyncRecipientInfoCacheSchemaState = (AirSyncRecipientInfoCacheSchemaState)base.SchemaState;

            base.ChangeTrackFilter = ChangeTrackingFilterFactory.CreateFilter(base.ClassType, base.ProtocolVersion);
            IAirSyncMissingPropertyStrategy missingPropertyStrategy = versionFactory.CreateMissingPropertyStrategy(null);

            base.AirSyncDataObject            = airSyncRecipientInfoCacheSchemaState.GetAirSyncDataObject(schemaConverterOptions, missingPropertyStrategy);
            this.recipientInfoCacheDataObject = airSyncRecipientInfoCacheSchemaState.GetRecipientInfoCacheDataObject();
        }
 public override void SetFolderSyncOptions(IAirSyncVersionFactory versionFactory, bool isQuarantineMailAvailable, GlobalInfo globalInfo)
 {
     base.FilterType = AirSyncV25FilterTypes.NoFilter;
     base.SyncState[CustomStateDatumType.FilterType] = new Int32Data((int)base.FilterType);
     base.SyncState[CustomStateDatumType.MaxItems]   = new Int32Data(base.MaxItems);
 }
 public override bool GenerateResponsesXmlNode(XmlDocument xmlResponse, IAirSyncVersionFactory versionFactory, string deviceType, GlobalInfo globalInfo, ProtocolLogger protocolLogger, MailboxLogger mailboxLogger)
 {
     return(false);
 }