TwitKit+ がさらに使いやすくなりました!

  • (当社比)
  • About の影響により返信先がおかしくなる不具合を修正しました
  • 返信タブに日時表示を追加しました
  • ユーザ情報タブの日時表示を修正しました
  • Firefox 4.0 に対応しました
  • クライアント名の表記を TOBASIC! から TwitKit+ (TOBASIC!) に変更しました
    • 既にお使いの方は、一旦サインアウトしてサインインしなおすと、以降のツイートに適用されます
  • サインインの際に、ユーザ名とパスワードをコピー&ペーストする必要がなくなりました
    • OAuth の認可をおこなうだけで、自動的にサインインできるようになりました

    • 「許可する」をクリックして認可画面が閉じた後、ユーザ名が表示され、タイムラインが読み込まれます



  • 以下、技術的な話
  • Snowflake
    • 「ツイートに振られている ID の桁が大きくなって Javascript で数値として扱うとおかしなことが起こるから、文字列として扱って」ということみたいでした
    • 「でも API から JSON で受け取ってると、パースするとき、どうしても数値扱いになってしまうから id っていう要素と同時に id_str も送るよ」
[{
    "id": 28897034941505536,
    "id_str": "28897034941505536",
    "text": "\u3053\u3093\u3069\u3053\u305d\u3067\u304d\u305f\uff01\uff01",
    "source": "\u003Ca href=\"http:\/\/d.hatena.ne.jp\/asannou\/\" rel=\"nofollow\"\u003ETwitKit+TOBASIC!\u003C\/a\u003E",
    "retweeted": false,
    "retweet_count": 0,
    "favorited": false,
    "truncated": false,
    "in_reply_to_status_id": null,
    "in_reply_to_status_id_str": null,
    "in_reply_to_user_id": null,
    "in_reply_to_user_id_str": null,
    "in_reply_to_screen_name": null,
    "place": null,
    "geo": null,
    "user": {
        "id": 6194782,
        "id_str": "6194782",
        "screen_name": "asannou",
        "name": "\u3042\u3055\u3093\u306e\u3046",
        "url": "http:\/\/id.mixi.jp\/asannou",
        "statuses_count": 2134,
        "favourites_count": 9,
        "friends_count": 169,
        "followers_count": 229,
        "listed_count": 32,
        "description": "http:\/\/ido.nu\/ayaya\/miseatter\/statuses\/home_timeline\/asannou.xml",
        "location": "\u6771\u4eac\u90fd",
        "lang": "en",
        "utc_offset": 32400,
        "time_zone": "Tokyo",
        "following": false,
        "protected": false,
        "profile_text_color": "333333",
        "profile_link_color": "0084B4",
        "profile_image_url": "http:\/\/a2.twimg.com\/profile_images\/423966760\/cat2_normal.png",
        "profile_sidebar_fill_color": "DDEEF6",
        "profile_sidebar_border_color": "C0DEED",
        "profile_use_background_image": true,
        "profile_background_color": "C0DEED",
        "profile_background_image_url": "http:\/\/a3.twimg.com\/a\/1295051201\/images\/themes\/theme1\/bg.png",
        "profile_background_tile": false,
        "show_all_inline_media": false,
        "geo_enabled": true,
        "verified": false,
        "is_translator": false,
        "contributors_enabled": false,
        "notifications": false,
        "follow_request_sent": false,
        "created_at": "Mon May 21 09:13:03 +0000 2007"
    },
    "contributors": null,
    "coordinates": null,
    "created_at": "Sat Jan 22 19:29:24 +0000 2011"
}]
      • id_str とか in_reply_to_status_id_str とか in_reply_to_user_id_str とかを見るようにして解決
  • TOBASIC! からのカスタム URI スキーム
    • 先日作った仕組み を使って、コンシューマ "TwitKit+ (TOBASIC!)" を作成
    • callback にカスタム URI スキーム "twitkitplus:" を設定する
    • なんとかして "twitkitplus:" を TwitKit+ からハンドリングできるように XPCOM コンポーネントを実装する
    • 認可させるときに state パラメータを付ける
      • state パラメータは Firefox の Preferences に保存しておく
    • 下のように callback が返ってきたら state を検証し、問題なければ username と password を TwitKit+ が受け取る

twitkitplus:?username=&password=&state=