[1b221e0] | 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 | |
---|
[d6aa6dd] | 35 | typedef enum |
---|
| 36 | { |
---|
| 37 | TWITTER_HAVE_FRIENDS = 1, |
---|
[2322a9f] | 38 | TWITTER_DOING_TIMELINE = 0x10000, |
---|
| 39 | TWITTER_GOT_TIMELINE = 0x20000, |
---|
| 40 | TWITTER_GOT_MENTIONS = 0x40000, |
---|
[733f607] | 41 | TWITTER_DOING_TIMELINE_SLOW = 0x80000, |
---|
[d6aa6dd] | 42 | } twitter_flags_t; |
---|
| 43 | |
---|
[ce81acd] | 44 | struct twitter_log_data; |
---|
| 45 | |
---|
[1b221e0] | 46 | struct twitter_data |
---|
| 47 | { |
---|
| 48 | char* user; |
---|
[c42e8b9] | 49 | struct oauth_info *oauth_info; |
---|
[2322a9f] | 50 | |
---|
| 51 | gpointer home_timeline_obj; |
---|
| 52 | gpointer mentions_obj; |
---|
| 53 | |
---|
| 54 | guint64 timeline_id; |
---|
| 55 | |
---|
[de923d5] | 56 | GSList *follow_ids; |
---|
| 57 | |
---|
[7b87539] | 58 | guint64 last_status_id; /* For undo */ |
---|
[2abceca] | 59 | gint main_loop_id; |
---|
[2322a9f] | 60 | struct groupchat *timeline_gc; |
---|
[3bd4a93] | 61 | gint http_fails; |
---|
[d6aa6dd] | 62 | twitter_flags_t flags; |
---|
[bb5ce4d1] | 63 | |
---|
[de923d5] | 64 | /* set base_url */ |
---|
[bb5ce4d1] | 65 | gboolean url_ssl; |
---|
| 66 | int url_port; |
---|
| 67 | char *url_host; |
---|
| 68 | char *url_path; |
---|
[ffcdf13] | 69 | |
---|
| 70 | char *prefix; /* Used to generate contact + channel name. */ |
---|
[ce81acd] | 71 | |
---|
[de923d5] | 72 | /* set show_ids */ |
---|
[ce81acd] | 73 | struct twitter_log_data *log; |
---|
| 74 | int log_id; |
---|
[1b221e0] | 75 | }; |
---|
| 76 | |
---|
[203a2d2] | 77 | struct twitter_user_data |
---|
| 78 | { |
---|
| 79 | guint64 last_id; |
---|
| 80 | time_t last_time; |
---|
| 81 | }; |
---|
| 82 | |
---|
[ce81acd] | 83 | #define TWITTER_LOG_LENGTH 100 |
---|
| 84 | struct twitter_log_data |
---|
| 85 | { |
---|
| 86 | guint64 id; |
---|
[4f50ea5] | 87 | struct bee_user *bu; /* DANGER: can be a dead pointer. Check it first. */ |
---|
[ce81acd] | 88 | }; |
---|
| 89 | |
---|
[62d2cfb] | 90 | /** |
---|
| 91 | * This has the same function as the msn_connections GSList. We use this to |
---|
| 92 | * make sure the connection is still alive in callbacks before we do anything |
---|
| 93 | * else. |
---|
| 94 | */ |
---|
[9c9a29c] | 95 | extern GSList *twitter_connections; |
---|
[62d2cfb] | 96 | |
---|
[d6aa6dd] | 97 | void twitter_login_finish( struct im_connection *ic ); |
---|
| 98 | |
---|
[6eca2eb] | 99 | struct http_request; |
---|
| 100 | char *twitter_parse_error( struct http_request *req ); |
---|
| 101 | |
---|
[1b221e0] | 102 | #endif //_TWITTER_H |
---|