source: protocols/yahoo/yahoo2_callbacks.h @ 664bac3

Last change on this file since 664bac3 was 6f10697, checked in by dequis <dx@…>, at 2015-01-16T19:50:23Z

Fix incorrect Free Software Foundation address

  • Property mode set to 100644
File size: 24.7 KB
RevLine 
[b7d3cc34]1/*
2 * libyahoo2: yahoo2_callbacks.h
3 *
4 * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
5 *
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.
10 *
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.
15 *
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
[6f10697]18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
[b7d3cc34]19 *
20 */
21
22/*
23 * The functions in this file *must* be defined in your client program
24 * If you want to use a callback structure instead of direct functions,
25 * then you must define USE_STRUCT_CALLBACKS in all files that #include
26 * this one.
27 *
28 * Register the callback structure by calling yahoo_register_callbacks -
29 * declared in this file and defined in libyahoo2.c
30 */
31
32#ifndef YAHOO2_CALLBACKS_H
33#define YAHOO2_CALLBACKS_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#include "yahoo2_types.h"
40
41/*
42 * yahoo2_callbacks.h
43 *
44 * Callback interface for libyahoo2
45 */
46
[c36f73b]47        typedef enum {
48                YAHOO_INPUT_READ = 1 << 0,
49                YAHOO_INPUT_WRITE = 1 << 1,
50                YAHOO_INPUT_EXCEPTION = 1 << 2
51        } yahoo_input_condition;
[b7d3cc34]52
53/*
54 * A callback function called when an asynchronous connect completes.
55 *
56 * Params:
[9034ba0]57 *     fd    - The file descriptor object that has been connected, or NULL on
58 *             error
[b7d3cc34]59 *     error - The value of errno set by the call to connect or 0 if no error
60 *             Set both fd and error to 0 if the connect was cancelled by the
61 *             user
62 *     callback_data - the callback_data passed to the ext_yahoo_connect_async
63 *             function
64 */
[9034ba0]65        typedef void (*yahoo_connect_callback) (void *fd, int error,
66                void *callback_data);
[b7d3cc34]67
68/*
69 * The following functions need to be implemented in the client
70 * interface.  They will be called by the library when each
71 * event occurs.
72 */
73
74/*
75 * should we use a callback structure or directly call functions
76 * if you want the structure, you *must* define USE_STRUCT_CALLBACKS
77 * both when you compile the library, and when you compile your code
78 * that uses the library
79 */
80
81#ifdef USE_STRUCT_CALLBACKS
82#define YAHOO_CALLBACK_TYPE(x)  (*x)
83struct yahoo_callbacks {
84#else
85#define YAHOO_CALLBACK_TYPE(x)  x
86#endif
87
88/*
89 * Name: ext_yahoo_login_response
90 *      Called when the login process is complete
91 * Params:
92 *      id   - the id that identifies the server connection
93 *      succ - enum yahoo_login_status
94 *      url  - url to reactivate account if locked
95 */
[c36f73b]96        void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response) (int id, int succ,
97                const char *url);
[b7d3cc34]98
99/*
100 * Name: ext_yahoo_got_buddies
101 *      Called when the contact list is got from the server
102 * Params:
103 *      id   - the id that identifies the server connection
104 *      buds - the buddy list
105 */
[c36f73b]106        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies) (int id, YList *buds);
[b7d3cc34]107
108/*
109 * Name: ext_yahoo_got_ignore
110 *      Called when the ignore list is got from the server
111 * Params:
112 *      id   - the id that identifies the server connection
113 *      igns - the ignore list
114 */
[3cd37d7]115//      void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);
[b7d3cc34]116
117/*
118 * Name: ext_yahoo_got_identities
119 *      Called when the contact list is got from the server
120 * Params:
121 *      id   - the id that identifies the server connection
122 *      ids  - the identity list
123 */
[c36f73b]124        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities) (int id, YList *ids);
[b7d3cc34]125
126/*
127 * Name: ext_yahoo_got_cookies
128 *      Called when the cookie list is got from the server
129 * Params:
130 *      id   - the id that identifies the server connection
131 */
[c36f73b]132        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies) (int id);
[b7d3cc34]133
[cfc8d58]134/*
135 * Name: ext_yahoo_got_ping
136 *      Called when the ping packet is received from the server
137 * Params:
138 *      id   - the id that identifies the server connection
139 *  errormsg - optional error message
140 */
[c36f73b]141        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping) (int id,
142                const char *errormsg);
[b7d3cc34]143
144/*
145 * Name: ext_yahoo_status_changed
146 *      Called when remote user's status changes.
147 * Params:
148 *      id   - the id that identifies the server connection
149 *      who  - the handle of the remote user
150 *      stat - status code (enum yahoo_status)
151 *      msg  - the message if stat == YAHOO_STATUS_CUSTOM
152 *      away - whether the contact is away or not (YAHOO_STATUS_CUSTOM)
[cfc8d58]153 *      idle - this is the number of seconds he is idle [if he is idle]
154 *      mobile - this is set for mobile users/buddies
155 *      TODO: add support for pager, chat, and game states
[b7d3cc34]156 */
[c36f73b]157        void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed) (int id,
158                const char *who, int stat, const char *msg, int away, int idle,
159                int mobile);
[b7d3cc34]160
[c36f73b]161/*
162 * Name: ext_yahoo_got_buzz
163 *      Called when remote user sends you a buzz.
164 * Params:
165 *      id   - the id that identifies the server connection
166 *      me   - the identity the message was sent to
167 *      who  - the handle of the remote user
168 *      tm   - timestamp of message if offline
169 */
170        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buzz) (int id, const char *me,
171                const char *who, long tm);
[b7d3cc34]172
173/*
174 * Name: ext_yahoo_got_im
175 *      Called when remote user sends you a message.
176 * Params:
177 *      id   - the id that identifies the server connection
[cfc8d58]178 *      me   - the identity the message was sent to
[b7d3cc34]179 *      who  - the handle of the remote user
180 *      msg  - the message - NULL if stat == 2
181 *      tm   - timestamp of message if offline
182 *      stat - message status - 0
183 *                              1
184 *                              2 == error sending message
185 *                              5
186 *      utf8 - whether the message is encoded as utf8 or not
187 */
[c36f73b]188        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im) (int id, const char *me,
189                const char *who, const char *msg, long tm, int stat, int utf8);
[b7d3cc34]190
191/*
192 * Name: ext_yahoo_got_conf_invite
193 *      Called when remote user sends you a conference invitation.
194 * Params:
195 *      id   - the id that identifies the server connection
[cfc8d58]196 *      me   - the identity the invitation was sent to
[b7d3cc34]197 *      who  - the user inviting you
198 *      room - the room to join
199 *      msg  - the message
200 *      members - the initial members of the conference (null terminated list)
201 */
[c36f73b]202        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite) (int id,
203                const char *me, const char *who, const char *room,
204                const char *msg, YList *members);
[b7d3cc34]205
206/*
207 * Name: ext_yahoo_conf_userdecline
208 *      Called when someone declines to join the conference.
209 * Params:
210 *      id   - the id that identifies the server connection
[cfc8d58]211 *      me   - the identity in the conference
[b7d3cc34]212 *      who  - the user who has declined
213 *      room - the room
214 *      msg  - the declining message
215 */
[c36f73b]216        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline) (int id,
217                const char *me, const char *who, const char *room,
218                const char *msg);
[b7d3cc34]219
220/*
221 * Name: ext_yahoo_conf_userjoin
222 *      Called when someone joins the conference.
223 * Params:
224 *      id   - the id that identifies the server connection
[cfc8d58]225 *      me   - the identity in the conference
[b7d3cc34]226 *      who  - the user who has joined
227 *      room - the room joined
228 */
[c36f73b]229        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin) (int id,
230                const char *me, const char *who, const char *room);
[b7d3cc34]231
232/*
233 * Name: ext_yahoo_conf_userleave
234 *      Called when someone leaves the conference.
235 * Params:
236 *      id   - the id that identifies the server connection
[cfc8d58]237 *      me   - the identity in the conference
[b7d3cc34]238 *      who  - the user who has left
239 *      room - the room left
240 */
[c36f73b]241        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave) (int id,
242                const char *me, const char *who, const char *room);
[b7d3cc34]243
244/*
245 * Name: ext_yahoo_chat_cat_xml
[cfc8d58]246 *      Called when ?
[b7d3cc34]247 * Params:
248 *      id      - the id that identifies the server connection
[cfc8d58]249 *      xml     - ?
[b7d3cc34]250 */
[c36f73b]251        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml) (int id,
252                const char *xml);
[b7d3cc34]253
254/*
255 * Name: ext_yahoo_chat_join
256 *      Called when joining the chatroom.
257 * Params:
258 *      id      - the id that identifies the server connection
[cfc8d58]259 *      me   - the identity in the chatroom
[b7d3cc34]260 *      room    - the room joined, used in all other chat calls, freed by
261 *                library after call
262 *      topic   - the topic of the room, freed by library after call
263 *      members - the initial members of the chatroom (null terminated YList
264 *                of yahoo_chat_member's) Must be freed by the client
[9034ba0]265 *      fd      - the object where the connection is coming from (for tracking)
[b7d3cc34]266 */
[c36f73b]267        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join) (int id, const char *me,
[9034ba0]268                const char *room, const char *topic, YList *members, void *fd);
[b7d3cc34]269
270/*
271 * Name: ext_yahoo_chat_userjoin
272 *      Called when someone joins the chatroom.
273 * Params:
274 *      id   - the id that identifies the server connection
[cfc8d58]275 *      me   - the identity in the chatroom
[b7d3cc34]276 *      room - the room joined
277 *      who  - the user who has joined, Must be freed by the client
278 */
[c36f73b]279        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin) (int id,
280                const char *me, const char *room,
281                struct yahoo_chat_member *who);
[b7d3cc34]282
283/*
284 * Name: ext_yahoo_chat_userleave
285 *      Called when someone leaves the chatroom.
286 * Params:
287 *      id   - the id that identifies the server connection
[cfc8d58]288 *      me   - the identity in the chatroom
[b7d3cc34]289 *      room - the room left
290 *      who  - the user who has left (Just the User ID)
291 */
[c36f73b]292        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave) (int id,
293                const char *me, const char *room, const char *who);
[b7d3cc34]294
295/*
296 * Name: ext_yahoo_chat_message
297 *      Called when someone messages in the chatroom.
298 * Params:
299 *      id   - the id that identifies the server connection
[cfc8d58]300 *      me   - the identity in the chatroom
[b7d3cc34]301 *      room - the room
302 *      who  - the user who messaged (Just the user id)
303 *      msg  - the message
304 *      msgtype  - 1 = Normal message
305 *                 2 = /me type message
306 *      utf8 - whether the message is utf8 encoded or not
307 */
[c36f73b]308        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message) (int id,
309                const char *me, const char *who, const char *room,
310                const char *msg, int msgtype, int utf8);
[b7d3cc34]311
312/*
313 *
314 * Name: ext_yahoo_chat_yahoologout
315 *      called when yahoo disconnects your chat session
316 *      Note this is called whenver a disconnect happens, client or server
317 *      requested. Care should be taken to make sure you know the origin
318 *      of the disconnect request before doing anything here (auto-join's etc)
319 * Params:
320 *      id   - the id that identifies this connection
[cfc8d58]321 *      me   - the identity in the chatroom
[b7d3cc34]322 * Returns:
323 *      nothing.
324 */
[c36f73b]325        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout) (int id,
326                const char *me);
[b7d3cc34]327
328/*
329 *
330 * Name: ext_yahoo_chat_yahooerror
331 *      called when yahoo sends back an error to you
332 *      Note this is called whenver chat message is sent into a room
333 *      in error (fd not connected, room doesn't exists etc)
334 *      Care should be taken to make sure you know the origin
335 *      of the error before doing anything about it.
336 * Params:
337 *      id   - the id that identifies this connection
[cfc8d58]338 *      me   - the identity in the chatroom
[b7d3cc34]339 * Returns:
340 *      nothing.
341 */
[c36f73b]342        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror) (int id,
343                const char *me);
[b7d3cc34]344
345/*
346 * Name: ext_yahoo_conf_message
347 *      Called when someone messages in the conference.
348 * Params:
349 *      id   - the id that identifies the server connection
[cfc8d58]350 *      me   - the identity the conf message was sent to
[b7d3cc34]351 *      who  - the user who messaged
352 *      room - the room
353 *      msg  - the message
354 *      utf8 - whether the message is utf8 encoded or not
355 */
[c36f73b]356        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message) (int id,
357                const char *me, const char *who, const char *room,
358                const char *msg, int utf8);
[b7d3cc34]359
360/*
361 * Name: ext_yahoo_got_file
362 *      Called when someone sends you a file
363 * Params:
364 *      id   - the id that identifies the server connection
[cfc8d58]365 *      me   - the identity the file was sent to
[b7d3cc34]366 *      who  - the user who sent the file
367 *      msg  - the message
368 *      fname- the file name if direct transfer
369 *      fsize- the file size if direct transfer
[9034ba0]370 *      trid - transfer id. Unique for this transfer
371 *
372 * NOTE: Subsequent callbacks for file transfer do not send all of this
373 * information again since it is wasteful. Implementations are expected to
374 * save this information and supply it as callback data when the file or
375 * confirmation is sent
[b7d3cc34]376 */
[9034ba0]377        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file) (int id, const char *me,
378                const char *who, const char *msg, const char *fname,
379                unsigned long fesize, char *trid);
[b7d3cc34]380
[ba16895]381/*
[9034ba0]382 * Name: ext_yahoo_got_ft_data
383 *      Called multiple times when parts of the file are received
[ba16895]384 * Params:
385 *      id   - the id that identifies the server connection
[9034ba0]386 *      in   - The data
387 *      len  - Length of the data
388 *      data - callback data
[ba16895]389 */
[9034ba0]390        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ft_data) (int id,
391                const unsigned char *in, int len, void *data);
[ba16895]392
[9034ba0]393/*
394 * Name: ext_yahoo_file_transfer_done
395 *      File transfer is done
396 * Params:
397 *      id     - the id that identifies the server connection
398 *      result - To notify if it finished successfully or with a failure
399 *      data   - callback data
400 */
401        void YAHOO_CALLBACK_TYPE(ext_yahoo_file_transfer_done) (int id,
402                int result, void *data);
[ba16895]403
[b7d3cc34]404/*
405 * Name: ext_yahoo_contact_added
406 *      Called when a contact is added to your list
407 * Params:
408 *      id   - the id that identifies the server connection
409 *      myid - the identity he was added to
410 *      who  - who was added
411 *      msg  - any message sent
412 */
[c36f73b]413        void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added) (int id,
414                const char *myid, const char *who, const char *msg);
[b7d3cc34]415
416/*
417 * Name: ext_yahoo_rejected
418 *      Called when a contact rejects your add
419 * Params:
420 *      id   - the id that identifies the server connection
421 *      who  - who rejected you
422 *      msg  - any message sent
423 */
[c36f73b]424        void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected) (int id, const char *who,
425                const char *msg);
[b7d3cc34]426
427/*
428 * Name: ext_yahoo_typing_notify
429 *      Called when remote user starts or stops typing.
430 * Params:
431 *      id   - the id that identifies the server connection
[cfc8d58]432 *      me   - the handle of the identity the notification is sent to
[b7d3cc34]433 *      who  - the handle of the remote user
434 *      stat - 1 if typing, 0 if stopped typing
435 */
[c36f73b]436        void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify) (int id,
437                const char *me, const char *who, int stat);
[b7d3cc34]438
439/*
440 * Name: ext_yahoo_game_notify
441 *      Called when remote user starts or stops a game.
442 * Params:
443 *      id   - the id that identifies the server connection
[cfc8d58]444 *      me   - the handle of the identity the notification is sent to
[b7d3cc34]445 *      who  - the handle of the remote user
446 *      stat - 1 if game, 0 if stopped gaming
[9034ba0]447 *      msg  - game description and/or other text
[b7d3cc34]448 */
[9034ba0]449        void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify) (int id, const char *me,
450                const char *who, int stat, const char *msg);
[b7d3cc34]451
452/*
453 * Name: ext_yahoo_mail_notify
454 *      Called when you receive mail, or with number of messages
455 * Params:
456 *      id   - the id that identifies the server connection
457 *      from - who the mail is from - NULL if only mail count
458 *      subj - the subject of the mail - NULL if only mail count
459 *      cnt  - mail count - 0 if new mail notification
460 */
[c36f73b]461        void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify) (int id,
462                const char *from, const char *subj, int cnt);
[b7d3cc34]463
464/*
465 * Name: ext_yahoo_system_message
466 *      System message
467 * Params:
468 *      id   - the id that identifies the server connection
[9034ba0]469 *      me   - the handle of the identity the notification is sent to
470 *      who  - the source of the system message (there are different types)
[b7d3cc34]471 *      msg  - the message
472 */
[9034ba0]473        void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message) (int id,
474                const char *me, const char *who, const char *msg);
[b7d3cc34]475
[cfc8d58]476/*
477 * Name: ext_yahoo_got_buddyicon
478 *      Buddy icon received
479 * Params:
480 *      id - the id that identifies the server connection
481 *      me - the handle of the identity the notification is sent to
482 *      who - the person the buddy icon is for
483 *      url - the url to use to load the icon
484 *      checksum - the checksum of the icon content
485 */
[c36f73b]486        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon) (int id,
487                const char *me, const char *who, const char *url, int checksum);
[b7d3cc34]488
[cfc8d58]489/*
490 * Name: ext_yahoo_got_buddyicon_checksum
491 *      Buddy icon checksum received
492 * Params:
493 *      id - the id that identifies the server connection
494 *      me - the handle of the identity the notification is sent to
495 *      who - the yahoo id of the buddy icon checksum is for
496 *      checksum - the checksum of the icon content
497 */
[c36f73b]498        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum) (int id,
499                const char *me, const char *who, int checksum);
[b7d3cc34]500
[cfc8d58]501/*
502 * Name: ext_yahoo_got_buddyicon_request
503 *      Buddy icon request received
504 * Params:
505 *      id - the id that identifies the server connection
506 *      me - the handle of the identity the notification is sent to
507 *      who - the yahoo id of the buddy that requested the buddy icon
508 */
[c36f73b]509        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request) (int id,
510                const char *me, const char *who);
[b7d3cc34]511
[cfc8d58]512/*
513 * Name: ext_yahoo_got_buddyicon_request
514 *      Buddy icon request received
515 * Params:
516 *      id - the id that identifies the server connection
517 *      url - remote url, the uploaded buddy icon can be fetched from
518 */
[c36f73b]519        void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded) (int id,
520                const char *url);
[b7d3cc34]521
522/*
523 * Name: ext_yahoo_got_webcam_image
524 *      Called when you get a webcam update
525 *      An update can either be receiving an image, a part of an image or
526 *      just an update with a timestamp
527 * Params:
528 *      id         - the id that identifies the server connection
529 *      who        - the user who's webcam we're viewing
530 *      image      - image data
531 *      image_size - length of the image in bytes
532 *      real_size  - actual length of image data
533 *      timestamp  - milliseconds since the webcam started
534 *
535 *      If the real_size is smaller then the image_size then only part of
536 *      the image has been read. This function will keep being called till
537 *      the total amount of bytes in image_size has been read. The image
538 *      received is in JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1).
539 *      The size of the image will be either 160x120 or 320x240.
540 *      Each webcam image contains a timestamp. This timestamp should be
541 *      used to keep the image in sync since some images can take longer
542 *      to transport then others. When image_size is 0 we can still receive
543 *      a timestamp to stay in sync
544 */
[c36f73b]545        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image) (int id,
546                const char *who, const unsigned char *image,
547                unsigned int image_size, unsigned int real_size,
[b7d3cc34]548                unsigned int timestamp);
549
550/*
551 * Name: ext_yahoo_webcam_invite
552 *      Called when you get a webcam invitation
553 * Params:
554 *      id   - the id that identifies the server connection
[cfc8d58]555 *      me   - identity the invitation is to
[b7d3cc34]556 *      from - who the invitation is from
557 */
[c36f73b]558        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite) (int id,
559                const char *me, const char *from);
[b7d3cc34]560
561/*
562 * Name: ext_yahoo_webcam_invite_reply
563 *      Called when you get a response to a webcam invitation
564 * Params:
565 *      id   - the id that identifies the server connection
[cfc8d58]566 *      me   - identity the invitation response is to
[b7d3cc34]567 *      from - who the invitation response is from
568 *      accept - 0 (decline), 1 (accept)
569 */
[c36f73b]570        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply) (int id,
571                const char *me, const char *from, int accept);
[b7d3cc34]572
573/*
574 * Name: ext_yahoo_webcam_closed
575 *      Called when the webcam connection closed
576 * Params:
577 *      id   - the id that identifies the server connection
578 *      who  - the user who we where connected to
579 *      reason - reason why the connection closed
580 *               1 = user stopped broadcasting
581 *               2 = user cancelled viewing permission
582 *               3 = user declines permission
583 *               4 = user does not have webcam online
584 */
[c36f73b]585        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed) (int id,
586                const char *who, int reason);
[b7d3cc34]587
588/*
589 * Name: ext_yahoo_got_search_result
590 *      Called when the search result received from server
591 * Params:
592 *      id       - the id that identifies the server connection
593 *      found    - total number of results returned in the current result set
594 *      start    - offset from where the current result set starts
595 *      total    - total number of results available (start + found <= total)
596 *      contacts - the list of results as a YList of yahoo_found_contact
597 *                 these will be freed after this function returns, so
598 *                 if you need to use the information, make a copy
599 */
[c36f73b]600        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result) (int id,
601                int found, int start, int total, YList *contacts);
[b7d3cc34]602
603/*
604 * Name: ext_yahoo_error
605 *      Called on error.
606 * Params:
607 *      id   - the id that identifies the server connection
608 *      err  - the error message
609 *      fatal- whether this error is fatal to the connection or not
[cfc8d58]610 *      num  - Which error is this
[b7d3cc34]611 */
[c36f73b]612        void YAHOO_CALLBACK_TYPE(ext_yahoo_error) (int id, const char *err,
613                int fatal, int num);
[b7d3cc34]614
615/*
616 * Name: ext_yahoo_webcam_viewer
617 *      Called when a viewer disconnects/connects/requests to connect
618 * Params:
619 *      id  - the id that identifies the server connection
620 *      who - the viewer
621 *      connect - 0=disconnect 1=connect 2=request
622 */
[c36f73b]623        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer) (int id,
624                const char *who, int connect);
[b7d3cc34]625
626/*
627 * Name: ext_yahoo_webcam_data_request
628 *      Called when you get a request for webcam images
629 * Params:
630 *      id   - the id that identifies the server connection
631 *      send - whether to send images or not
632 */
[c36f73b]633        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request) (int id,
634                int send);
[b7d3cc34]635
636/*
637 * Name: ext_yahoo_log
638 *      Called to log a message.
639 * Params:
640 *      fmt  - the printf formatted message
641 * Returns:
642 *      0
643 */
[c36f73b]644        int YAHOO_CALLBACK_TYPE(ext_yahoo_log) (const char *fmt, ...);
[b7d3cc34]645
646/*
647 * Name: ext_yahoo_add_handler
648 *      Add a listener for the fd.  Must call yahoo_read_ready
649 *      when a YAHOO_INPUT_READ fd is ready and yahoo_write_ready
650 *      when a YAHOO_INPUT_WRITE fd is ready.
651 * Params:
652 *      id   - the id that identifies the server connection
[9034ba0]653 *      fd   - the fd object on which to listen
[b7d3cc34]654 *      cond - the condition on which to call the callback
655 *      data - callback data to pass to yahoo_*_ready
656 *     
657 * Returns: a tag to be used when removing the handler
658 */
[9034ba0]659        int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, void *fd,
[c36f73b]660                yahoo_input_condition cond, void *data);
[b7d3cc34]661
662/*
663 * Name: ext_yahoo_remove_handler
664 *      Remove the listener for the fd.
665 * Params:
666 *      id   - the id that identifies the connection
667 *      tag  - the handler tag to remove
668 */
[c36f73b]669        void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler) (int id, int tag);
[b7d3cc34]670
671/*
672 * Name: ext_yahoo_connect
673 *      Connect to a host:port
674 * Params:
675 *      host - the host to connect to
676 *      port - the port to connect on
677 * Returns:
678 *      a unix file descriptor to the socket
679 */
[3cd37d7]680//      int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);
[b7d3cc34]681
682/*
683 * Name: ext_yahoo_connect_async
[c36f73b]684 *      Connect to a host:port asynchronously. This function should return
[b7d3cc34]685 *      immediately returing a tag used to identify the connection handler,
686 *      or a pre-connect error (eg: host name lookup failure).
687 *      Once the connect completes (successfully or unsuccessfully), callback
688 *      should be called (see the signature for yahoo_connect_callback).
689 *      The callback may safely be called before this function returns, but
690 *      it should not be called twice.
691 * Params:
692 *      id   - the id that identifies this connection
693 *      host - the host to connect to
694 *      port - the port to connect on
695 *      callback - function to call when connect completes
696 *      callback_data - data to pass to the callback function
[9034ba0]697 *      use_ssl - Whether we need an SSL connection
[b7d3cc34]698 * Returns:
[9034ba0]699 *      a tag signifying the connection attempt
[b7d3cc34]700 */
[c36f73b]701        int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async) (int id,
702                const char *host, int port, yahoo_connect_callback callback,
[9034ba0]703                void *callback_data, int use_ssl);
704
705/*
706 * Name: ext_yahoo_get_ip_addr
707 *      get IP Address for a domain name
708 * Params:
709 *      domain - Domain name
710 * Returns:
711 *      Newly allocated string containing the IP Address in IPv4 notation
712 */
713        char *YAHOO_CALLBACK_TYPE(ext_yahoo_get_ip_addr) (const char *domain);
714
715/*
716 * Name: ext_yahoo_write
717 *      Write data from the buffer into the socket for the specified connection
718 * Params:
719 *      fd  - the file descriptor object that identifies this connection
720 *      buf - Buffer to write the data from
721 *      len - Length of the data
722 * Returns:
723 *      Number of bytes written or -1 for error
724 */
725        int YAHOO_CALLBACK_TYPE(ext_yahoo_write) (void *fd, char *buf, int len);
726
727/*
728 * Name: ext_yahoo_read
729 *      Read data into a buffer from socket for the specified connection
730 * Params:
731 *      fd  - the file descriptor object that identifies this connection
732 *      buf - Buffer to read the data into
733 *      len - Max length to read
734 * Returns:
735 *      Number of bytes read or -1 for error
736 */
737        int YAHOO_CALLBACK_TYPE(ext_yahoo_read) (void *fd, char *buf, int len);
738
739/*
740 * Name: ext_yahoo_close
741 *      Close the file descriptor object and free its resources. Libyahoo2 will not
742 *      use this object again.
743 * Params:
744 *      fd  - the file descriptor object that identifies this connection
745 * Returns:
746 *      Nothing
747 */
748        void YAHOO_CALLBACK_TYPE(ext_yahoo_close) (void *fd);
749
750/*
751 * Name: ext_yahoo_got_buddy_change_group
752 *      Acknowledgement of buddy changing group
753 * Params:
754 *      id: client id
755 *      me: The user
756 *      who: Buddy name
757 *      old_group: Old group name
758 *      new_group: New group name
759 * Returns:
760 *      Nothing
761 */
762        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddy_change_group) (int id,
763                const char *me, const char *who, const char *old_group,
764                const char *new_group);
[b7d3cc34]765
766#ifdef USE_STRUCT_CALLBACKS
767};
768
769/*
770 * if using a callback structure, call yahoo_register_callbacks
771 * before doing anything else
772 */
[c36f73b]773void yahoo_register_callbacks(struct yahoo_callbacks *tyc);
[cfc8d58]774
[b7d3cc34]775#undef YAHOO_CALLBACK_TYPE
776
777#endif
778
779#ifdef __cplusplus
780}
781#endif
782
783#endif
Note: See TracBrowser for help on using the repository browser.