source: protocols/twitter/twitter.h @ 2322a9f

Last change on this file since 2322a9f was 2322a9f, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-08-25T18:08:07Z

Merging Twitter-mentions patch from meh. Bug #663.

  • Property mode set to 100644
File size: 3.1 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#include "nogaim.h"
25
26#ifndef _TWITTER_H
27#define _TWITTER_H
28
29#ifdef DEBUG_TWITTER
30#define debug( text... ) imcb_log( ic, text );
31#else
32#define debug( text... )
33#endif
34
35typedef enum
36{
37        TWITTER_HAVE_FRIENDS = 1,
38        TWITTER_DOING_TIMELINE = 0x10000,
39        TWITTER_GOT_TIMELINE = 0x20000,
40        TWITTER_GOT_MENTIONS = 0x40000,
41} twitter_flags_t;
42
43struct twitter_log_data;
44
45struct twitter_data
46{
47        char* user;
48        struct oauth_info *oauth_info;
49
50        gpointer home_timeline_obj;
51        gpointer mentions_obj;
52
53        guint64 timeline_id;
54
55        GSList *follow_ids;
56       
57        guint64 last_status_id; /* For undo */
58        gint main_loop_id;
59        struct groupchat *timeline_gc;
60        gint http_fails;
61        twitter_flags_t flags;
62       
63        /* set base_url */
64        gboolean url_ssl;
65        int url_port;
66        char *url_host;
67        char *url_path;
68
69        char *prefix; /* Used to generate contact + channel name. */
70       
71        /* set show_ids */
72        struct twitter_log_data *log;
73        int log_id;
74};
75
76struct twitter_user_data
77{
78        guint64 last_id;
79        time_t last_time;
80};
81
82#define TWITTER_LOG_LENGTH 100
83struct twitter_log_data
84{
85        guint64 id;
86        struct bee_user *bu; /* DANGER: can be a dead pointer. Check it first. */
87};
88
89/**
90 * This has the same function as the msn_connections GSList. We use this to
91 * make sure the connection is still alive in callbacks before we do anything
92 * else.
93 */
94extern GSList *twitter_connections;
95
96void twitter_login_finish( struct im_connection *ic );
97
98struct http_request;
99char *twitter_parse_error( struct http_request *req );
100
101#endif //_TWITTER_H
Note: See TracBrowser for help on using the repository browser.