source: protocols/oscar/im.h @ f56c491

Last change on this file since f56c491 was b7d3cc34, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-11-06T18:23:18Z

Initial repository (0.99 release tree)

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