Esempio n. 1
0
        private void AddContactSource(Contact contact)
        {
            if (contact.SupportedChannels.GetChannelInfo <DBusTubeChannelInfo> (MetadataProviderService.BusName) != null)
            {
                ContactSource source = new ContactSource(contact);
                container.AddChildSource(source);
                source_map[contact.Connection.AccountObjectPath].Add(contact, source);
            }

            contact.ContactServicesChanged += OnContactServicesChanged;
        }
Esempio n. 2
0
 public Contact(long id, ContactType type, double standing = Constants.STANDING_NEUTRAL,
                ContactSource source = ContactSource.Character)
 {
     if (standing.IsNaNOrInfinity() || standing < Constants.STANDING_TERRIBLE ||
         standing > Constants.STANDING_EXCELLENT)
     {
         throw new ArgumentOutOfRangeException("standing");
     }
     ContactID = id;
     Type      = type;
     Source    = source;
     Standing  = standing;
 }
 private void CreateBlindCarbnCopyMessages(
     List <ContactInfo> blindCarbonCopyRecipients,
     ContactSource source,
     Context context,
     ICollection <TemplateParameter> requiredTemplateParameters,
     Template template,
     List <TemplateParameterInfo> templateParameters)
 {
     foreach (var recipient in blindCarbonCopyRecipients)
     {
         var contact = GetOrAddContact(source, context, recipient);
         CreateMessage(requiredTemplateParameters, template, contact, templateParameters);
     }
 }
Esempio n. 4
0
        public IContactProvider GetContactProvider(string token, ContactSource source)
        {
            switch (source)
            {
            case ContactSource.Microsoft:
                var serviceClient = GraphClient.GetAuthenticatedClient(token);
                return(new GraphContactProvider(serviceClient));

            case ContactSource.Google:
                var googleClient = new GoogleClient(_settings, token);
                return(new GoogleContactProvider(googleClient));

            default:
                throw new Exception($"ContactSource not covered in switch statement: {source.ToString()}");
            }
        }
Esempio n. 5
0
        private void RemoveContactSource(Contact contact)
        {
            if (source_map[contact.Connection.AccountObjectPath].ContainsKey(contact))
            {
                ContactSource source = source_map[contact.Connection.AccountObjectPath][contact];
                if (source.Contact.Connection.Status == ConnectionStatus.Disconnected)
                {
                    source.Contact.ContactServicesChanged -= OnContactServicesChanged;
                }

                // remove and close all channels, in case we don't get closed events
                contact.DispatchManager.RemoveAll(contact);

                source.Dispose();
                container.RemoveChildSource(source);
                source_map[contact.Connection.AccountObjectPath].Remove(contact);
            }
        }
        private void OnCancelBrowseRequest(object o, EventArgs args)
        {
            // FIXME https://bugs.freedesktop.org/show_bug.cgi?id=22337
            ContactSource source = ServiceManager.SourceManager.ActiveSource as ContactSource;

            if (source != null)
            {
                Contact      contact  = source.Contact;
                DBusActivity activity = contact.DispatchManager.Get <DBusActivity> (contact, MetadataProviderService.BusName);

                if (activity != null)
                {
                    if (activity.State == ActivityState.RemotePending)
                    {
                        activity.Close();
                    }
                }
            }
        }
        private Contact GetOrAddContact(ContactSource source, Context context, ContactInfo contactInfo)
        {
            var contact =
                DbContext.Contacts.SingleOrDefault(
                    x =>
                    x.ContextId == context.Id && x.SourceId == source.Id && x.ExternalId == contactInfo.ExternalId &&
                    x.ContactData == contactInfo.Email,
                    DebugInfoCollector,
                    "Get contact");

            if (contact.IsNull())
            {
                contact = new Contact {
                    ContextId   = context.Id,
                    SourceId    = source.Id,
                    ExternalId  = contactInfo.ExternalId,
                    ContactData = contactInfo.Email
                };
                DbContext.Contacts.Add(contact);
            }
            return(contact);
        }
Esempio n. 8
0
 public void setSource(ContactSource source)
 {
     this.source = source;
 }
 internal static CfContactSource FromContactSource(ContactSource source)
 {
     return(source == null ? null : new CfContactSource(source.Items));
 }
Esempio n. 10
0
 public IContactProvider GetContactProvider(string token, ContactSource source)
 {
     return(contactProvider);
 }