Yahoo - implement missing callbacks
[centerim.git] / libyahoo2 / yahoo2_types.h
blobbbade5d8730312242ed3487afd42ed7722b17a3b
1 /*
2 * libyahoo2: yahoo2_types.h
4 * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef YAHOO2_TYPES_H
23 #define YAHOO2_TYPES_H
25 #include "yahoo_list.h"
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
31 enum yahoo_service { /* these are easier to see in hex */
32 YAHOO_SERVICE_LOGON = 1,
33 YAHOO_SERVICE_LOGOFF,
34 YAHOO_SERVICE_ISAWAY,
35 YAHOO_SERVICE_ISBACK,
36 YAHOO_SERVICE_IDLE, /* 5 (placemarker) */
37 YAHOO_SERVICE_MESSAGE,
38 YAHOO_SERVICE_IDACT,
39 YAHOO_SERVICE_IDDEACT,
40 YAHOO_SERVICE_MAILSTAT,
41 YAHOO_SERVICE_USERSTAT, /* 0xa */
42 YAHOO_SERVICE_NEWMAIL,
43 YAHOO_SERVICE_CHATINVITE,
44 YAHOO_SERVICE_CALENDAR,
45 YAHOO_SERVICE_NEWPERSONALMAIL,
46 YAHOO_SERVICE_NEWCONTACT,
47 YAHOO_SERVICE_ADDIDENT, /* 0x10 */
48 YAHOO_SERVICE_ADDIGNORE,
49 YAHOO_SERVICE_PING,
50 YAHOO_SERVICE_GOTGROUPRENAME, /* < 1, 36(old), 37(new) */
51 YAHOO_SERVICE_SYSMESSAGE = 0x14,
52 YAHOO_SERVICE_SKINNAME = 0x15,
53 YAHOO_SERVICE_PASSTHROUGH2 = 0x16,
54 YAHOO_SERVICE_CONFINVITE = 0x18,
55 YAHOO_SERVICE_CONFLOGON,
56 YAHOO_SERVICE_CONFDECLINE,
57 YAHOO_SERVICE_CONFLOGOFF,
58 YAHOO_SERVICE_CONFADDINVITE,
59 YAHOO_SERVICE_CONFMSG,
60 YAHOO_SERVICE_CHATLOGON,
61 YAHOO_SERVICE_CHATLOGOFF,
62 YAHOO_SERVICE_CHATMSG = 0x20,
63 YAHOO_SERVICE_GAMELOGON = 0x28,
64 YAHOO_SERVICE_GAMELOGOFF,
65 YAHOO_SERVICE_GAMEMSG = 0x2a,
66 YAHOO_SERVICE_FILETRANSFER = 0x46,
67 YAHOO_SERVICE_VOICECHAT = 0x4A,
68 YAHOO_SERVICE_NOTIFY,
69 YAHOO_SERVICE_VERIFY,
70 YAHOO_SERVICE_P2PFILEXFER,
71 YAHOO_SERVICE_PEERTOPEER = 0x4F, /* Checks if P2P possible */
72 YAHOO_SERVICE_WEBCAM,
73 YAHOO_SERVICE_AUTHRESP = 0x54,
74 YAHOO_SERVICE_LIST,
75 YAHOO_SERVICE_AUTH = 0x57,
76 YAHOO_SERVICE_AUTHBUDDY = 0x6d,
77 YAHOO_SERVICE_ADDBUDDY = 0x83,
78 YAHOO_SERVICE_REMBUDDY,
79 YAHOO_SERVICE_IGNORECONTACT, /* > 1, 7, 13 < 1, 66, 13, 0 */
80 YAHOO_SERVICE_REJECTCONTACT,
81 YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */
82 YAHOO_SERVICE_Y7_PING = 0x8A,
83 YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1 */
84 YAHOO_SERVICE_CHATGOTO,
85 YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */
86 YAHOO_SERVICE_CHATLEAVE,
87 YAHOO_SERVICE_CHATEXIT = 0x9b,
88 YAHOO_SERVICE_CHATADDINVITE = 0x9d,
89 YAHOO_SERVICE_CHATLOGOUT = 0xa0,
90 YAHOO_SERVICE_CHATPING,
91 YAHOO_SERVICE_COMMENT = 0xa8,
92 YAHOO_SERVICE_GAME_INVITE = 0xb7,
93 YAHOO_SERVICE_STEALTH_PERM = 0xb9,
94 YAHOO_SERVICE_STEALTH_SESSION = 0xba,
95 YAHOO_SERVICE_AVATAR = 0xbc,
96 YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd,
97 YAHOO_SERVICE_PICTURE = 0xbe,
98 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
99 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
100 YAHOO_SERVICE_YAB_UPDATE = 0xc4,
101 YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5, /* YMSG13, key 13: 2 = invisible, 1 = visible */
102 YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6, /* YMSG13 */
103 YAHOO_SERVICE_PICTURE_STATUS = 0xc7, /* YMSG13, key 213: 0 = none, 1 = avatar, 2 = picture */
104 YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8,
105 YAHOO_SERVICE_AUDIBLE = 0xd0,
106 YAHOO_SERVICE_Y7_PHOTO_SHARING = 0xd2,
107 YAHOO_SERVICE_Y7_CONTACT_DETAILS = 0xd3, /* YMSG13 */
108 YAHOO_SERVICE_Y7_CHAT_SESSION = 0xd4,
109 YAHOO_SERVICE_Y7_AUTHORIZATION = 0xd6, /* YMSG13 */
110 YAHOO_SERVICE_Y7_FILETRANSFER = 0xdc, /* YMSG13 */
111 YAHOO_SERVICE_Y7_FILETRANSFERINFO, /* YMSG13 */
112 YAHOO_SERVICE_Y7_FILETRANSFERACCEPT, /* YMSG13 */
113 YAHOO_SERVICE_Y7_MINGLE = 0xe1, /* YMSG13 */
114 YAHOO_SERVICE_Y7_CHANGE_GROUP = 0xe7, /* YMSG13 */
115 YAHOO_SERVICE_MYSTERY = 0xef, /* Don't know what this is for */
116 YAHOO_SERVICE_Y8_STATUS = 0xf0, /* YMSG15 */
117 YAHOO_SERVICE_Y8_LIST = 0Xf1, /* YMSG15 */
118 YAHOO_SERVICE_MESSAGE_CONFIRM = 0xfb,
119 YAHOO_SERVICE_WEBLOGIN = 0x0226,
120 YAHOO_SERVICE_SMS_MSG = 0x02ea
123 enum yahoo_status {
124 YAHOO_STATUS_AVAILABLE = 0,
125 YAHOO_STATUS_BRB,
126 YAHOO_STATUS_BUSY,
127 YAHOO_STATUS_NOTATHOME,
128 YAHOO_STATUS_NOTATDESK,
129 YAHOO_STATUS_NOTINOFFICE,
130 YAHOO_STATUS_ONPHONE,
131 YAHOO_STATUS_ONVACATION,
132 YAHOO_STATUS_OUTTOLUNCH,
133 YAHOO_STATUS_STEPPEDOUT,
134 YAHOO_STATUS_INVISIBLE = 12,
135 YAHOO_STATUS_CUSTOM = 99,
136 YAHOO_STATUS_IDLE = 999,
137 YAHOO_STATUS_OFFLINE = 0x5a55aa56 /* don't ask */
140 enum ypacket_status {
141 YPACKET_STATUS_DISCONNECTED = -1,
142 YPACKET_STATUS_DEFAULT = 0,
143 YPACKET_STATUS_SERVERACK = 1,
144 YPACKET_STATUS_GAME = 0x2,
145 YPACKET_STATUS_AWAY = 0x4,
146 YPACKET_STATUS_CONTINUED = 0x5,
147 YPACKET_STATUS_INVISIBLE = 12,
148 YPACKET_STATUS_NOTIFY = 0x16, /* TYPING */
149 YPACKET_STATUS_WEBLOGIN = 0x5a55aa55,
150 YPACKET_STATUS_OFFLINE = 0x5a55aa56
153 #define YAHOO_STATUS_GAME 0x2 /* Games don't fit into the regular status model */
155 enum yahoo_login_status {
156 YAHOO_LOGIN_OK = 0,
157 YAHOO_LOGIN_LOGOFF = 1,
158 YAHOO_LOGIN_UNAME = 3,
159 YAHOO_LOGIN_PASSWD = 13,
160 YAHOO_LOGIN_LOCK = 14,
161 YAHOO_LOGIN_DUPL = 99,
162 YAHOO_LOGIN_SOCK = -1,
163 YAHOO_LOGIN_UNKNOWN = 999
166 enum yahoo_error {
167 E_UNKNOWN = -1,
168 E_CONNECTION = -2,
169 E_SYSTEM = -3,
170 E_CUSTOM = 0,
172 /* responses from ignore buddy */
173 E_IGNOREDUP = 2,
174 E_IGNORENONE = 3,
175 E_IGNORECONF = 12,
177 /* conference */
178 E_CONFNOTAVAIL = 20
181 enum yahoo_log_level {
182 YAHOO_LOG_NONE = 0,
183 YAHOO_LOG_FATAL,
184 YAHOO_LOG_ERR,
185 YAHOO_LOG_WARNING,
186 YAHOO_LOG_NOTICE,
187 YAHOO_LOG_INFO,
188 YAHOO_LOG_DEBUG
191 enum yahoo_file_transfer {
192 YAHOO_FILE_TRANSFER_INIT = 1,
193 YAHOO_FILE_TRANSFER_ACCEPT = 3,
194 YAHOO_FILE_TRANSFER_REJECT = 4,
195 YAHOO_FILE_TRANSFER_DONE = 5,
196 YAHOO_FILE_TRANSFER_RELAY,
197 YAHOO_FILE_TRANSFER_FAILED,
198 YAHOO_FILE_TRANSFER_UNKNOWN
201 #define YAHOO_PROTO_VER 0x0010
203 /* Yahoo style/color directives */
204 #define YAHOO_COLOR_BLACK "\033[30m"
205 #define YAHOO_COLOR_BLUE "\033[31m"
206 #define YAHOO_COLOR_LIGHTBLUE "\033[32m"
207 #define YAHOO_COLOR_GRAY "\033[33m"
208 #define YAHOO_COLOR_GREEN "\033[34m"
209 #define YAHOO_COLOR_PINK "\033[35m"
210 #define YAHOO_COLOR_PURPLE "\033[36m"
211 #define YAHOO_COLOR_ORANGE "\033[37m"
212 #define YAHOO_COLOR_RED "\033[38m"
213 #define YAHOO_COLOR_OLIVE "\033[39m"
214 #define YAHOO_COLOR_ANY "\033[#"
215 #define YAHOO_STYLE_ITALICON "\033[2m"
216 #define YAHOO_STYLE_ITALICOFF "\033[x2m"
217 #define YAHOO_STYLE_BOLDON "\033[1m"
218 #define YAHOO_STYLE_BOLDOFF "\033[x1m"
219 #define YAHOO_STYLE_UNDERLINEON "\033[4m"
220 #define YAHOO_STYLE_UNDERLINEOFF "\033[x4m"
221 #define YAHOO_STYLE_URLON "\033[lm"
222 #define YAHOO_STYLE_URLOFF "\033[xlm"
224 enum yahoo_connection_type {
225 YAHOO_CONNECTION_PAGER = 0,
226 YAHOO_CONNECTION_FT,
227 YAHOO_CONNECTION_YAB,
228 YAHOO_CONNECTION_WEBCAM_MASTER,
229 YAHOO_CONNECTION_WEBCAM,
230 YAHOO_CONNECTION_CHATCAT,
231 YAHOO_CONNECTION_SEARCH,
232 YAHOO_CONNECTION_AUTH
235 enum yahoo_webcam_direction_type {
236 YAHOO_WEBCAM_DOWNLOAD = 0,
237 YAHOO_WEBCAM_UPLOAD
240 enum yahoo_stealth_visibility_type {
241 YAHOO_STEALTH_DEFAULT = 0,
242 YAHOO_STEALTH_ONLINE,
243 YAHOO_STEALTH_PERM_OFFLINE
246 /* chat member attribs */
247 #define YAHOO_CHAT_MALE 0x8000
248 #define YAHOO_CHAT_FEMALE 0x10000
249 #define YAHOO_CHAT_FEMALE 0x10000
250 #define YAHOO_CHAT_DUNNO 0x400
251 #define YAHOO_CHAT_WEBCAM 0x10
253 enum yahoo_webcam_conn_type { Y_WCM_DIALUP, Y_WCM_DSL, Y_WCM_T1 };
255 struct yahoo_webcam {
256 int direction; /* Uploading or downloading */
257 int conn_type; /* 0=Dialup, 1=DSL/Cable, 2=T1/Lan */
259 char *user; /* user we are viewing */
260 char *server; /* webcam server to connect to */
261 int port; /* webcam port to connect on */
262 char *key; /* key to connect to the server with */
263 char *description; /* webcam description */
264 char *my_ip; /* own ip number */
267 struct yahoo_webcam_data {
268 unsigned int data_size;
269 unsigned int to_read;
270 unsigned int timestamp;
271 unsigned char packet_type;
274 struct yahoo_data {
275 char *user;
276 char *password;
278 char *cookie_y;
279 char *cookie_t;
280 char *cookie_c;
281 char *cookie_b;
282 char *login_cookie;
283 char *crumb;
284 char *seed;
286 YList *buddies;
287 YList *ignore;
288 YList *identities;
289 char *login_id;
291 int current_status;
292 int initial_status;
293 int logged_in;
295 int session_id;
297 int client_id;
299 char *rawbuddylist;
300 char *ignorelist;
302 void *server_settings;
304 struct yahoo_process_status_entry *half_user;
307 struct yab {
308 int yid;
309 char *id;
310 char *fname;
311 char *lname;
312 char *nname;
313 char *email;
314 char *hphone;
315 char *wphone;
316 char *mphone;
317 int dbid;
320 struct yahoo_buddy {
321 char *group;
322 char *id;
323 char *real_name;
324 struct yab *yab_entry;
327 enum yahoo_search_type {
328 YAHOO_SEARCH_KEYWORD = 0,
329 YAHOO_SEARCH_YID,
330 YAHOO_SEARCH_NAME
333 enum yahoo_search_gender {
334 YAHOO_GENDER_NONE = 0,
335 YAHOO_GENDER_MALE,
336 YAHOO_GENDER_FEMALE
339 enum yahoo_search_agerange {
340 YAHOO_AGERANGE_NONE = 0
343 struct yahoo_found_contact {
344 char *id;
345 char *gender;
346 char *location;
347 int age;
348 int online;
352 * Function pointer to be passed to http get/post and send file
354 typedef void (*yahoo_get_fd_callback) (int id, void *fd, int error,
355 void *data);
358 * Function pointer to be passed to yahoo_get_url_handle
360 typedef void (*yahoo_get_url_handle_callback) (int id, void *fd,
361 int error, const char *filename, unsigned long size,
362 void *data);
364 struct yahoo_chat_member {
365 char *id;
366 int age;
367 int attribs;
368 char *alias;
369 char *location;
372 struct yahoo_process_status_entry {
373 char *name; /* 7 name */
374 int state; /* 10 state */
375 int flags; /* 13 flags, bit 0 = pager, bit 1 = chat, bit 2 = game */
376 int mobile; /* 60 mobile */
377 char *msg; /* 19 custom status message */
378 int away; /* 47 away (or invisible) */
379 int buddy_session; /* 11 state */
380 int f17; /* 17 in chat? then what about flags? */
381 int idle; /* 137 seconds idle */
382 int f138; /* 138 state */
383 char *f184; /* 184 state */
384 int f192; /* 192 state */
385 int f10001; /* 10001 state */
386 int f10002; /* 10002 state */
387 int f198; /* 198 state */
388 char *f197; /* 197 state */
389 char *f205; /* 205 state */
390 int f213; /* 213 state */
393 #ifdef __cplusplus
395 #endif
396 #endif