Esempio n. 1
0
        /// <summary>
        /// メンバーがリストに存在するか
        /// </summary>
        internal Boolean IsExist(AutoListsMatchPatternConfiguration item, Status status)
        {
            try
            {
                String url = String.Format("/{0}/{1}/members/{2}.xml", CurrentSession.TwitterUser.ScreenName, item.Slug, status.User.Id);
                String body = CurrentSession.TwitterService.GET(url, false);
                return true;
            }
            catch (WebException ex)
            {
                // 取ってこれなかったらメンバに存在しない
                if ((ex.Response as HttpWebResponse).StatusCode == HttpStatusCode.NotFound)
                    return false;

                throw;
            }
        }
Esempio n. 2
0
 public bool IsMatch(Status status)
 {
     return Enabled && Regex.IsMatch(status.Text, MatchPattern);
 }
Esempio n. 3
0
 /// <summary>
 /// リストにメンバーを追加する
 /// </summary>
 internal void AddMember(AutoListsMatchPatternConfiguration item, Status status)
 {
     String url = String.Format("/{0}/{1}/members.xml?id={2}", CurrentSession.TwitterUser.ScreenName, item.Slug, status.User.Id);
     String body = CurrentSession.TwitterService.POST(url, new byte[] { });
     SendMessage(String.Format("リスト {0} に {1} を追加しました。", item.Slug, status.User.ScreenName));
 }
Esempio n. 4
0
        /// <summary>
        /// ステータスを送信します。
        /// </summary>
        private void Send(Status status, Boolean isFirstTime)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(AddIn.ApplyTypableMap(status.Text, status));

            String content = AddIn.ApplyDateTime(sb.ToString(), status.CreatedAt, isFirstTime);
            SendMessage(status.User.ScreenName, content, isFirstTime);

            if (Duplicate)
            {
                Boolean friendsCheckRequired = false;
                AddIn.CurrentSession.ProcessTimelineStatus(status, ref friendsCheckRequired);
            }

            AddIn.SleepClientMessageWait();
        }
        private void OnTweet(Status status)
        {
            if (Config.IsThroughMyPostFromUserStream && status.Id == CurrentSession.TwitterUser.Id)
                return;

            Boolean friendCheckRequired = false;
            CurrentSession.TwitterService.ProcessStatus(status,
                    (s) => CurrentSession.ProcessTimelineStatus(s, ref friendCheckRequired, false, false));
        }
        void xmppConnection_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
            //Trace.WriteLine(msg.ToString());
            if (msg.From.Bare != ServiceSender)
                return;

            Element entryE = msg.SelectSingleElement("entry");
            Element sourceE = entryE.SelectSingleElement("source");
            Element authorE = sourceE.SelectSingleElement("author");

            User user = new User
            {
                Description = authorE.GetTag("description"),
                Id = authorE.GetTagInt("twitter_id"),
                Location = authorE.GetTag("location"),
                Protected = authorE.GetTagBool("protected"),
                Name = authorE.GetTag("name"),
                ScreenName = authorE.GetTag("screen_name"),
                Url = authorE.GetTag("url"),
                ProfileImageUrl = authorE.GetTag("profile_image_url")
            };

            String body = msg.Body;
            if (body.IndexOf(": ") > -1)
                body = body.Substring(body.IndexOf(": ") + 2);

            Status status = new Status
            {
                CreatedAt = DateTime.Parse(entryE.GetTag("published")),
                Text = body,
                User = user,
                Id = entryE.GetTagInt((entryE.GetTagInt("twitter_id") == 0 ? "status_id" : "twitter_id")) // HACK: 何故かどっちかでくる
            };

            OnStatusUpdateReceived(status);
        }
 public StatusUpdateReceivedEventArgs(Status status)
 {
     this.Status = status;
 }
Esempio n. 8
0
        /// <summary>
        /// ステータスを送信します。
        /// </summary>
        private void Send(Status status, Boolean isFirstTime)
        {
            var text = AddIn.ApplyTypableMap(status.Text, status);
            text = AddIn.ApplyDateTime(text, status.CreatedAt, isFirstTime);
            SendMessage(status.User.ScreenName, text, isFirstTime);

            if (Duplicate)
            {
                Boolean friendsCheckRequired = false;
                AddIn.CurrentSession.ProcessTimelineStatus(status, ref friendsCheckRequired);
            }

            AddIn.SleepClientMessageWait();
        }
 private void OnStatusUpdateReceived(Status status)
 {
     if (StatusUpdateReceived != null)
         StatusUpdateReceived(this, new StatusUpdateReceivedEventArgs(status));
 }
Esempio n. 10
0
 public TimelineStatusGroupEventArgs(Status status, String text, String ircMessageType, Group group)
     : base(status, text, ircMessageType)
 {
     Group = group;
 }
Esempio n. 11
0
 public TimelineStatusRoutedEventArgs(Status status, String text, List<RoutedGroup> routedGroups)
 {
     Status = status;
     Text = text;
     RoutedGroups = routedGroups;
 }
Esempio n. 12
0
 public TimelineStatusEventArgs(Status status, String text, String ircMessageType)
 {
     Status = status;
     Text = text;
     IRCMessageType = ircMessageType;
 }
Esempio n. 13
0
 public TimelineStatusEventArgs(Status status)
     : this(status, status.Text, "")
 {
 }
Esempio n. 14
0
        /// <summary>
        /// TypableMapの情報を付与
        /// </summary>
        private String ApplyTypableMap(String str, Status status)
        {
            if (Config.EnableTypableMap)
            {
                var typableMapCommands = CurrentSession.AddInManager.GetAddIn<TypableMapSupport>().TypableMapCommands;
                if (typableMapCommands != null)
                {
                    String typableMapId = typableMapCommands.TypableMap.Add(status);

                    // TypableMapKeyColorNumber = -1 の場合には色がつかなくなる
                    if (CurrentSession.Config.TypableMapKeyColorNumber < 0)
                        return str + String.Format(" ({0})", typableMapId);
                    else
                        return str + String.Format(" \x03{0}({1})\x03", CurrentSession.Config.TypableMapKeyColorNumber, typableMapId);
                }
            }

            return str;
        }
Esempio n. 15
0
        public Status ToStatus()
        {
            var status = new Status()
            {
                Id = Int64.Parse(this.Id),
                CreatedAt = this.CreatedAt,
                Text = this.Text,
                Source = this.Source,
                Truncated = this.Truncated,
                Favorited = this.Favorited.ToString(),
                InReplyToStatusId = this.InReplyToStatusId,
                InReplyToUserId = this.InReplyToUserId,
                RetweetedStatus = null,
            };

            var retweetedStatus = this.RetweetedStatus as GroongaLoggerStatus;
            if (retweetedStatus != null && !String.IsNullOrEmpty(retweetedStatus.Id))
                status.RetweetedStatus = retweetedStatus.ToStatus();

            var user = this.User as GroongaLoggerUser;
            if (user != null && !String.IsNullOrEmpty(user.Id))
                status.User = user.ToUser();

            return status;
        }
Esempio n. 16
0
 public static GroongaLoggerStatus FromStatus(Status status)
 {
     return new GroongaLoggerStatus()
     {
         Id = status.Id.ToString(),
         CreatedAt = status.CreatedAt,
         Text = GroongaLoggerUtility.ValueOrDefault(status.Text, String.Empty),
         Source = GroongaLoggerUtility.ValueOrDefault(status.Source, String.Empty),
         Truncated = status.Truncated,
         Favorited = GroongaLoggerUtility.ValueOrDefault(status.Favorited, fav => Boolean.Parse(fav), false),
         InReplyToStatusId = GroongaLoggerUtility.ValueOrDefault(status.InReplyToStatusId, String.Empty),
         InReplyToUserId = GroongaLoggerUtility.ValueOrDefault(status.InReplyToUserId, String.Empty),
         RetweetedStatus = GroongaLoggerUtility.ValueOrDefault(status.RetweetedStatus, s => s.Id.ToString(), String.Empty),
         User = GroongaLoggerUtility.ValueOrDefault(status.User, u => u.Id.ToString(), String.Empty),
     };
 }