Ignore:
Timestamp:
2010-08-08T13:42:57Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2528cda, f32c14c
Parents:
203a2d2
Message:

Add a few more commands (including RT) and the ability to send replies.
That's it for now, this is already not very pretty, but just offers the bare
basic functionality.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter_lib.c

    r203a2d2 rb890626  
    784784 * Function to POST a new status to twitter.
    785785 */
    786 void twitter_post_status(struct im_connection *ic, char* msg)
    787 {
    788         char* args[2];
    789         args[0] = "status";
    790         args[1] = msg;
    791         twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, args, 2);
    792 //      g_free(args[1]);
     786void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to)
     787{
     788        char* args[4] = {
     789                "status", msg,
     790                "in_reply_to_status_id",
     791                g_strdup_printf("%llu", (unsigned long long) in_reply_to)
     792        };
     793        twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1,
     794                     args, in_reply_to ? 4 : 2);
     795        g_free(args[3]);
    793796}
    794797
     
    825828        g_free(url);
    826829}
     830
     831void twitter_status_retweet(struct im_connection *ic, guint64 id)
     832{
     833        char *url;
     834        url = g_strdup_printf("%s%llu%s", TWITTER_STATUS_RETWEET_URL, (unsigned long long) id, ".xml");
     835        twitter_http(ic, url, twitter_http_post, ic, 1, NULL, 0);
     836        g_free(url);
     837}
Note: See TracChangeset for help on using the changeset viewer.