Changeset ba3233c for protocols


Ignore:
Timestamp:
2010-05-30T10:16:37Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
3dc6d86, 704dd38
Parents:
3d93aed (diff), 7d53efb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from Geert: Added ability to follow/unfollow Twitter people. (Unfollow
won't work with mode=one.)

Location:
protocols/twitter
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r3d93aed rba3233c  
    286286static void twitter_add_buddy( struct im_connection *ic, char *who, char *group )
    287287{
     288        twitter_friendships_create_destroy(ic, who, 1);
    288289}
    289290
    290291static void twitter_remove_buddy( struct im_connection *ic, char *who, char *group )
    291292{
     293        twitter_friendships_create_destroy(ic, who, 0);
    292294}
    293295
  • protocols/twitter/twitter_lib.c

    r3d93aed rba3233c  
    656656
    657657/**
    658  * Callback after sending a new update to twitter.
    659  */
    660 static void twitter_http_post_status(struct http_request *req)
     658 * Callback to use after sending a post request to twitter.
     659 */
     660static void twitter_http_post(struct http_request *req)
    661661{
    662662        struct im_connection *ic = req->data;
     
    669669        if (req->status_code != 200) {
    670670                // It didn't go well, output the error and return.
    671                 imcb_error(ic, "Could not post message: %s", twitter_parse_error(req));
     671                imcb_error(ic, "HTTP error: %s", twitter_parse_error(req));
    672672                return;
    673673        }
     
    682682        args[0] = "status";
    683683        args[1] = msg;
    684         twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post_status, ic, 1, args, 2);
     684        twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, args, 2);
    685685//      g_free(args[1]);
    686686}
     
    698698        args[3] = msg;
    699699        // Use the same callback as for twitter_post_status, since it does basically the same.
    700         twitter_http(ic, TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post_status, ic, 1, args, 4);
     700        twitter_http(ic, TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post, ic, 1, args, 4);
    701701//      g_free(args[1]);
    702702//      g_free(args[3]);
    703703}
     704
     705void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create)
     706{
     707        char* args[2];
     708        args[0] = "screen_name";
     709        args[1] = who;
     710        twitter_http(ic, create ? TWITTER_FRIENDSHIPS_CREATE_URL : TWITTER_FRIENDSHIPS_DESTROY_URL, twitter_http_post, ic, 1, args, 2);
     711}
  • protocols/twitter/twitter_lib.h

    r3d93aed rba3233c  
    8282void twitter_post_status(struct im_connection *ic, char *msg);
    8383void twitter_direct_messages_new(struct im_connection *ic, char *who, char *message);
     84void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create);
    8485
    8586#endif //_TWITTER_LIB_H
Note: See TracChangeset for help on using the changeset viewer.