source: protocols/oscar/im.h @ 573e274

Last change on this file since 573e274 was 6042a54, checked in by Wilmer van der Gaast <wilmer@…>, at 2012-10-19T23:38:33Z

Massive cleanup in OSCAR.

  • Property mode set to 100644
File size: 5.1 KB
Line 
1#ifndef __OSCAR_IM_H__
2#define __OSCAR_IM_H__
3
4#define AIM_CB_FAM_MSG 0x0004
5
6/*
7 * SNAC Family: Messaging Services.
8 */ 
9#define AIM_CB_MSG_ERROR 0x0001
10#define AIM_CB_MSG_PARAMINFO 0x0005
11#define AIM_CB_MSG_INCOMING 0x0007
12#define AIM_CB_MSG_EVIL 0x0009
13#define AIM_CB_MSG_MISSEDCALL 0x000a
14#define AIM_CB_MSG_CLIENTAUTORESP 0x000b
15#define AIM_CB_MSG_ACK 0x000c
16#define AIM_CB_MSG_MTN 0x0014
17#define AIM_CB_MSG_DEFAULT 0xffff
18
19#define AIM_IMFLAGS_AWAY                0x0001 /* mark as an autoreply */
20#define AIM_IMFLAGS_ACK                 0x0002 /* request a receipt notice */
21#define AIM_IMFLAGS_UNICODE             0x0004
22#define AIM_IMFLAGS_ISO_8859_1          0x0008
23#define AIM_IMFLAGS_BUDDYREQ            0x0010 /* buddy icon requested */
24#define AIM_IMFLAGS_HASICON             0x0020 /* already has icon */
25#define AIM_IMFLAGS_SUBENC_MACINTOSH    0x0040 /* damn that Steve Jobs! */
26#define AIM_IMFLAGS_CUSTOMFEATURES      0x0080 /* features field present */
27#define AIM_IMFLAGS_EXTDATA             0x0100
28#define AIM_IMFLAGS_CUSTOMCHARSET       0x0200 /* charset fields set */
29#define AIM_IMFLAGS_MULTIPART           0x0400 /* ->mpmsg section valid */
30#define AIM_IMFLAGS_OFFLINE             0x0800 /* send to offline user */
31
32/*
33 * Multipart message structures.
34 */
35typedef struct aim_mpmsg_section_s {
36        guint16 charset;
37        guint16 charsubset;
38        guint8 *data;
39        guint16 datalen;
40        struct aim_mpmsg_section_s *next;
41} aim_mpmsg_section_t;
42
43typedef struct aim_mpmsg_s {
44        int numparts;
45        aim_mpmsg_section_t *parts;
46} aim_mpmsg_t;
47
48int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm);
49void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm);
50
51/*
52 * Arguments to aim_send_im_ext().
53 *
54 * This is really complicated.  But immensely versatile.
55 *
56 */
57struct aim_sendimext_args {
58
59        /* These are _required_ */
60        const char *destsn;
61        guint32 flags; /* often 0 */
62
63        /* Only required if not using multipart messages */
64        const char *msg;
65        int msglen;
66
67        /* Required if ->msg is not provided */
68        aim_mpmsg_t *mpmsg;
69
70        /* Only used if AIM_IMFLAGS_HASICON is set */
71        guint32 iconlen;
72        time_t iconstamp;
73        guint32 iconsum;
74
75        /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */
76        guint8 *features;
77        guint8 featureslen;
78
79        /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */
80        guint16 charset;
81        guint16 charsubset;
82};
83
84/*
85 * This information is provided in the Incoming ICBM callback for
86 * Channel 1 ICBM's. 
87 *
88 * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they
89 * are optional, both are always set by the current libfaim code.
90 * That may or may not change in the future.  It is mainly for
91 * consistency with aim_sendimext_args.
92 *
93 * Multipart messages require some explanation. If you want to use them,
94 * I suggest you read all the comments in im.c.
95 *
96 */
97struct aim_incomingim_ch1_args {
98
99        /* Always provided */
100        aim_mpmsg_t mpmsg;
101        guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */
102       
103        /* Only provided if message has a human-readable section */
104        char *msg;
105        int msglen;
106
107        /* Only provided if AIM_IMFLAGS_HASICON is set */
108        time_t iconstamp;
109        guint32 iconlen;
110        guint16 iconsum;
111
112        /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */
113        guint8 *features;
114        guint8 featureslen;
115
116        /* Only provided if AIM_IMFLAGS_EXTDATA is set */
117        guint8 extdatalen;
118        guint8 *extdata;
119
120        /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */
121        guint16 charset;
122        guint16 charsubset;
123};
124
125/* Valid values for channel 2 args->status */
126#define AIM_RENDEZVOUS_PROPOSE 0x0000
127#define AIM_RENDEZVOUS_CANCEL  0x0001
128#define AIM_RENDEZVOUS_ACCEPT  0x0002
129
130struct aim_incomingim_ch2_args {
131        guint8 cookie[8];
132        guint16 reqclass;
133        guint16 status;
134        guint16 errorcode;
135        const char *clientip;
136        const char *clientip2;
137        const char *verifiedip;
138        guint16 port;
139        const char *msg; /* invite message or file description */
140        const char *encoding;
141        const char *language;
142        union {
143                struct {
144                        guint32 checksum;
145                        guint32 length;
146                        time_t timestamp;
147                        guint8 *icon;
148                } icon;
149                struct {
150                        struct aim_chat_roominfo roominfo;
151                } chat;
152                struct {
153                        guint32 fgcolor;
154                        guint32 bgcolor;
155                        const char *rtfmsg;
156                } rtfmsg;
157        } info;
158        void *destructor; /* used internally only */
159};
160
161/* Valid values for channel 4 args->type */
162#define AIM_ICQMSG_AUTHREQUEST 0x0006
163#define AIM_ICQMSG_AUTHDENIED 0x0007
164#define AIM_ICQMSG_AUTHGRANTED 0x0008
165
166struct aim_incomingim_ch4_args {
167        guint32 uin; /* Of the sender of the ICBM */
168        guint16 type;
169        char *msg; /* Reason for auth request, deny, or accept */
170};
171
172int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args);
173int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg);
174int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing);
175int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len);
176const char *aim_directim_getsn(aim_conn_t *conn);
177aim_conn_t *aim_directim_initiate(aim_session_t *, const char *destsn);
178aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const guint8 *cookie);
179
180int aim_im_sendmtn(aim_session_t *sess, guint16 type1, const char *sn, guint16 type2);
181int aim_send_im_ch2_statusmessage(aim_session_t *sess, const char *sender, const guint8 *cookie, const char *message, const guint8 state, const guint16 dc);
182
183#endif /* __OSCAR_IM_H__ */
Note: See TracBrowser for help on using the repository browser.