Esempio n. 1
0
        void OnStatusCreated(TwitterStatus status)
        {
            Trace.Call(status);

            try {
                if (MessageRateLimiter.IsRateLimited)
                {
                    return;
                }

                // filter native and old-school retweets
                if (status.RetweetedStatus != null || status.Text.StartsWith("RT @"))
                {
                    return;
                }

                MessageRateLimiter++;

                var sender = ProtocolManager.GetPerson(status.User);
                var userId = status.User.Id.ToString();
                lock (Chat.UnsafePersons) {
                    if (!Chat.UnsafePersons.ContainsKey(userId))
                    {
                        Session.AddPersonToGroupChat(Chat, sender);
                    }
                }
                var msg = CreateMessageBuilder().
                          Append(status, sender).
                          ToMessage();
                Session.AddMessageToChat(Chat, msg);
            } catch (Exception ex) {
#if LOG4NET
                Logger.Error("OnStatusCreated()", ex);
#endif
            }
        }