Beispiel #1
0
        private static void JoinHandler(TwitchChannel channel, IrcRawMessageEventArgs args)
        {
            string userNickname = args.Message.Source.Name;

            lock ((channel.Chat as TwitchChat).chatUsersLock)
            {
                if (!(channel.Chat as IChatUserList).ChatUsers.ToList().Any(u => u.NickName.Equals(userNickname)))
                {
                    ObservableCollection <UserBadge> badges;
                    string userGroup = "Users";
                    channel.userBadges.TryGetValue(userNickname, out badges);
                    channel.AddChatUser(userNickname, userGroup, badges);
                }
            }
            Log.WriteInfo("Twitch user joined: {0}", userNickname);
            if (userNickname.Equals(channel.Chat.NickName, StringComparison.InvariantCultureIgnoreCase))
            {
                if (!channel.Chat.IsAnonymous)
                {
                    channel.Chat.Status.IsLoggedIn = true;
                }

                channel.pingTimer.Change(pingInterval, pingInterval);

                if (channel.JoinCallback != null)
                {
                    channel.JoinCallback(channel);
                }
            }
        }
Beispiel #2
0
        private static void ConnectHandler(TwitchChannel channel, IrcRawMessageEventArgs args)
        {
            if (channel.ircClient.Channels.Count <= 0)
            {
                channel.Chat.Status.IsConnected  = true;
                channel.Chat.Status.IsConnecting = false;
                channel.TryIrc(() => channel.ircClient.Channels.Join(channel.ChannelName));
                channel.TryIrc(() => channel.ircClient.SendRawMessage("TWITCHCLIENT 1"));

                if ((Application.Current as App).AppConfig.IsUserListVisible)
                {
                    Task.Run(() => channel.LoadInitialUserList());
                }
            }

            if (channel.Chat.IsAnonymous)
            {
                channel.pingTimer.Change(pingInterval, pingInterval);

                if (channel.JoinCallback != null)
                {
                    channel.JoinCallback(channel);
                }
            }
        }