public string GetCapabilities()
        {
            var capabilities = new OSCSchema.capabilities {
                // OSC 1.0 capabilities
                getFriends        = true,
                cacheFriends      = false,
                followPerson      = false,
                doNotFollowPerson = false,
                getActivities     = true,
                cacheActivities   = false,

                // OSC 1.1 capabilities
                dynamicActivitiesLookupEx          = false,
                dynamicActivitiesLookupExSpecified = true,
                hideHyperlinks                  = false,
                hideHyperlinksSpecified         = true,
                supportsAutoConfigure           = false,
                supportsAutoConfigureSpecified  = true,
                dynamicContactsLookup           = true,
                dynamicContactsLookupSpecified  = true,
                useLogonCached                  = true,
                useLogonCachedSpecified         = true,
                hideRememberMyPassword          = false,
                hideRememberMyPasswordSpecified = true,
                hashFunction = "MD5"
            };

            var result = HelperMethods.SerializeObjectToString(capabilities);

            Debug.WriteLine(result);
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Gravatar does not support activities, so we return an empty structure
        /// </summary>
        public string GetActivitiesEx(string[] hashedAddresses, DateTime startTime)
        {
            Debug.WriteLine("ISocialSession2::GetActivitiesEx called for:");
            foreach (var address in hashedAddresses)
            {
                Debug.WriteLine("\t" + address);
            }

            var feed = new OSCSchema.activityFeedType {
                network = GetNetworkIdentifier()
            };

            return(HelperMethods.SerializeObjectToString(feed));
        }
Esempio n. 3
0
        /// <summary>
        /// Should return information about the addresses
        /// </summary>
        /// <param name="hashedAddresses"></param>
        /// <returns></returns>
        public string GetPeopleDetails(string hashedAddresses)
        {
            var addresses = HelperMethods.DeserializeStringToObject <OSCSchema2.hashedAddresses>(hashedAddresses);

            Debug.WriteLine("ISocialSession2::GetPeopleDetails called for personsAddresses");
            foreach (var line in addresses.personAddresses)
            {
                Debug.WriteLine("\t" + line.index + ": " + String.Join(", ", line.hashedAddress));
            }

            var resultList = new List <OSCSchema.personType>();

            foreach (var personAddress in addresses.personAddresses)
            {
                if (personAddress.hashedAddress.Length == 0)
                {
                    continue;
                }
                try {
                    // find gravatar for hashed addresses
                    var response = _gravatarService.Exists(personAddress.hashedAddress, true);
                    if (response.IsError)
                    {
                        Debug.WriteLine("Encountered error when calling gravatar: " + response.ErrorCode);
                        continue;
                    }
                    var index = HelperMethods.GetTrueIndex(response.MultipleOperationResponse);

                    // no gravatar found
                    if (index == -1)
                    {
                        continue;
                    }

                    // get gravatar profile
                    var profile = GravatarService.GetGravatarProfile(personAddress.hashedAddress[index], true);
                    if (profile == null)
                    {
                        resultList.Add(new OSCSchema.personType {
                            userID     = personAddress.hashedAddress[index],
                            pictureUrl = GravatarService.GetGravatarUrlForAddress(personAddress.hashedAddress[index], true),

                            index          = personAddress.index,
                            indexSpecified = true
                        });
                    }
                    else
                    {
                        resultList.Add(new OSCSchema.personType {
                            userID     = personAddress.hashedAddress[index],
                            pictureUrl = profile.ThumbnailUrl,
                            city       = profile.CurrentLocation,
                            firstName  = profile.GivenName,
                            lastName   = profile.FamilyName,
                            nickname   = profile.PreferredUsername,

                            index          = personAddress.index,
                            indexSpecified = true
                        });
                    }
                } catch (Exception e) {
                    Debug.WriteLine(e.ToString());
                }
            }


            var friends = new OSCSchema.friends {
                person = resultList.ToArray()
            };

            var result = HelperMethods.SerializeObjectToString(friends);

            Debug.WriteLine(result);
            return(result);
        }