Created
December 31, 2011 16:06
-
-
Save osak/1544439 to your computer and use it in GitHub Desktop.
mikutterで新たなR4S体験を
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: twitter_api.rb | |
| =================================================================== | |
| --- twitter_api.rb (revision 623) | |
| +++ twitter_api.rb (working copy) | |
| @@ -569,6 +569,18 @@ | |
| post_with_auth("/friendships/destroy/#{user[:id]}.#{FORMAT}") | |
| end | |
| + def report_spam(user) | |
| + post_with_auth("/report_spam.#{FORMAT}", :user_id => user[:id]) | |
| + end | |
| + | |
| + def block_create(user) | |
| + post_with_auth("/blocks/create.#{FORMAT}", :user_id => user[:id]) | |
| + end | |
| + | |
| + def block_destroy(user) | |
| + post_with_auth("/blocks/destroy.#{FORMAT}", :user_id => user[:id]) | |
| + end | |
| + | |
| # list = { | |
| # :user => User(自分) | |
| # :name => String | |
| Index: addon/profile.rb | |
| =================================================================== | |
| --- addon/profile.rb (revision 623) | |
| +++ addon/profile.rb (working copy) | |
| @@ -84,8 +85,10 @@ | |
| unless(relationbox.destroyed?) | |
| relationbox.closeup(Gtk::Label.new("#{user[:idname]}はあなたをフォローしていま" + | |
| if res[:followed_by] then 'す' else 'せん' end)). | |
| + closeup(Gtk::Label.new(res[:marked_spam] ? "スパム報告済みです" : "")). | |
| closeup(followbutton(res[:user], res[:following])). | |
| - closeup(mutebutton(res[:user])).show_all end } end } end | |
| + closeup(mutebutton(res[:user])). | |
| + closeup(blockbutton(res[:user], res[:blocking])).show_all end } end } end | |
| relationbox end | |
| def profile | |
| @@ -129,6 +132,24 @@ | |
| btn = Mtk::boolean(changer, 'ミュート') | |
| end | |
| + def blockbutton(user, blocking) | |
| + changer = lambda{ |new, widget| | |
| + if new.nil? | |
| + blocking | |
| + elsif new | |
| + spam = Gtk::Dialog.confirm("スパム報告しますか?") | |
| + if spam | |
| + @service.report_spam(user) | |
| + else | |
| + @service.block_create(user) | |
| + end | |
| + else | |
| + @service.block_destroy(user) | |
| + end | |
| + } | |
| + btn = Mtk::boolean(changer, 'ブロック/スパム報告') | |
| + end | |
| + | |
| def add_muted_user(user) | |
| type_strict user => User | |
| atomic{ | |
| Index: post.rb | |
| =================================================================== | |
| --- post.rb (revision 623) | |
| +++ post.rb (working copy) | |
| @@ -252,6 +252,7 @@ | |
| define_postal :update, :retweet, :search_create, :search_destroy, :follow, :unfollow | |
| define_postal :add_list_member, :delete_list_member, :add_list, :delete_list, :update_list | |
| define_postal :send_direct_message, :destroy_direct_message | |
| + define_postal :block_create, :block_destroy, :report_spam | |
| alias post update | |
| define_postal_detail(:destroy){|service, event, msg| | |
| @@ -513,6 +514,8 @@ | |
| msg = msg[:relationship] | |
| Hash[:following, msg[:source][:following], # 自分がフォローしているか | |
| :followed_by, msg[:source][:followed_by], # 相手にフォローされているか | |
| + :blocking, msg[:source][:blocking], # ブロックしているか | |
| + :marked_spam, msg[:source][:marked_spam], # スパム報告しているか | |
| :user, User.new_ifnecessary(:idname => msg[:target][:screen_name], # 相手 | |
| :id => msg[:target][:id])] } } | |
| direct_messages_parser = { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment