source: protocols/twitter/twitter.h @ 8519f45

Last change on this file since 8519f45 was f97b8e9, checked in by Wilmer van der Gaast <wilmer@…>, at 2012-11-25T20:43:52Z

Use hex for show_ids, but stick to the 2-char maximum. a 256-message backlog
really should be enough.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/***************************************************************************\
2*                                                                           *
3*  BitlBee - An IRC to IM gateway                                           *
4*  Simple module to facilitate twitter functionality.                       *
5*                                                                           *
6*  Copyright 2009-2010 Geert Mulders <g.c.w.m.mulders@gmail.com>            *
7*  Copyright 2010-2012 Wilmer van der Gaast <wilmer@gaast.net>              *
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
31#define debug( text... ) imcb_log( ic, text );
32#else
33#define debug( text... )
34#endif
35
36typedef enum
37{
38        TWITTER_HAVE_FRIENDS   = 0x00001,
39        TWITTER_MODE_ONE       = 0x00002,
40        TWITTER_MODE_MANY      = 0x00004,
41        TWITTER_MODE_CHAT      = 0x00008,
42        TWITTER_DOING_TIMELINE = 0x10000,
43        TWITTER_GOT_TIMELINE   = 0x20000,
44        TWITTER_GOT_MENTIONS   = 0x40000,
45} twitter_flags_t;
46
47struct twitter_log_data;
48
49struct twitter_data
50{
51        char* user;
52        struct oauth_info *oauth_info;
53
54        gpointer home_timeline_obj;
55        gpointer mentions_obj;
56
57        guint64 timeline_id;
58
59        GSList *follow_ids;
60       
61        guint64 last_status_id; /* For undo */
62        gint main_loop_id;
63        struct http_request *stream;
64        struct groupchat *timeline_gc;
65        gint http_fails;
66        twitter_flags_t flags;
67       
68        /* set base_url */
69        gboolean url_ssl;
70        int url_port;
71        char *url_host;
72        char *url_path;
73
74        char *prefix; /* Used to generate contact + channel name. */
75       
76        /* set show_ids */
77        struct twitter_log_data *log;
78        int log_id;
79};
80
81struct twitter_user_data
82{
83        guint64 last_id;
84        time_t last_time;
85};
86
87#define TWITTER_LOG_LENGTH 256
88struct twitter_log_data
89{
90        guint64 id;
91        struct bee_user *bu; /* DANGER: can be a dead pointer. Check it first. */
92};
93
94/**
95 * This has the same function as the msn_connections GSList. We use this to
96 * make sure the connection is still alive in callbacks before we do anything
97 * else.
98 */
99extern GSList *twitter_connections;
100
101void twitter_login_finish( struct im_connection *ic );
102
103struct http_request;
104char *twitter_parse_error( struct http_request *req );
105
106void twitter_log(struct im_connection *ic, char *format, ... );
107struct groupchat *twitter_groupchat_init(struct im_connection *ic);
108
109#endif //_TWITTER_H
Note: See TracBrowser for help on using the repository browser.