[1b221e0] | 1 | /***************************************************************************\ |
---|
| 2 | * * |
---|
| 3 | * BitlBee - An IRC to IM gateway * |
---|
| 4 | * Simple module to facilitate twitter functionality. * |
---|
| 5 | * * |
---|
| 6 | * Copyright 2009 Geert Mulders <g.c.w.m.mulders@gmail.com> * |
---|
| 7 | * * |
---|
| 8 | * This library is free software; you can redistribute it and/or * |
---|
| 9 | * modify it under the terms of the GNU Lesser General Public * |
---|
| 10 | * License as published by the Free Software Foundation, version * |
---|
| 11 | * 2.1. * |
---|
| 12 | * * |
---|
| 13 | * This library is distributed in the hope that it will be useful, * |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
---|
| 16 | * Lesser General Public License for more details. * |
---|
| 17 | * * |
---|
| 18 | * You should have received a copy of the GNU Lesser General Public License * |
---|
| 19 | * along with this library; if not, write to the Free Software Foundation, * |
---|
| 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * |
---|
| 21 | * * |
---|
| 22 | ****************************************************************************/ |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | #ifndef _TWITTER_LIB_H |
---|
| 26 | #define _TWITTER_LIB_H |
---|
| 27 | |
---|
| 28 | #include "nogaim.h" |
---|
| 29 | #include "twitter_http.h" |
---|
| 30 | |
---|
[be9f3f1] | 31 | #define TWITTER_API_URL "https://api.twitter.com/1.1" |
---|
[1b221e0] | 32 | |
---|
| 33 | /* Status URLs */ |
---|
[3b4a22a] | 34 | #define TWITTER_STATUS_UPDATE_URL "/statuses/update.json" |
---|
[bb5ce4d1] | 35 | #define TWITTER_STATUS_SHOW_URL "/statuses/show/" |
---|
| 36 | #define TWITTER_STATUS_DESTROY_URL "/statuses/destroy/" |
---|
[b890626] | 37 | #define TWITTER_STATUS_RETWEET_URL "/statuses/retweet/" |
---|
[1b221e0] | 38 | |
---|
| 39 | /* Timeline URLs */ |
---|
[3b4a22a] | 40 | #define TWITTER_PUBLIC_TIMELINE_URL "/statuses/public_timeline.json" |
---|
| 41 | #define TWITTER_FEATURED_USERS_URL "/statuses/featured.json" |
---|
| 42 | #define TWITTER_FRIENDS_TIMELINE_URL "/statuses/friends_timeline.json" |
---|
| 43 | #define TWITTER_HOME_TIMELINE_URL "/statuses/home_timeline.json" |
---|
[fb351ce] | 44 | #define TWITTER_MENTIONS_URL "/statuses/mentions_timeline.json" |
---|
[3b4a22a] | 45 | #define TWITTER_USER_TIMELINE_URL "/statuses/user_timeline.json" |
---|
[1b221e0] | 46 | |
---|
| 47 | /* Users URLs */ |
---|
[3b4a22a] | 48 | #define TWITTER_USERS_LOOKUP_URL "/users/lookup.json" |
---|
[1b221e0] | 49 | |
---|
| 50 | /* Direct messages URLs */ |
---|
[3b4a22a] | 51 | #define TWITTER_DIRECT_MESSAGES_URL "/direct_messages.json" |
---|
| 52 | #define TWITTER_DIRECT_MESSAGES_NEW_URL "/direct_messages/new.json" |
---|
| 53 | #define TWITTER_DIRECT_MESSAGES_SENT_URL "/direct_messages/sent.json" |
---|
[bb5ce4d1] | 54 | #define TWITTER_DIRECT_MESSAGES_DESTROY_URL "/direct_messages/destroy/" |
---|
[1b221e0] | 55 | |
---|
| 56 | /* Friendships URLs */ |
---|
[3b4a22a] | 57 | #define TWITTER_FRIENDSHIPS_CREATE_URL "/friendships/create.json" |
---|
| 58 | #define TWITTER_FRIENDSHIPS_DESTROY_URL "/friendships/destroy.json" |
---|
| 59 | #define TWITTER_FRIENDSHIPS_SHOW_URL "/friendships/show.json" |
---|
[1b221e0] | 60 | |
---|
| 61 | /* Social graphs URLs */ |
---|
[3b4a22a] | 62 | #define TWITTER_FRIENDS_IDS_URL "/friends/ids.json" |
---|
| 63 | #define TWITTER_FOLLOWERS_IDS_URL "/followers/ids.json" |
---|
[fb62f132] | 64 | #define TWITTER_MUTES_IDS_URL "/mutes/users/ids.json" |
---|
| 65 | #define TWITTER_NORETWEETS_IDS_URL "/friendships/no_retweets/ids.json" |
---|
[1b221e0] | 66 | |
---|
| 67 | /* Account URLs */ |
---|
[3b4a22a] | 68 | #define TWITTER_ACCOUNT_RATE_LIMIT_URL "/account/rate_limit_status.json" |
---|
[1b221e0] | 69 | |
---|
| 70 | /* Favorites URLs */ |
---|
[3b4a22a] | 71 | #define TWITTER_FAVORITES_GET_URL "/favorites.json" |
---|
[75bda8b] | 72 | #define TWITTER_FAVORITE_CREATE_URL "/favorites/create.json" |
---|
| 73 | #define TWITTER_FAVORITE_DESTROY_URL "/favorites/destroy.json" |
---|
[1b221e0] | 74 | |
---|
| 75 | /* Block URLs */ |
---|
[bb5ce4d1] | 76 | #define TWITTER_BLOCKS_CREATE_URL "/blocks/create/" |
---|
| 77 | #define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/" |
---|
[1b221e0] | 78 | |
---|
[9cf63ac] | 79 | /* Mute URLs */ |
---|
| 80 | #define TWITTER_MUTES_CREATE_URL "/mutes/users/create.json" |
---|
| 81 | #define TWITTER_MUTES_DESTROY_URL "/mutes/users/destroy.json" |
---|
| 82 | |
---|
[d18dee42] | 83 | /* Report spam */ |
---|
[7d5afa6] | 84 | #define TWITTER_REPORT_SPAM_URL "/users/report_spam.json" |
---|
[d18dee42] | 85 | |
---|
[73ee390] | 86 | /* Stream URLs */ |
---|
[dff0e0b] | 87 | #define TWITTER_USER_STREAM_URL "https://userstream.twitter.com/1.1/user.json" |
---|
[73ee390] | 88 | #define TWITTER_FILTER_STREAM_URL "https://stream.twitter.com/1.1/statuses/filter.json" |
---|
[dff0e0b] | 89 | |
---|
| 90 | gboolean twitter_open_stream(struct im_connection *ic); |
---|
[73ee390] | 91 | gboolean twitter_open_filter_stream(struct im_connection *ic); |
---|
[2f9027c] | 92 | gboolean twitter_get_timeline(struct im_connection *ic, gint64 next_cursor); |
---|
[8203da9] | 93 | void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor); |
---|
[fb62f132] | 94 | void twitter_get_mutes_ids(struct im_connection *ic, gint64 next_cursor); |
---|
| 95 | void twitter_get_noretweets_ids(struct im_connection *ic, gint64 next_cursor); |
---|
[8203da9] | 96 | void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor); |
---|
[1b221e0] | 97 | |
---|
[b8b931d] | 98 | void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to, gboolean auto_populate_reply_metadata); |
---|
[62d2cfb] | 99 | void twitter_direct_messages_new(struct im_connection *ic, char *who, char *message); |
---|
[7d53efb] | 100 | void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create); |
---|
[9cf63ac] | 101 | void twitter_mute_create_destroy(struct im_connection *ic, char *who, int create); |
---|
[7b87539] | 102 | void twitter_status_destroy(struct im_connection *ic, guint64 id); |
---|
[b890626] | 103 | void twitter_status_retweet(struct im_connection *ic, guint64 id); |
---|
[d18dee42] | 104 | void twitter_report_spam(struct im_connection *ic, char *screen_name); |
---|
[b61c74c] | 105 | void twitter_favourite_tweet(struct im_connection *ic, guint64 id); |
---|
[1201fcb] | 106 | void twitter_status_show_url(struct im_connection *ic, guint64 id); |
---|
[1b221e0] | 107 | |
---|
| 108 | #endif //_TWITTER_LIB_H |
---|
| 109 | |
---|