Example #1
0
        public void SendPresence()
        {
            var status = new LeagueStatus(StatusMessage, Status);

            ShowType computed;

            if (DndStatuses.Contains(Status))
            {
                computed = ShowType.dnd;
            }
            else if (ChatMode == ChatMode.Away)
            {
                computed = ShowType.away;
            }
            else
            {
                computed = ShowType.chat;
            }

            var args = new StatusUpdatedEventArgs(status, ChatMode == ChatMode.Invisible ? PresenceType.invisible : PresenceType.available, computed);

            StatusUpdated?.Invoke(this, args);

            if (!connected)
            {
                return;
            }
            xmpp.Send(new Presence(computed, status.ToXML(), 100)
            {
                Type = args.PresenceType
            });
        }
Example #2
0
    public void UpdatePresence(Presence p) {
      IsOffline = p.Status == null;
      if (!IsOffline) {
        Status = new LeagueStatus(p.Status, p.Show);
        if (Status.GameStatus == ChatStatus.inGame) {
          RiotServices.GameService.RetrieveInProgressSpectatorGameInfo(User.Name).ContinueWith(GotGameDTO);
          if (Cache != null)
            CurrentGameFetcher.FetchGame(Cache.Data.Summoner.SummonerId, GotGameInfo);
        } else {
          CurrentGameDTO = null;
          CurrentGameInfo = null;
        }

        Session.Current.SummonerCache.GetData(User.Name, GotSummoner);
        Session.Current.ChatManager.ForceUpdate();
      }
    }
Example #3
0
        public void UpdatePresence(Presence p)
        {
            IsOffline = p.Status == null;
            if (!IsOffline)
            {
                Status = new LeagueStatus(p.Status, p.Show);
                if (Status.GameStatus == ChatStatus.inGame)
                {
                    RiotServices.GameService.RetrieveInProgressSpectatorGameInfo(User.Name).ContinueWith(GotGameDTO);
                    if (Cache != null)
                    {
                        CurrentGameFetcher.FetchGame(Cache.Data.Summoner.SummonerId, GotGameInfo);
                    }
                }
                else
                {
                    CurrentGameDTO  = null;
                    CurrentGameInfo = null;
                }

                Session.Current.SummonerCache.GetData(User.Name, GotSummoner);
                Session.Current.ChatManager.ForceUpdate();
            }
        }
Example #4
0
 public StatusUpdatedEventArgs(LeagueStatus status, PresenceType presenceType, ShowType show)
 {
     Status       = status;
     PresenceType = presenceType;
     Show         = show;
 }
Example #5
0
 public StatusUpdatedEventArgs(LeagueStatus status, PresenceType presenceType, ShowType show) {
   Status = status;
   PresenceType = presenceType;
   Show = show;
 }
Example #6
0
    public void SendPresence() {
      var status = new LeagueStatus(StatusMessage, Status);

      ShowType computed;
      if (DndStatuses.Contains(Status))
        computed = ShowType.dnd;
      else if (ChatMode == ChatMode.Away)
        computed = ShowType.away;
      else
        computed = ShowType.chat;

      var args = new StatusUpdatedEventArgs(status, ChatMode == ChatMode.Invisible ? PresenceType.invisible : PresenceType.available, computed);
      StatusUpdated?.Invoke(this, args);

      if (!connected) return;
      xmpp.Send(new Presence(computed, status.ToXML(), 100) { Type = args.PresenceType });
    }