aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter_http.h
blob: 09ef350c66579dc729926f2499f4bb79a78a4356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/***************************************************************************\
*                                                                           *
*  BitlBee - An IRC to IM gateway                                           *
*  Simple module to facilitate twitter functionality.                       *
*                                                                           *
*  Copyright 2009 Geert Mulders <g.c.w.m.mulders@gmail.com>                 *
*                                                                           *
*  This library is free software; you can redistribute it and/or            *
*  modify it under the terms of the GNU Lesser General Public               *
*  License as published by the Free Software Foundation, version            *
*  2.1.                                                                     *
*                                                                           *
*  This library is distributed in the hope that it will be useful,          *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
*  Lesser General Public License for more details.                          *
*                                                                           *
*  You should have received a copy of the GNU Lesser General Public License *
*  along with this library; if not, write to the Free Software Foundation,  *
*  Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA           *
*                                                                           *
****************************************************************************/

#ifndef _TWITTER_HTTP_H
#define _TWITTER_HTTP_H

#include "nogaim.h"
#include "http_client.h"

typedef enum {
	/* With this set, twitter_http_post() will post a generic confirmation
	   message to the user. */
	TWITTER_HTTP_USER_ACK = 0x1000000,
} twitter_http_flags_t;

struct oauth_info;

struct http_request *twitter_http(struct im_connection *ic, char *url_string, http_input_function func,
                                  gpointer data, int is_post, char** arguments, int arguments_len);
struct http_request *twitter_http_f(struct im_connection *ic, char *url_string, http_input_function func,
                                    gpointer data, int is_post, char** arguments, int arguments_len, twitter_http_flags_t flags);

#endif //_TWITTER_HTTP_H
#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ #define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ #define AIM_IMFLAGS_EXTDATA 0x0100 #define AIM_IMFLAGS_CUSTOMCHARSET 0x0200 /* charset fields set */ #define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */ #define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ /* * Multipart message structures. */ typedef struct aim_mpmsg_section_s { guint16 charset; guint16 charsubset; guint8 *data; guint16 datalen; struct aim_mpmsg_section_s *next; } aim_mpmsg_section_t; typedef struct aim_mpmsg_s { int numparts; aim_mpmsg_section_t *parts; } aim_mpmsg_t; int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm); int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const guint8 *data, guint16 datalen); int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii); int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen); void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm); /* * Arguments to aim_send_im_ext(). * * This is really complicated. But immensely versatile. * */ struct aim_sendimext_args { /* These are _required_ */ const char *destsn; guint32 flags; /* often 0 */ /* Only required if not using multipart messages */ const char *msg; int msglen; /* Required if ->msg is not provided */ aim_mpmsg_t *mpmsg; /* Only used if AIM_IMFLAGS_HASICON is set */ guint32 iconlen; time_t iconstamp; guint32 iconsum; /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */ guint8 *features; guint8 featureslen; /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */ guint16 charset; guint16 charsubset; }; /* * Arguments to aim_send_rtfmsg(). */ struct aim_sendrtfmsg_args { const char *destsn; guint32 fgcolor; guint32 bgcolor; const char *rtfmsg; /* must be in RTF */ }; /* * This information is provided in the Incoming ICBM callback for * Channel 1 ICBM's. * * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they * are optional, both are always set by the current libfaim code. * That may or may not change in the future. It is mainly for * consistency with aim_sendimext_args. * * Multipart messages require some explanation. If you want to use them, * I suggest you read all the comments in im.c. * */ struct aim_incomingim_ch1_args { /* Always provided */ aim_mpmsg_t mpmsg; guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */ /* Only provided if message has a human-readable section */ char *msg; int msglen; /* Only provided if AIM_IMFLAGS_HASICON is set */ time_t iconstamp; guint32 iconlen; guint16 iconsum; /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */ guint8 *features; guint8 featureslen; /* Only provided if AIM_IMFLAGS_EXTDATA is set */ guint8 extdatalen; guint8 *extdata; /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */ guint16 charset; guint16 charsubset; }; /* Valid values for channel 2 args->status */ #define AIM_RENDEZVOUS_PROPOSE 0x0000 #define AIM_RENDEZVOUS_CANCEL 0x0001 #define AIM_RENDEZVOUS_ACCEPT 0x0002 struct aim_incomingim_ch2_args { guint8 cookie[8]; guint16 reqclass; guint16 status; guint16 errorcode; const char *clientip; const char *clientip2; const char *verifiedip; guint16 port; const char *msg; /* invite message or file description */ const char *encoding; const char *language; union { struct { guint32 checksum; guint32 length; time_t timestamp; guint8 *icon; } icon; struct { struct aim_chat_roominfo roominfo; } chat; struct { guint32 fgcolor; guint32 bgcolor; const char *rtfmsg; } rtfmsg; } info; void *destructor; /* used internally only */ }; /* Valid values for channel 4 args->type */ #define AIM_ICQMSG_AUTHREQUEST 0x0006 #define AIM_ICQMSG_AUTHDENIED 0x0007 #define AIM_ICQMSG_AUTHGRANTED 0x0008 struct aim_incomingim_ch4_args { guint32 uin; /* Of the sender of the ICBM */ guint16 type; char *msg; /* Reason for auth request, deny, or accept */ }; int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args); int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args); int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg); int aim_send_icon(aim_session_t *sess, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum); guint16 aim_iconsum(const guint8 *buf, int buflen); int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing); int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len); const char *aim_directim_getsn(aim_conn_t *conn); aim_conn_t *aim_directim_initiate(aim_session_t *, const char *destsn); aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const guint8 *cookie); int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type); int aim_im_sendmtn(aim_session_t *sess, guint16 type1, const char *sn, guint16 type2); int aim_send_im_ch2_statusmessage(aim_session_t *sess, const char *sender, const guint8 *cookie, const char *message, const guint8 state, const guint16 dc); #endif /* __OSCAR_IM_H__ */