comparison plugins/yay/libyahoo.h @ 1054:0b0b4cb53c17

[gaim-migrate @ 1064] yahoo prpl committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 03 Nov 2000 10:03:53 +0000
parents
children
comparison
equal deleted inserted replaced
1053:864f4aae0b60 1054:0b0b4cb53c17
1 #ifndef LIBYAHOO_H
2 #define LIBYAHOO_H
3
4 /* Service constants */
5 #define YAHOO_SERVICE_LOGON 1
6 #define YAHOO_SERVICE_LOGOFF 2
7 #define YAHOO_SERVICE_ISAWAY 3
8 #define YAHOO_SERVICE_ISBACK 4
9 #define YAHOO_SERVICE_IDLE 5
10 #define YAHOO_SERVICE_MESSAGE 6
11 #define YAHOO_SERVICE_IDACT 7
12 #define YAHOO_SERVICE_IDDEACT 8
13 #define YAHOO_SERVICE_MAILSTAT 9
14 #define YAHOO_SERVICE_USERSTAT 10
15 #define YAHOO_SERVICE_NEWMAIL 11
16 #define YAHOO_SERVICE_CHATINVITE 12
17 #define YAHOO_SERVICE_CALENDAR 13
18 #define YAHOO_SERVICE_NEWPERSONALMAIL 14
19 #define YAHOO_SERVICE_NEWCONTACT 15
20 #define YAHOO_SERVICE_ADDIDENT 16
21 #define YAHOO_SERVICE_ADDIGNORE 17
22 #define YAHOO_SERVICE_PING 18
23 #define YAHOO_SERVICE_GROUPRENAME 19
24 #define YAHOO_SERVICE_SYSMESSAGE 20
25 #define YAHOO_SERVICE_PASSTHROUGH2 22
26 #define YAHOO_SERVICE_CONFINVITE 24
27 #define YAHOO_SERVICE_CONFLOGON 25
28 #define YAHOO_SERVICE_CONFDECLINE 26
29 #define YAHOO_SERVICE_CONFLOGOFF 27
30 #define YAHOO_SERVICE_CONFADDINVITE 28
31 #define YAHOO_SERVICE_CONFMSG 29
32 #define YAHOO_SERVICE_CHATLOGON 30
33 #define YAHOO_SERVICE_CHATLOGOFF 31
34 #define YAHOO_SERVICE_CHATMSG 32
35 #define YAHOO_SERVICE_GAMELOGON 40
36 #define YAHOO_SERVICE_GAMELOGOFF 41
37 #define YAHOO_SERVICE_FILETRANSFER 70
38
39 /* Yahoo style/color directives */
40 #define YAHOO_COLOR_BLACK "\033[30m"
41 #define YAHOO_COLOR_BLUE "\033[31m"
42 #define YAHOO_COLOR_LIGHTBLUE "\033[32m"
43 #define YAHOO_COLOR_GRAY "\033[33m"
44 #define YAHOO_COLOR_GREEN "\033[34m"
45 #define YAHOO_COLOR_PINK "\033[35m"
46 #define YAHOO_COLOR_PURPLE "\033[36m"
47 #define YAHOO_COLOR_ORANGE "\033[37m"
48 #define YAHOO_COLOR_RED "\033[38m"
49 #define YAHOO_COLOR_OLIVE "\033[39m"
50 #define YAHOO_STYLE_ITALICON "\033[2m"
51 #define YAHOO_STYLE_ITALICOFF "\033[x2m"
52 #define YAHOO_STYLE_BOLDON "\033[1m"
53 #define YAHOO_STYLE_BOLDOFF "\033[x1m"
54 #define YAHOO_STYLE_UNDERLINEON "\033[4m"
55 #define YAHOO_STYLE_UNDERLINEOFF "\033[x4m"
56 #define YAHOO_STYLE_URLON "\033[lm"
57 #define YAHOO_STYLE_URLOFF "\033[xlm"
58
59 /* Message flags */
60 #define YAHOO_MSGTYPE_ERROR -1 /* 0xFFFFFFFF */
61 #define YAHOO_MSGTYPE_NONE 0 /* ok */
62 #define YAHOO_MSGTYPE_NORMAL 1 /* notify */
63 #define YAHOO_MSGTYPE_BOUNCE 2 /* not available */
64 #define YAHOO_MSGTYPE_STATUS 4 /* user away */
65 #define YAHOO_MSGTYPE_OFFLINE 5
66 #define YAHOO_MSGTYPE_INVISIBLE 12
67
68 #define YAHOO_MSGTYPE_KNOWN_USER 1515563606 /* 0x5A55AA56 */
69 #define YAHOO_MSGTYPE_UNKNOWN_USER 1515563605 /* 0x5A55AA55 */
70
71 #define YAHOO_CONF_LEVEL_0 0
72
73 /* Structure definitions */
74
75 enum phone { home = 0, work };
76
77 struct yahoo_address
78 {
79 char *id;
80 char *firstname;
81 char *lastname;
82 char *emailnickname;
83 char *email;
84 char *workphone;
85 char *homephone;
86 enum phone primary_phone;
87 unsigned int entryid;
88 };
89
90 struct yahoo_context
91 {
92 /* Input parameters from calling application */
93 char *user;
94 char *password;
95 int connect_mode; /* connection mode */
96 int proxy_port;
97 char *proxy_host;
98
99 /* Semi-public */
100 int sockfd; /* pager server socket */
101
102 /* IO buffer parameters */
103 char *io_buf; /* Buffer for storing incoming packets */
104 int io_buf_curlen;
105 int io_buf_maxlen;
106
107 /* Cookie data */
108 char *cookie;
109 char *login_cookie;
110
111 /* Buddy list parameters */
112 struct yahoo_buddy **buddies; /* list of groups and buddies */
113 char **identities; /* list of identities */
114 char *login_id; /* what id should be specified as the primary id */
115 int mail; /* I think this indicates if user has a yahoo mail id */
116
117 /* Temporary to hold the magic id for outbound packets */
118 unsigned int magic_id;
119 unsigned int connection_id;
120 unsigned int address_count;
121 struct yahoo_address *addresses;
122 };
123
124 struct yahoo_options
125 {
126 int connect_mode;
127
128 char *proxy_host;
129 int proxy_port;
130 };
131
132 struct yahoo_rawpacket
133 {
134 char version[8]; /* 7 chars and trailing null */
135 unsigned char len[4]; /* length - little endian */
136 unsigned char service[4]; /* service - little endian */
137
138 /* 3 X 4bytes - host, port, ip_address */
139 /* not sure what diff is between host and ip addr */
140 unsigned char connection_id[4]; /* connection number - little endian */
141 unsigned char magic_id[4]; /* magic number used for http session */
142 unsigned char unknown1[4];
143
144 unsigned char msgtype[4];
145 char nick1[36];
146 char nick2[36];
147 char content[1]; /* was zero, had problems with aix xlc */
148 };
149
150 /*
151 * Structure for returning the status/flags/etc. of a particular id
152 */
153 struct yahoo_idstatus
154 {
155 char *id;
156 int status;
157 char *status_msg;
158 char *connection_id;
159 int in_pager;
160 int in_chat;
161 int in_game; /* not sure */
162 };
163
164 /*
165 * Structure for returning a buddy entry
166 */
167 struct yahoo_buddy
168 {
169 char *group; /* member of what group */
170 char *id; /* the buddy's id */
171 };
172
173 /*
174 * Generic packet type for returning from the parse routine
175 * The fields in this packet are not all used and are defined
176 * so that a single type of packet can be returned from the parse routine
177 */
178
179 struct yahoo_packet
180 {
181 /* Common info */
182 int service; /* Service type */
183 int connection_id; /* Connection ID */
184 char *real_id; /* What ID is logged on */
185 char *active_id; /* What ID is active */
186
187 /* Flags for the unknown portion of the data */
188 unsigned int magic_id;
189 unsigned int unknown1;
190 unsigned int msgtype; /* flag for indicating/requesting msg type */
191
192 /* Status flag, I think used at login */
193 int flag; /* Used at logon for success/alerts? */
194
195 /* Status entries */
196 int idstatus_count;
197 struct yahoo_idstatus **idstatus; /* Array of status entries for id's */
198
199 /* Conferencing */
200 char *conf_id; /* id for the conference */
201 char *conf_host; /* who is hosting the conference */
202 char *conf_user; /* single username ( used in */
203 /* declined conference/ */
204 /* addinvite / message / */
205 /* logon / logoff ) */
206
207 char **conf_userlist; /* user list */
208 char *conf_inviter; /* user who invited you */
209 /* (conference addinvite) */
210
211 char *conf_msg; /* conference message */
212
213 int conf_type; /* text(0) or */
214 /* voice(1) conference */
215
216 /* Mail status */
217 int mail_status;
218
219 /* Calendar data */
220 char *cal_url;
221 int cal_type;
222 char *cal_timestamp;
223 char *cal_title;
224 char *cal_description;
225
226 /* Chat invite data */
227 char *chat_invite_content;
228
229 /* Received message */
230 char *msg_id; /* Originator of message */
231 int msg_status; /* Status update from the message */
232 char *msg_timestamp; /* Timestamp of offline message */
233 char *msg; /* Content of message */
234
235 /* File transfer request */
236 char *file_from;
237 char *file_flag;
238 char *file_url;
239 char *file_description;
240 int file_expires;
241
242 /* Group names for renaming */
243 char *group_old; /* Old group name */
244 char *group_new; /* New group name */
245 };
246
247 /* Misc contants */
248 #define YAHOO_PACKET_HEADER_SIZE 104 /* size of a standard header */
249
250 /* Status codes */
251 struct yahoo_idlabel
252 {
253 int id;
254 char *label;
255 };
256
257 /* Constants for connect mode selection */
258 enum
259 {
260 YAHOO_CONNECT_NORMAL, YAHOO_CONNECT_HTTP, YAHOO_CONNECT_HTTPPROXY,
261 YAHOO_CONNECT_SOCKS4, YAHOO_CONNECT_SOCKS5
262 };
263
264 /* Constants for status codes */
265 enum
266 {
267 YAHOO_STATUS_AVAILABLE,
268 YAHOO_STATUS_BRB,
269 YAHOO_STATUS_BUSY,
270 YAHOO_STATUS_NOTATHOME,
271 YAHOO_STATUS_NOTATDESK,
272 YAHOO_STATUS_NOTINOFFICE,
273 YAHOO_STATUS_ONPHONE,
274 YAHOO_STATUS_ONVACATION,
275 YAHOO_STATUS_OUTTOLUNCH,
276 YAHOO_STATUS_STEPPEDOUT,
277 YAHOO_STATUS_INVISIBLE = 12,
278 YAHOO_STATUS_CUSTOM = 99,
279 YAHOO_STATUS_IDLE = 999
280 };
281
282 /* Function prototypes */
283 #include "libyahoo-proto.h"
284 #endif