コード例 #1
0
		private Uri CamelMessageUri (B_U_Camel.MessageInfo message_info)
		{
			return EvolutionMailQueryable.EmailUri (this.account_name, this.folder_name, message_info.uid);
		}
コード例 #2
0
		private Indexable CamelMessageToIndexable (B_U_Camel.MessageInfo messageInfo, string msg_file)
		{
			// Don't index messages flagged as junk
			if (messageInfo.IsJunk)
				return null;

			// Many properties will be set by the filter when
			// processing the cached data, if it's there.  So
			// don't set a number of properties in that case.
			bool have_content = File.Exists (msg_file);

			Uri uri = CamelMessageUri (messageInfo);
			Indexable indexable = new Indexable (uri);

			indexable.Timestamp = messageInfo.SentDate;
			indexable.MimeType = "message/rfc822";
			indexable.HitType = "MailMessage";

			indexable.AddProperty (Property.NewUnsearched ("fixme:account",  this.imap_name));
                        indexable.AddProperty (Property.NewUnsearched ("fixme:folder",   this.folder_name));
			indexable.AddProperty (Property.NewUnsearched ("fixme:client", "evolution"));
			
			if (!have_content) {
				indexable.AddProperty (Property.New ("dc:title", GMime.Utils.HeaderDecodePhrase (messageInfo.subject)));
				indexable.AddProperty (Property.NewDate ("fixme:date", messageInfo.SentDate));
			}

			GMime.InternetAddressList addrs;
			addrs = GMime.InternetAddressList.Parse (messageInfo.to);
			foreach (GMime.InternetAddress ia in addrs) {
				GMime.InternetAddressMailbox mailbox = ia as GMime.InternetAddressMailbox;
				
				if (!have_content) {
					indexable.AddProperty (Property.NewUnsearched ("fixme:to", ia.ToString (false)));
					if (ia is GMime.InternetAddressMailbox)
						indexable.AddProperty (Property.New ("fixme:to_address", mailbox.Address));
					
					indexable.AddProperty (Property.New ("fixme:to_name", ia.Name));
				}
				
				if (this.folder_name == "Sent" && ia is GMime.InternetAddressMailbox)
					indexable.AddProperty (Property.NewUnsearched ("fixme:sentTo", mailbox.Address));
			}
			addrs.Dispose ();

			addrs = GMime.InternetAddressList.Parse (messageInfo.cc);
			foreach (GMime.InternetAddress ia in addrs) {
				GMime.InternetAddressMailbox mailbox = ia as GMime.InternetAddressMailbox;
				
				if (!have_content) {
					indexable.AddProperty (Property.NewUnsearched ("fixme:cc", ia.ToString (false)));
					if (ia is GMime.InternetAddressMailbox)
						indexable.AddProperty (Property.New ("fixme:cc_address", mailbox.Address));
					
					indexable.AddProperty (Property.New ("fixme:cc_name", ia.Name));
				}
				
				if (this.folder_name == "Sent" && ia is GMime.InternetAddressMailbox)
					indexable.AddProperty (Property.NewUnsearched ("fixme:sentTo", mailbox.Address));
			}
			addrs.Dispose ();

			addrs = GMime.InternetAddressList.Parse (messageInfo.from);
			foreach (GMime.InternetAddress ia in addrs) {
				GMime.InternetAddressMailbox mailbox = ia as GMime.InternetAddressMailbox;
				
				if (!have_content) {
					indexable.AddProperty (Property.NewUnsearched ("fixme:from", ia.ToString (false)));
					if (ia is GMime.InternetAddressMailbox)
						indexable.AddProperty (Property.New ("fixme:from_address", mailbox.Address));
					
					indexable.AddProperty (Property.New ("fixme:from_name", ia.Name));
				}

				if (this.folder_name != "Sent" && ia is GMime.InternetAddressMailbox)
					indexable.AddProperty (Property.NewUnsearched ("fixme:gotFrom", mailbox.Address));
			}
			addrs.Dispose ();

                        indexable.AddProperty (Property.NewKeyword ("fixme:mlist", messageInfo.mlist));

			Property flag_prop = Property.NewUnsearched ("fixme:flags", messageInfo.flags);
			flag_prop.IsMutable = true;
			indexable.AddProperty (flag_prop);

			if (this.folder_name == "Sent")
				indexable.AddProperty (Property.NewFlag ("fixme:isSent"));

			if (messageInfo.IsAnswered)
				indexable.AddProperty (Property.NewFlag ("fixme:isAnswered"));

			if (messageInfo.IsDeleted)
				indexable.AddProperty (Property.NewFlag ("fixme:isDeleted"));

			if (messageInfo.IsDraft)
				indexable.AddProperty (Property.NewFlag ("fixme:isDraft"));

			if (messageInfo.IsFlagged)
				indexable.AddProperty (Property.NewFlag ("fixme:isFlagged"));

			if (messageInfo.IsSeen)
				indexable.AddProperty (Property.NewFlag ("fixme:isSeen"));

			if (messageInfo.HasAttachments && !have_content)
				indexable.AddProperty (Property.NewFlag ("fixme:hasAttachments"));

			if (messageInfo.IsAnsweredAll)
				indexable.AddProperty (Property.NewFlag ("fixme:isAnsweredAll"));

			if (have_content)
				indexable.ContentUri = UriFu.PathToFileUri (msg_file);
			else 
				indexable.NoContent = true;

			return indexable;
		}
コード例 #3
0
		private static bool CheckFlags (uint flags, B_U_Camel.CamelFlags test)
		{
			return (flags & (uint) test) == (uint) test;
		}