Gnome内 Twitterクライアント・ソース・ハック

C言語

開発プラットフォーム GTK+2

通信 Soup(返信は非同期のコールバックか)

送信 http、基本はGET、特殊でPOST

返信通信プロトコル xml (Twitterはxml,json,rss,atom選択可能らしい)

認証方法はBASIC認証、OAuthは未対応

GnomeにはKeyringというものがあり、

 そこにサーバーとパスワードを結び付けている仕組みがあるようだ。

twitux_keyring_get_password()によって、保存さているパスワードを取得する。

2か所で使っている。一つは設定用ダイアログともう一つは通信用。

twitux_account_dialog_show()



app_login()

    request_username_password()

TwituxAppが肝

TwituxAppPriv username,password

 

twitux_network_login() ログイン

app_retrieve_default_timeline() ディフォルトのタイムラインを取得

*ログイン処理と認証*

        /* HTTP Basic Authentication */

g_signal_connect (soup_connection,

"authenticate",

G_CALLBACK (network_cb_on_auth),

NULL);



/* Verify cedentials */

network_get_data (TWITUX_API_LOGIN, network_cb_on_login, NULL);



network_get_data()がTwitterのAPIラッパーらしい。(GET method)

BASIC認証

    "https://twitter.com/account/verify_credentials.xml"

 *タイムライン*

twitux_network_get_timeline()  タイムラインのコア部

友達のタイムライン取得

    "https://twitter.com/statuses/friends_timeline.xml"

network_cb_on_timeline() タイムライン受信部コールバック関数

twitux_parser_users_list()によってTwitterの返答をパーサーしている。



*メッセージをポスト*

"https://twitter.com/statuses/update.xml"

 
void twitux_network_post_status (const gchar *text)

*フォロー追加と削除*

"https://twitter.com/friendships/create/%s.xml"

"https://twitter.com/friendships/destroy/%s.xml"

    





コメント

このブログの人気の投稿

日本でコンピュータサイエンスを学ぶ難しさ

How to preview nif file on the ubuntu.