From 73ee390abec21c2b724175d4a5c9cfc27aa85bcf Mon Sep 17 00:00:00 2001 From: jgeboski Date: Mon, 15 Dec 2014 07:17:12 -0500 Subject: 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. --- protocols/twitter/twitter.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'protocols/twitter/twitter.h') diff --git a/protocols/twitter/twitter.h b/protocols/twitter/twitter.h index 8792b7c9..00230cc0 100644 --- a/protocols/twitter/twitter.h +++ b/protocols/twitter/twitter.h @@ -44,6 +44,12 @@ typedef enum TWITTER_GOT_MENTIONS = 0x40000, } twitter_flags_t; +typedef enum +{ + TWITTER_FILTER_TYPE_FOLLOW = 0, + TWITTER_FILTER_TYPE_TRACK +} twitter_filter_type_t; + struct twitter_log_data; struct twitter_data @@ -57,10 +63,13 @@ struct twitter_data guint64 timeline_id; GSList *follow_ids; + GSList *filters; guint64 last_status_id; /* For undo */ gint main_loop_id; + gint filter_update_id; struct http_request *stream; + struct http_request *filter_stream; struct groupchat *timeline_gc; gint http_fails; twitter_flags_t flags; @@ -78,6 +87,15 @@ struct twitter_data int log_id; }; +#define TWITTER_FILTER_UPDATE_WAIT 3000 +struct twitter_filter +{ + twitter_filter_type_t type; + char *text; + guint64 uid; + GSList *groupchats; +}; + struct twitter_user_data { guint64 last_id; -- cgit v1.2.3