Exemplo n.º 1
0
        public void Login(LoginOptions options)
        {
            string username = options.DisplayName.Trim();

            this.chatEndPoint = new SquiggleEndPoint(CurrentUser.Id, options.ChatEndPoint);
            StartChatService();

            // Some of the users may have gone offline. Lets try to re-discover all the buddies.
            foreach (Buddy buddy in buddies)
            {
                buddy.Status = UserStatus.Offline;
            }

            var presenceOptions = new PresenceServiceOptions()
            {
                ChatEndPoint             = chatEndPoint,
                MulticastEndPoint        = options.MulticastEndPoint,
                MulticastReceiveEndPoint = options.MulticastReceiveEndPoint,
                PresenceServiceEndPoint  = options.PresenceServiceEndPoint,
                KeepAliveTime            = options.KeepAliveTime
            };

            StartPresenceService(username, options.UserProperties, presenceOptions);

            var self = (SelfBuddy)CurrentUser;

            self.Update(UserStatus.Online, options.DisplayName, chatEndPoint.Address, options.UserProperties.ToDictionary());
            self.EnableUpdates = true;
            LogStatus(CurrentUser);

            IsLoggedIn = true;
        }
Exemplo n.º 2
0
 void StartPresenceService(string username, IBuddyProperties properties, PresenceServiceOptions presenceOptions)
 {
     presenceService              = new PresenceService(presenceOptions);
     presenceService.UserOffline += presenceService_UserOffline;
     presenceService.UserOnline  += presenceService_UserOnline;
     presenceService.UserUpdated += presenceService_UserUpdated;
     presenceService.Login(username, properties);
 }