source: protocols/oscar/im.h @ c7cf9d6

Last change on this file since c7cf9d6 was 3e1de87, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-11-19T11:12:18Z

Applied AIM typing notification patch from Hanji.

  • Property mode set to 100644
File size: 5.9 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);
49int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const guint8 *data, guint16 datalen);
50int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii);
51int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen);
52void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm);
53
54/*
55 * Arguments to aim_send_im_ext().
56 *
57 * This is really complicated.  But immensely versatile.
58 *
59 */
60struct aim_sendimext_args {
61
62        /* These are _required_ */
63        const char *destsn;
64        guint32 flags; /* often 0 */
65
66        /* Only required if not using multipart messages */
67        const char *msg;
68        int msglen;
69
70        /* Required if ->msg is not provided */
71        aim_mpmsg_t *mpmsg;
72
73        /* Only used if AIM_IMFLAGS_HASICON is set */
74        guint32 iconlen;
75        time_t iconstamp;
76        guint32 iconsum;
77
78        /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */
79        guint8 *features;
80        guint8 featureslen;
81
82        /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */
83        guint16 charset;
84        guint16 charsubset;
85};
86
87/*
88 * Arguments to aim_send_rtfmsg().
89 */
90struct aim_sendrtfmsg_args {
91        const char *destsn;
92        guint32 fgcolor;
93        guint32 bgcolor;
94        const char *rtfmsg; /* must be in RTF */
95};
96
97/*
98 * This information is provided in the Incoming ICBM callback for
99 * Channel 1 ICBM's. 
100 *
101 * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they
102 * are optional, both are always set by the current libfaim code.
103 * That may or may not change in the future.  It is mainly for
104 * consistency with aim_sendimext_args.
105 *
106 * Multipart messages require some explanation. If you want to use them,
107 * I suggest you read all the comments in im.c.
108 *
109 */
110struct aim_incomingim_ch1_args {
111
112        /* Always provided */
113        aim_mpmsg_t mpmsg;
114        guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */
115       
116        /* Only provided if message has a human-readable section */
117        char *msg;
118        int msglen;
119
120        /* Only provided if AIM_IMFLAGS_HASICON is set */
121        time_t iconstamp;
122        guint32 iconlen;
123        guint16 iconsum;
124
125        /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */
126        guint8 *features;
127        guint8 featureslen;
128
129        /* Only provided if AIM_IMFLAGS_EXTDATA is set */
130        guint8 extdatalen;
131        guint8 *extdata;
132
133        /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */
134        guint16 charset;
135        guint16 charsubset;
136};
137
138/* Valid values for channel 2 args->status */
139#define AIM_RENDEZVOUS_PROPOSE 0x0000
140#define AIM_RENDEZVOUS_CANCEL  0x0001
141#define AIM_RENDEZVOUS_ACCEPT  0x0002
142
143struct aim_incomingim_ch2_args {
144        guint8 cookie[8];
145        guint16 reqclass;
146        guint16 status;
147        guint16 errorcode;
148        const char *clientip;
149        const char *clientip2;
150        const char *verifiedip;
151        guint16 port;
152        const char *msg; /* invite message or file description */
153        const char *encoding;
154        const char *language;
155        union {
156                struct {
157                        guint32 checksum;
158                        guint32 length;
159                        time_t timestamp;
160                        guint8 *icon;
161                } icon;
162                struct {
163                        struct aim_chat_roominfo roominfo;
164                } chat;
165                struct {
166                        guint32 fgcolor;
167                        guint32 bgcolor;
168                        const char *rtfmsg;
169                } rtfmsg;
170        } info;
171        void *destructor; /* used internally only */
172};
173
174/* Valid values for channel 4 args->type */
175#define AIM_ICQMSG_AUTHREQUEST 0x0006
176#define AIM_ICQMSG_AUTHDENIED 0x0007
177#define AIM_ICQMSG_AUTHGRANTED 0x0008
178
179struct aim_incomingim_ch4_args {
180        guint32 uin; /* Of the sender of the ICBM */
181        guint16 type;
182        char *msg; /* Reason for auth request, deny, or accept */
183};
184
185int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args);
186int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args);
187int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg);
188int aim_send_icon(aim_session_t *sess, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum);
189guint16 aim_iconsum(const guint8 *buf, int buflen);
190int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing);
191int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len);
192const char *aim_directim_getsn(aim_conn_t *conn);
193aim_conn_t *aim_directim_initiate(aim_session_t *, const char *destsn);
194aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const guint8 *cookie);
195
196int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type);
197int aim_im_sendmtn(aim_session_t *sess, guint16 type1, const char *sn, guint16 type2);
198int aim_send_im_ch2_statusmessage(aim_session_t *sess, const char *sender, const guint8 *cookie, const char *message, const guint8 state, const guint16 dc);
199
200#endif /* __OSCAR_IM_H__ */
Note: See TracBrowser for help on using the repository browser.