source: protocols/yahoo/yahoo2_callbacks.h @ 8c3637b

Last change on this file since 8c3637b was 5ebff60, checked in by dequis <dx@…>, at 2015-02-20T22:50:54Z

Reindent everything to K&R style with tabs

Used uncrustify, with the configuration file in ./doc/uncrustify.cfg

Commit author set to "Indent <please@…>" so that it's easier to
skip while doing git blame.

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