/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System; namespace JetBrains.Omea.OpenAPI { /// /// Interface which allows to disable the merge operation for groups of contacts /// which match a certain condition. /// /// 1.0.3 public interface IContactMergeFilter { /// /// Checks if the specified list of contacts can be merged. /// /// The list of contacts selected by the user /// for merging. /// null if the merge is allowed, or an error message string if the /// merge is not allowed. string CheckMergeAllowed( IResourceList contacts ); } /// /// Manages various core operations with contacts. /// public interface IContactManager { /// /// Creates a new contact with the specified name fields. /// /// The wrapper for the contact resource. /// Method does not check the existance of the contact with /// the same values of the name fields and creates other resource IContact CreateContact( string title, string firstName, string midName, string lastName, string suffix ); /// /// Creates a new contact with the specified name fields. /// /// The wrapper for the contact resource, or null if given full name is null, empty or /// consists of delimiters only. /// 1. Method does not check the existance of the contact with /// the same values of the name fields and creates other resource. /// 2. The sender name is automatically split into the title, first name, middle name, last name and suffix. /// The heuristics to do so may not always be correct, so if you know exactly /// name fields of a contact, it is strongly recommended to use the /// five-parameter overload. IContact CreateContact( string fullName ); /// /// Method tries to find an empty contact linked to the given account and update its fields. /// Otherwise new contact (possibly empty) is created with the specified name fields. /// /// The wrapper for the contact resource. /// 1. Method does not link email account resource with the newly created contact. /// 2. Email account must be not NULL IContact CreateOrUpdateContact( IResource emailAcc, string title, string firstName, string midName, string lastName, string suffix ); /// /// Method tries to find an empty contact linked to the given account and update its fields. /// Otherwise new contact (possibly empty) is created with the specified name fields. /// /// The wrapper for the contact resource. /// 1. Method does not link email account resource with the newly created contact. /// 2. Email account must be not NULL. /// 3. The sender name is automatically split into the title, first name, middle name, last name and suffix. /// The heuristics to do so may not always be correct, so if you know exactly /// name fields of a contact, it is strongly recommended to use the /// six-parameter overload. /// 1.0.3 IContact CreateOrUpdateContact( IResource emailAcc, string fullName ); /// /// Locates an existing contact with the specified name. /// /// Full name of a contact. /// The wrapper for the contact resource, null if no contact is found. /// The sender name is automatically split into the first name and last name. /// The heuristics to do so may not always be correct, so if you know exactly /// name fields of a contact, it is strongly recommended to use the /// six-parameter overload. IContact FindContact( string senderName ); /// /// Locates an existing contact with the specified name. /// /// The wrapper for the contact resource, null if no contact is found. IContact FindContact( string title, string firstName, string midName, string lastName, string suffix ); /// /// Find all contacts matching the given full name. /// /// List of matching contact resources. IResourceList FindContactList( string fullName ); /// /// Find all contacts matching the given the set of name fields. /// /// List of matching contact resources. IResourceList FindContactList( string title, string firstName, string midName, string lastName, string suffix ); /// /// Locates an existing contact or creates a new contact with the specified name /// and e-mail address. /// /// The e-mail address of the contact to find or create. /// The name of the contact to find or create. /// The wrapper for the contact resource. /// The sender name is automatically split into the first name and last name. /// The heuristics to do so may not always be correct, so if you know exactly /// the first and last names of a contact, it is strongly recommended to use the /// three-parameter overload. IContact FindOrCreateContact( string email, string senderName ); /// /// Locates an existing contact or creates a new contact with the specified first /// name, last name and e-mail address. /// /// The e-mail address of the contact to find or create. /// The first name of the contact to find or create. /// The last name of the contact to find or create. /// The wrapper for the contact resource. /// Six-parameter /// overload (with full set of name fields). IContact FindOrCreateContact( string email, string firstName, string lastName ); /// /// Locates an existing contact or creates a new contact with the specified set /// of name fields and e-mail address. /// /// The e-mail address of the contact to find or create. /// The title of the contact to find or create. /// The first name of the contact to find or create. /// The middle name of the contact to find or create. /// The last name of the contact to find or create. /// The suffix of the contact to find or create. /// The wrapper for the contact resource. IContact FindOrCreateContact( string email, string title, string firstName, string midName, string lastName, string suffix ); /// /// Adds the specified name and e-mail address to the MySelf contact (the contact /// representing the current user of Omea), and returns that contact. /// /// The e-mail address to use for the MySelf contact. /// The name to use for the MySelf contact. /// The wrapper for the MySelf contact. /// seven-parameter overload IContact FindOrCreateMySelfContact( string email, string senderName ); /// /// Adds the specified name and e-mail address to the MySelf contact (the contact /// representing the current user of Omea), and returns that contact. /// /// The wrapper for the MySelf contact. /// 1.0.3 IContact FindOrCreateMySelfContact( string email, string title, string firstName, string midName, string lastName, string suffix ); /// /// Parse name of a contact and split it into several structural parts. /// /// Name of a contact (correspondent). /// Email account of a contact (may be null). /// Title of a contact. /// First name of a contact. /// Middle name of a contact. /// Last name of a contact. /// Suffix of a contact. /// Whether method managed to parse a name. bool ResolveName( string fullName, string emailAccount, out string title, out string firstName, out string midName, out string lastName, string suffix ); /// /// Locates an existing e-mail account resource or creates a new one for the specified /// e-mail address. /// /// The e-mail address for which the account is created. /// The resource of type EmailAccount. IResource FindOrCreateEmailAccount( string email ); /// /// Locates an existing mailing list resource or creates a new one with the specified /// e-mail address. /// /// The e-mail address of the mailing list. /// The resource of type MailingList. IResource FindOrCreateMailingList( string email ); /// /// Merges contacts in the input list with the resulting fullName name. /// All links from all input contacts are retargeted to the result contact. /// /// New name for the resulting contact /// Source contacts for merging. /// Resource of the resulting contact. IResource Merge( string fullName, IResourceList contacts ); /// /// Splits previously merged contact into original ones. /// /// The contact to be split. /// A list of contact resources from which merged contact was created. IResourceList Split( IResource contact ); /// /// Splits previously merged contact into several original ones, given in /// the second parameter contactToExtract. If not all subcontacts are to /// be extracted from the base one, others are still kept under the the base /// contact. /// /// The contact to be split. /// The list of contacts (represented by the corresponding /// wrappers) to be extracted and represented as standalone resources. /// A list of contact resources from which merged contact was created. /// Source contact is also included into the final list. IResourceList Split( IResource contact, IResourceList contactToExtract ); /// /// Performs basic operations on linking between e.g. mail and a contact: /// bind a mail and a contact with "From", "To" or "CC" link; create a /// new object "ContactName" and bind a mail and CN with "NameFrom", /// "NameTo" or "NameCC" link, and finally link CN and its base contact /// object /// /// Id of link between a mail and a contact /// Base contact /// A resource to be linked (mail, news article etc.) /// Mail account of a mail. /// Name which will be shown to the user. void LinkContactToResource( int propId, IResource contact, IResource mail, IResource account, string senderName ); /// /// Performs basic operations on linking between e.g. mail and a contact: /// bind a mail and a contact with "From", "To" or "CC" link; create a /// new object "ContactName" and bind a mail and CN with "NameFrom", /// "NameTo" or "NameCC" link, and finally link CN and its base contact /// object /// /// Id of link between a mail and a contact /// Base contact /// A resource to be linked (mail, news article etc.) /// String representation of a mail account. /// Name which will be shown to the user. void LinkContactToResource( int propId, IResource contact, IResource mail, string account, string senderName ); /// /// Delete a contact given its resource. /// /// Resource representing a contact. /// If contact is to be deleted non-permanently /// this parameter prevents from "recreating" this contact again if /// new correspondence comes from it. /// If method fails to delete a contact, this parameter /// contains an error message describing the reason. /// 1.0.3 void DeleteContact( IResource contact, bool ignoreContactLater, out string errMessage ); /// /// Check whether the input resource (e.g. mail, article or rss post) is linked /// to a contact information (Contact, ContactName and EmailAccount) and removes /// these links for it (e.g. before a resource deletion). /// /// A resource for cleanup. /// 2.0 void UnlinkContactInformation( IResource res ); /// /// Return the complete (full) name of the contact represented by the given resource. /// /// A resource from properties of which the full name is to be constructed. /// Full name of a contact. string GetFullName( IResource res ); /// /// Create IContact wrapper around IResource object. /// /// A resource representing Contact. /// IContact wrapper. IContact GetContact( IResource res ); /// /// Scans the specified list for the contacts which were not created by the user /// and which don't have any message links and deletes those contacts. /// /// The list of contacts to scan for unused ones. void DeleteUnusedContacts( IResourceList contacts ); /// /// Registers the filter which will be used for checking if specified /// lists of contacts can be merged. /// /// The filter which is registered. /// 1.0.3 void RegisterContactMergeFilter( IContactMergeFilter filter ); /// /// Returns the list of registered contact merge filters. /// /// The array of merge filters. /// 1.0.3 IContactMergeFilter[] GetContactMergeFilters(); /// /// Returns the contact representing the owner user of the program. /// IContact MySelf { get; } /// /// IDs of standard property types related to contacts. /// /// 2.0 IContactManagerProps Props { get; } } /// /// Defines the IDs of standard property types related to contacts. /// /// 2.0 public interface IContactManagerProps { /// /// ID of the "From" property type. /// int LinkFrom { get; } /// /// ID of the "To" property type. /// int LinkTo { get; } /// /// ID of the "CC" property type. /// int LinkCC { get; } /// /// ID of the "EmailAcct" property type, links a Contact (ContactName) /// and EmailAccount resources. /// int LinkEmailAcct { get; } /// /// ID of the "EmailAccountFrom" property type, links a mail /// and EmailAccount resources. /// int LinkEmailAcctFrom{ get; } /// /// ID of the "EmailAccountTo" property type, links a mail /// and EmailAccount resources. /// int LinkEmailAcctTo { get; } /// /// ID of the "EmailAccountCC" property type, links a mail /// and EmailAccount resources. /// int LinkEmailAcctCC { get; } /// /// ID of the "EmailAddress" property type. /// int EmailAddress { get; } /// /// ID of the "UserAccount" property type. /// int UserName { get; } /// /// ID of the "Domain" property type. /// int Domain { get; } /// /// ID of the "IsGroupAccout" property type. If property is set /// then the account is possibly a group account and must be resolved /// strictly. /// int PersonalAccount { get; } /// /// ID of the "ShowOriginalNames" property type. If property is set /// then user will see not the name of a conact but one of its contact name /// (ContactName resource) in resource list, links pane and links bar. /// int ShowOriginalNames { get; } /// /// ID of the "NameFrom" property type. Connects a resource and a ContactName. /// int LinkNameFrom { get; } /// /// ID of the "NameTo" property type. Connects a resource and a ContactName. /// int LinkNameTo { get; } /// /// ID of the "NameCC" property type. Connects a resource and a ContactName. /// int LinkNameCC { get; } /// /// ID of the "BaseContact" property type. Connects a ContactName and a Contact. /// int LinkBaseContact { get; } /// /// ID of the "LinkedResourcesOfType" property type. Connects a Contact and /// Resource Type resources if there was at least one link between a Contact /// and a correspondence of that resource type. /// int LinkLinkedOfType { get; } /// /// ID of the IsIgnored property. /// int Ignored { get; } /// /// ID of the Myself property. Indicates that a contact represents a /// contact of the Omea owner. /// int Myself { get; } /// /// ID of the LastCorrespondDate property. Property belongs to the Contact resource and indicates /// a date of the last correspondence item from that contact. /// int LastCorrespondenceDate { get; } /// /// ID of the Picture property. Keeps the image thumbnail aligned inside the /// box 48x48. /// int Picture { get; } /// /// ID of the ContactOriginalPicture property. Keeps the original image. /// int PictureOriginal { get; } } /// /// Provides convenience wrappers for working with a Contact resource. /// public interface IContact { /// /// Gets the resource representing the contact. /// IResource Resource { get; } /// /// Gets or sets the title of the contact. /// string Title { get; set; } /// /// Gets or sets the first name of the contact. /// string FirstName { get; set; } /// /// Gets or sets the middle name of the contact. /// string MiddleName { get; set; } /// /// Gets or sets the last name of the contact. /// string LastName { get; set; } /// /// Gets or sets the suffix of the contact. /// string Suffix { get; set; } /// /// Gets or sets the homepage of the contact. /// string HomePage { get; set; } /// /// Gets or sets the address of the contact. /// string Address { get; set; } /// /// Gets or sets the company of the contact. /// string Company { get; set; } /// /// Gets or sets the job title of the contact. /// string JobTitle { get; set; } /// /// Gets or sets the birthday of the contact. /// DateTime Birthday { get; set; } /// /// Gets the default e-mail address of the contact. /// string DefaultEmailAddress { get; } /// /// Gets or sets a string of a description of the contact. /// Description string is in the rich-text format. /// string Description { get; set; } /// /// Gets or sets the date of the last correspondence with a contact. /// /// The date is used to determine which contacts should be shown in the /// Active view. DateTime LastCorrespondDate { get; set; } /// /// Sets the name fields of the contact to specified values. /// /// The title of the contact. /// The first name of the contact. /// The middle name of the contact. /// The last name of the contact. /// The suffix of the contact. void UpdateNameFields( string title, string firstName, string midName, string lastName, string suffix ); /// /// Breaks the specified full name into components and sets the name fields of the contact to the /// resulting components. /// /// The full name of the contact. void UpdateNameFields( string fullName ); /// /// Link a contact with the account. /// /// A resource representing an email account. void AddAccount( IResource emailAccount ); /// /// Link a contact with the account. /// /// String representing an email account. /// for base method. void AddAccount( string emailAccount ); /// /// Returns true if the contact represents the user of Omea. /// bool IsMyself { get; } /// /// Returns true if the contact is imported from any Address or Contact book. /// bool IsImported { get; } /// /// Begins a batch update of the contact. During a batch update, changes to the contact /// do not cause immediate sending of notifications; after the batch update, if the contact /// indexed text is changed, the contact is automatically queued for reindexing. /// /// 2.0 void BeginUpdate(); /// /// Ends a batch update of the contact and queues it for indexing if the indexed text is changed. /// /// 2.0 void EndUpdate(); /// /// Request a contact text to be indexed. /// /// 2.0 void QueueIndexing(); /// /// Returns the list of phone names defined for the contact. /// /// The array of phone name strings, or an empty array if no phones are defined. string[] GetPhoneNames(); /// /// Checks if the contact has a phone with the specified number. /// /// The phone number to check. /// true if the phone number exists, false otherwise. bool PhoneNumberExists( string phoneNumber ); /// /// Adds or changes a phone with the specified name and number. /// /// Name of the phone to set. /// Number of the phone to set. void SetPhoneNumber( string phoneName, string phoneNumber ); /// /// Returns a phone number with the specified name. /// /// Name of the phone to get. /// Phone number if a phone wuth the specified name exist, null otherwise. string GetPhoneNumber( string phoneName ); /// /// Returns a resource desribing a phone given the phone number. Phone numbers /// are compared by their normalized representations. /// /// Phone number. /// A resource desribing a phone, null otherwise. IResource GetPhoneByNumber( string phoneNumber ); } }