Exemplo n.º 1
0
        private string GetDomainTagFromNetworkInfo(NetworkInfoType[] infoList, int domainId)
        {
            if (infoList == null)
                return string.Empty;

            foreach (NetworkInfoType info in infoList)
            {
                if (info.DomainId != 0 && !string.IsNullOrEmpty(info.DomainTag))
                {
                    if (info.DomainId == domainId)
                        return info.DomainTag;
                }
            }

            return string.Empty;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a contact's RelationshipState property by providing DomainId and RelationshipType
        /// </summary>
        /// <param name="infoList"></param>
        /// <param name="domainId"></param>
        /// <param name="relationshipType"></param>
        /// <returns></returns>
        private int GetContactRelationshipStateFromNetworkInfo(NetworkInfoType[] infoList, int domainId, int relationshipType)
        {
            if (infoList == null)
                return 0;

            foreach (NetworkInfoType info in infoList)
            {
                if (info.RelationshipType != 0 && info.DomainId != 0 && info.RelationshipState != 0)
                {
                    if (info.DomainId == domainId && info.RelationshipType == relationshipType)
                    {
                        return info.RelationshipState;
                    }
                }
            }

            return 0;
        }
Exemplo n.º 3
0
        private string GetContactDisplayNameFromNetworkInfo(NetworkInfoType[] infoList, int domainId, int relationshipType)
        {
            if (infoList == null)
                return string.Empty;

            foreach (NetworkInfoType info in infoList)
            {
                if (info.RelationshipType != 0 && info.DomainId != 0 && !string.IsNullOrEmpty(info.DisplayName))
                {
                    if (info.DomainId == domainId && info.RelationshipType == relationshipType)
                    {
                        return info.DisplayName;
                    }
                }
            }

            return string.Empty;
        }
Exemplo n.º 4
0
 private RoleId GetCircleMemberRoleFromNetworkInfo(NetworkInfoType[] infoList)
 {
     return (RoleId)GetContactRelationshipRoleFromNetworkInfo(infoList, DomainIds.WindowsLiveDomain, RelationshipTypes.CircleGroup);
 }
Exemplo n.º 5
0
 private string GetCircleMemberDisplayNameFromNetworkInfo(NetworkInfoType[] infoList)
 {
     return GetContactDisplayNameFromNetworkInfo(infoList, DomainIds.WindowsLiveDomain, RelationshipTypes.CircleGroup);
 }
Exemplo n.º 6
0
        private Contact CreateGatewayContact(NetworkInfoType networkInfo)
        {
            if (!String.IsNullOrEmpty(networkInfo.DomainTag) &&
                    networkInfo.DomainTag != WebServiceConstants.NullDomainTag &&
                    networkInfo.SourceId == SourceId.FaceBook &&
                    networkInfo.DomainId == DomainIds.FaceBookDomain)
            {
                // Here we create the gateway from Me contact.
                Contact gatewayContact = NSMessageHandler.ContactList.GetContactWithCreate(RemoteNetworkGateways.FaceBookGatewayAccount, IMAddressInfoType.RemoteNetwork);
                gatewayContact.Lists |= RoleLists.Forward;

                Trace.WriteLineIf(Settings.TraceSwitch.TraceVerbose, "Gateway " + gatewayContact + " added to network contacts", GetType().Name);

                return gatewayContact;
            }

            Trace.WriteLineIf(Settings.TraceSwitch.TraceVerbose,
                "[Warning] Unknown Getway found, please implement this gateway:\r\n" +
                "DomainTag: " + networkInfo.DomainTag + "\r\n" +
                "DomainId: " + networkInfo.DomainId + "\r\n" +
                "SourceId: " + networkInfo.SourceId + "\r\n");

            return null;
        }