source: protocols/twitter/twitter_lib.h @ fe63ed3

Last change on this file since fe63ed3 was 73ee390, checked in by jgeboski <jgeboski@…>, at 2015-01-26T03:46:03Z

twitter: implemented filter based group chats

Filter group chats allow for the ability to read the tweets of select
users without actually following the users, and/or track keywords or
hashtags. A filter group chat can have multiple users, keywords, or
hashtags. These users, keywords, or hashtags can span multiple group
chats. This allows for rather robust filter organization.

The underlying structure for the filters is based on linked list, as
using the glib hash tables requires >= glib-2.16 for sanity. Since the
glib requirement of bitlbee is only 2.14, linked list are used in order
to prevent an overly complex implementation.

The idea for this patch was inspired by Artem Savkov's "Twitter search
channels" patch.

In order to use the filter group chats, a group chat must be added to
the twitter account. The channel room name is either follow:username,
track:keyword, and/or track:#hashtag. Multiple elements can be used by
separating each element by a semicolon.

  • Property mode set to 100644
File size: 4.8 KB
Line 
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
31#define TWITTER_API_URL "https://api.twitter.com/1.1"
32#define IDENTICA_API_URL "https://identi.ca/api"
33
34/* Status URLs */
35#define TWITTER_STATUS_UPDATE_URL "/statuses/update.json"
36#define TWITTER_STATUS_SHOW_URL "/statuses/show/"
37#define TWITTER_STATUS_DESTROY_URL "/statuses/destroy/"
38#define TWITTER_STATUS_RETWEET_URL "/statuses/retweet/"
39
40/* Timeline URLs */
41#define TWITTER_PUBLIC_TIMELINE_URL "/statuses/public_timeline.json"
42#define TWITTER_FEATURED_USERS_URL "/statuses/featured.json"
43#define TWITTER_FRIENDS_TIMELINE_URL "/statuses/friends_timeline.json"
44#define TWITTER_HOME_TIMELINE_URL "/statuses/home_timeline.json"
45#define TWITTER_MENTIONS_URL "/statuses/mentions_timeline.json"
46#define TWITTER_USER_TIMELINE_URL "/statuses/user_timeline.json"
47
48/* Users URLs */
49#define TWITTER_USERS_LOOKUP_URL "/users/lookup.json"
50
51/* Direct messages URLs */
52#define TWITTER_DIRECT_MESSAGES_URL "/direct_messages.json"
53#define TWITTER_DIRECT_MESSAGES_NEW_URL "/direct_messages/new.json"
54#define TWITTER_DIRECT_MESSAGES_SENT_URL "/direct_messages/sent.json"
55#define TWITTER_DIRECT_MESSAGES_DESTROY_URL "/direct_messages/destroy/"
56
57/* Friendships URLs */
58#define TWITTER_FRIENDSHIPS_CREATE_URL "/friendships/create.json"
59#define TWITTER_FRIENDSHIPS_DESTROY_URL "/friendships/destroy.json"
60#define TWITTER_FRIENDSHIPS_SHOW_URL "/friendships/show.json"
61
62/* Social graphs URLs */
63#define TWITTER_FRIENDS_IDS_URL "/friends/ids.json"
64#define TWITTER_FOLLOWERS_IDS_URL "/followers/ids.json"
65
66/* Account URLs */
67#define TWITTER_ACCOUNT_RATE_LIMIT_URL "/account/rate_limit_status.json"
68
69/* Favorites URLs */
70#define TWITTER_FAVORITES_GET_URL "/favorites.json"
71#define TWITTER_FAVORITE_CREATE_URL "/favorites/create.json"
72#define TWITTER_FAVORITE_DESTROY_URL "/favorites/destroy.json"
73
74/* Block URLs */
75#define TWITTER_BLOCKS_CREATE_URL "/blocks/create/"
76#define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/"
77
78/* Report spam */
79#define TWITTER_REPORT_SPAM_URL "/users/report_spam.json"
80
81/* Stream URLs */
82#define TWITTER_USER_STREAM_URL "https://userstream.twitter.com/1.1/user.json"
83#define TWITTER_FILTER_STREAM_URL "https://stream.twitter.com/1.1/statuses/filter.json"
84
85gboolean twitter_open_stream(struct im_connection *ic);
86gboolean twitter_open_filter_stream(struct im_connection *ic);
87gboolean twitter_get_timeline(struct im_connection *ic, gint64 next_cursor);
88void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor);
89void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor);
90
91void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to);
92void twitter_direct_messages_new(struct im_connection *ic, char *who, char *message);
93void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create);
94void twitter_status_destroy(struct im_connection *ic, guint64 id);
95void twitter_status_retweet(struct im_connection *ic, guint64 id);
96void twitter_report_spam(struct im_connection *ic, char *screen_name);
97void twitter_favourite_tweet(struct im_connection *ic, guint64 id);
98
99#endif //_TWITTER_LIB_H
100
Note: See TracBrowser for help on using the repository browser.