source: protocols/twitter/twitter.h @ 0d753ff

Last change on this file since 0d753ff was fb62f132, checked in by Flexo <nick@…>, at 2016-03-23T20:23:36Z

Honour twitter's mutes and "hide retweets from this user" settings.

  • Property mode set to 100644
File size: 4.1 KB
RevLine 
[1b221e0]1/***************************************************************************\
2*                                                                           *
3*  BitlBee - An IRC to IM gateway                                           *
4*  Simple module to facilitate twitter functionality.                       *
5*                                                                           *
[96dd574]6*  Copyright 2009-2010 Geert Mulders <g.c.w.m.mulders@gmail.com>            *
7*  Copyright 2010-2012 Wilmer van der Gaast <wilmer@gaast.net>              *
[1b221e0]8*                                                                           *
9*  This library is free software; you can redistribute it and/or            *
10*  modify it under the terms of the GNU Lesser General Public               *
11*  License as published by the Free Software Foundation, version            *
12*  2.1.                                                                     *
13*                                                                           *
14*  This library is distributed in the hope that it will be useful,          *
15*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
16*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
17*  Lesser General Public License for more details.                          *
18*                                                                           *
19*  You should have received a copy of the GNU Lesser General Public License *
20*  along with this library; if not, write to the Free Software Foundation,  *
21*  Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA           *
22*                                                                           *
23****************************************************************************/
24
25#include "nogaim.h"
26
27#ifndef _TWITTER_H
28#define _TWITTER_H
29
30#ifdef DEBUG_TWITTER
[5ebff60]31#define debug(text ...) imcb_log(ic, text);
[1b221e0]32#else
[5ebff60]33#define debug(text ...)
[1b221e0]34#endif
35
[5ebff60]36typedef enum {
[96dd574]37        TWITTER_HAVE_FRIENDS   = 0x00001,
38        TWITTER_MODE_ONE       = 0x00002,
39        TWITTER_MODE_MANY      = 0x00004,
40        TWITTER_MODE_CHAT      = 0x00008,
[2322a9f]41        TWITTER_DOING_TIMELINE = 0x10000,
[96dd574]42        TWITTER_GOT_TIMELINE   = 0x20000,
43        TWITTER_GOT_MENTIONS   = 0x40000,
[d6aa6dd]44} twitter_flags_t;
45
[5ebff60]46typedef enum {
[73ee390]47        TWITTER_FILTER_TYPE_FOLLOW = 0,
48        TWITTER_FILTER_TYPE_TRACK
49} twitter_filter_type_t;
50
[ce81acd]51struct twitter_log_data;
52
[5ebff60]53struct twitter_data {
[1b221e0]54        char* user;
[c42e8b9]55        struct oauth_info *oauth_info;
[2322a9f]56
57        gpointer home_timeline_obj;
58        gpointer mentions_obj;
59
60        guint64 timeline_id;
61
[de923d5]62        GSList *follow_ids;
[fb62f132]63        GSList *mutes_ids;
64        GSList *noretweets_ids;
[73ee390]65        GSList *filters;
[5ebff60]66
[7b87539]67        guint64 last_status_id; /* For undo */
[2abceca]68        gint main_loop_id;
[73ee390]69        gint filter_update_id;
[ddc2de5]70        struct http_request *stream;
[73ee390]71        struct http_request *filter_stream;
[2322a9f]72        struct groupchat *timeline_gc;
[3bd4a93]73        gint http_fails;
[d6aa6dd]74        twitter_flags_t flags;
[5ebff60]75
[de923d5]76        /* set base_url */
[bb5ce4d1]77        gboolean url_ssl;
78        int url_port;
79        char *url_host;
80        char *url_path;
[ffcdf13]81
82        char *prefix; /* Used to generate contact + channel name. */
[5ebff60]83
[de923d5]84        /* set show_ids */
[ce81acd]85        struct twitter_log_data *log;
86        int log_id;
[1b221e0]87};
88
[73ee390]89#define TWITTER_FILTER_UPDATE_WAIT 3000
[5ebff60]90struct twitter_filter {
[73ee390]91        twitter_filter_type_t type;
92        char *text;
93        guint64 uid;
94        GSList *groupchats;
95};
96
[5ebff60]97struct twitter_user_data {
[203a2d2]98        guint64 last_id;
99        time_t last_time;
100};
101
[f97b8e9]102#define TWITTER_LOG_LENGTH 256
[5ebff60]103struct twitter_log_data {
[ce81acd]104        guint64 id;
[c43146d]105        /* DANGER: bu can be a dead pointer. Check it first.
106         * twitter_message_id_from_command_arg() will do this. */
107        struct bee_user *bu;
[ce81acd]108};
109
[62d2cfb]110/**
[5ebff60]111 * This has the same function as the msn_connections GSList. We use this to
[62d2cfb]112 * make sure the connection is still alive in callbacks before we do anything
113 * else.
114 */
[9c9a29c]115extern GSList *twitter_connections;
[62d2cfb]116
[c43146d]117/**
118 * Evil hack: Fake bee_user which will always point at the local user.
119 * Sometimes used as a return value by twitter_message_id_from_command_arg.
120 * NOT thread safe but don't you dare to even think of ever making BitlBee
121 * threaded. :-)
122 */
123extern bee_user_t twitter_log_local_user;
124
[5ebff60]125void twitter_login_finish(struct im_connection *ic);
[d6aa6dd]126
[6eca2eb]127struct http_request;
[5ebff60]128char *twitter_parse_error(struct http_request *req);
[6eca2eb]129
[5ebff60]130void twitter_log(struct im_connection *ic, char *format, ...);
[631ec80]131struct groupchat *twitter_groupchat_init(struct im_connection *ic);
[96dd574]132
[1b221e0]133#endif //_TWITTER_H
Note: See TracBrowser for help on using the repository browser.