diff options
author | toshi <toshi@03aab468-d3d2-4883-8b12-f661bbf03fa8> | 2012-09-14 17:04:45 +0000 |
---|---|---|
committer | toshi <toshi@03aab468-d3d2-4883-8b12-f661bbf03fa8> | 2012-09-14 17:04:45 +0000 |
commit | d105a7e6a190a89b13bec0c988bedb31578b4bfe (patch) | |
tree | 4b923faf8ca0c60b77437088e94064bd679be543 /core | |
parent | bea521b1378d0c9ccaaa59f15684bc670474af40 (diff) | |
download | mikutter-d105a7e6a190a89b13bec0c988bedb31578b4bfe.tar.gz |
プロフィールのユーザタイムラインがリアルタイムに更新されるようにした
git-svn-id: svn://toshia.dip.jp/mikutter/trunk@960 03aab468-d3d2-4883-8b12-f661bbf03fa8
Diffstat (limited to 'core')
-rw-r--r-- | core/plugin/gtk/gtk.rb | 3 | ||||
-rw-r--r-- | core/plugin/profile/profile.rb | 12 | ||||
-rw-r--r-- | core/plugin/streaming/filter.rb | 8 |
3 files changed, 18 insertions, 5 deletions
diff --git a/core/plugin/gtk/gtk.rb b/core/plugin/gtk/gtk.rb index ad49240c..1af5c617 100644 --- a/core/plugin/gtk/gtk.rb +++ b/core/plugin/gtk/gtk.rb @@ -324,7 +324,8 @@ Plugin.create :gtk do pane = widgetof(i_pane) tab = widgetof(i_tab) if pane and tab - pane.page = pane.get_tab_pos_by_tab(tab) end end end + pagenum = pane.get_tab_pos_by_tab(tab) + pane.page = pagenum if pagenum end end end filter_gui_postbox_input_editable do |i_postbox, editable| postbox = widgetof(i_postbox) diff --git a/core/plugin/profile/profile.rb b/core/plugin/profile/profile.rb index 8fb232b9..59b78657 100644 --- a/core/plugin/profile/profile.rb +++ b/core/plugin/profile/profile.rb @@ -4,7 +4,7 @@ Plugin.create :profile do UserConfig[:profile_show_tweet_once] ||= 20 @counter = gen_counter plugin = self - timeline_storage = {} # {slug: {timeline, user}} + timeline_storage = {} # {slug: user} Message::Entity.addlinkrule(:user_mentions, /(?:@|@|〄|☯|⑨|♨|(?:\W|^)D )[a-zA-Z0-9_]+/){ |segment| idname = segment[:url].match(/^(?:@|@|〄|☯|⑨|♨|(?:\W|^)D )?(.+)$/)[1] @@ -29,6 +29,7 @@ Plugin.create :profile do profile nil end Plugin.call(:profiletab, i_profile, user) i_profile.active! + Plugin.call(:filter_stream_reconnect_request) end profiletab :usertimeline, "最近のツイート" do @@ -37,7 +38,7 @@ Plugin.create :profile do Service.primary.user_timeline(user_id: user[:id], include_rts: 1, count: [UserConfig[:profile_show_tweet_once], 200].min).next{ |tl| i_timeline << tl }.terminate("@#{user[:idname]} の最近のつぶやきが取得できませんでした。見るなってことですかね") - timeline_storage[i_timeline.slug] = {timeline: i_timeline, user: user}.freeze end + timeline_storage[i_timeline.slug] = user end profiletab :aboutuser, "ユーザについて" do set_icon user[:profile_image_url] @@ -51,9 +52,12 @@ Plugin.create :profile do nativewidget container.show_all end on_appear do |messages| - timeline_storage.dup.deach{ |tl| + timeline_storage.dup.deach{ |slug, user| messages.each{ |message| - tl.timeline << message if message.user == tl.user } } end + timeline(slug) << message if message.user == user } } end + + filter_filter_stream_follow do |users| + [users.merge(timeline_storage.values)] end on_gui_destroy do |widget| if widget.is_a? Plugin::GUI::Timeline diff --git a/core/plugin/streaming/filter.rb b/core/plugin/streaming/filter.rb index da414e2c..3ff7945f 100644 --- a/core/plugin/streaming/filter.rb +++ b/core/plugin/streaming/filter.rb @@ -5,6 +5,7 @@ require 'set' Plugin.create :streaming do thread = nil @fail_count = @wait_time = 0 + reconnect_request_flag = false Delayer.new { thread = start if UserConfig[:filter_realtime_rewind] @@ -22,6 +23,13 @@ Plugin.create :streaming do thread.kill rescue nil if thread thread = start end end + on_filter_stream_reconnect_request do + if not reconnect_request_flag + reconnect_request_flag = true + Reserver.new(30) { + reconnect_request_flag = false + Plugin.call(:filter_stream_force_retry) } end end + def start service = Service.primary @success_flag = false |