source: protocols/yahoo/yahoo2_callbacks.h @ 56b57b1a

Last change on this file since 56b57b1a 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
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
[5ebff60]47typedef 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.
[5ebff60]55 *
[b7d3cc34]56 * Params:
[5ebff60]57 *     fd    - The file descriptor object that has been connected, or NULL on
[9034ba0]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 */
[5ebff60]65typedef 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
[5ebff60]74/*
[b7d3cc34]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
[5ebff60]82#define YAHOO_CALLBACK_TYPE(x)  (*x)
[b7d3cc34]83struct yahoo_callbacks {
84#else
[5ebff60]85#define YAHOO_CALLBACK_TYPE(x)  x
[b7d3cc34]86#endif
87
88/*
89 * Name: ext_yahoo_login_response
[5ebff60]90 *      Called when the login process is complete
[b7d3cc34]91 * Params:
[5ebff60]92 *      id   - the id that identifies the server connection
93 *      succ - enum yahoo_login_status
94 *      url  - url to reactivate account if locked
[b7d3cc34]95 */
[c36f73b]96        void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response) (int id, int succ,
[5ebff60]97                                                            const char *url);
[b7d3cc34]98
99/*
100 * Name: ext_yahoo_got_buddies
[5ebff60]101 *      Called when the contact list is got from the server
[b7d3cc34]102 * Params:
[5ebff60]103 *      id   - the id that identifies the server connection
104 *      buds - the buddy list
[b7d3cc34]105 */
[c36f73b]106        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies) (int id, YList *buds);
[b7d3cc34]107
108/*
109 * Name: ext_yahoo_got_ignore
[5ebff60]110 *      Called when the ignore list is got from the server
[b7d3cc34]111 * Params:
[5ebff60]112 *      id   - the id that identifies the server connection
113 *      igns - the ignore list
[b7d3cc34]114 */
[3cd37d7]115//      void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);
[b7d3cc34]116
117/*
118 * Name: ext_yahoo_got_identities
[5ebff60]119 *      Called when the contact list is got from the server
[b7d3cc34]120 * Params:
[5ebff60]121 *      id   - the id that identifies the server connection
122 *      ids  - the identity list
[b7d3cc34]123 */
[c36f73b]124        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities) (int id, YList *ids);
[b7d3cc34]125
126/*
127 * Name: ext_yahoo_got_cookies
[5ebff60]128 *      Called when the cookie list is got from the server
[b7d3cc34]129 * Params:
[5ebff60]130 *      id   - the id that identifies the server connection
[b7d3cc34]131 */
[c36f73b]132        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies) (int id);
[b7d3cc34]133
[cfc8d58]134/*
135 * Name: ext_yahoo_got_ping
[5ebff60]136 *      Called when the ping packet is received from the server
[cfc8d58]137 * Params:
[5ebff60]138 *      id   - the id that identifies the server connection
[cfc8d58]139 *  errormsg - optional error message
140 */
[c36f73b]141        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping) (int id,
[5ebff60]142                                                      const char *errormsg);
[b7d3cc34]143
144/*
145 * Name: ext_yahoo_status_changed
[5ebff60]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]
[cfc8d58]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,
[5ebff60]158                                                            const char *who, int stat, const char *msg, int away,
159                                                            int idle,
160                                                            int mobile);
[b7d3cc34]161
[c36f73b]162/*
163 * Name: ext_yahoo_got_buzz
[5ebff60]164 *      Called when remote user sends you a buzz.
[c36f73b]165 * Params:
[5ebff60]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
[c36f73b]170 */
171        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buzz) (int id, const char *me,
[5ebff60]172                                                      const char *who, long tm);
[b7d3cc34]173
174/*
175 * Name: ext_yahoo_got_im
[5ebff60]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
[b7d3cc34]188 */
[c36f73b]189        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im) (int id, const char *me,
[5ebff60]190                                                    const char *who, const char *msg, long tm, int stat, int utf8);
[b7d3cc34]191
192/*
193 * Name: ext_yahoo_got_conf_invite
[5ebff60]194 *      Called when remote user sends you a conference invitation.
[b7d3cc34]195 * Params:
[5ebff60]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
[b7d3cc34]201 *      members - the initial members of the conference (null terminated list)
202 */
[c36f73b]203        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite) (int id,
[5ebff60]204                                                             const char *me, const char *who, const char *room,
205                                                             const char *msg, YList *members);
[b7d3cc34]206
207/*
208 * Name: ext_yahoo_conf_userdecline
[5ebff60]209 *      Called when someone declines to join the conference.
[b7d3cc34]210 * Params:
[5ebff60]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
[b7d3cc34]216 */
[c36f73b]217        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline) (int id,
[5ebff60]218                                                              const char *me, const char *who, const char *room,
219                                                              const char *msg);
[b7d3cc34]220
221/*
222 * Name: ext_yahoo_conf_userjoin
[5ebff60]223 *      Called when someone joins the conference.
[b7d3cc34]224 * Params:
[5ebff60]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
[b7d3cc34]229 */
[c36f73b]230        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin) (int id,
[5ebff60]231                                                           const char *me, const char *who, const char *room);
[b7d3cc34]232
233/*
234 * Name: ext_yahoo_conf_userleave
[5ebff60]235 *      Called when someone leaves the conference.
[b7d3cc34]236 * Params:
[5ebff60]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
[b7d3cc34]241 */
[c36f73b]242        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave) (int id,
[5ebff60]243                                                            const char *me, const char *who, const char *room);
[b7d3cc34]244
245/*
246 * Name: ext_yahoo_chat_cat_xml
[5ebff60]247 *      Called when ?
[b7d3cc34]248 * Params:
[5ebff60]249 *      id      - the id that identifies the server connection
250 *      xml     - ?
[b7d3cc34]251 */
[c36f73b]252        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml) (int id,
[5ebff60]253                                                          const char *xml);
[b7d3cc34]254
255/*
256 * Name: ext_yahoo_chat_join
[5ebff60]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
[b7d3cc34]265 *                of yahoo_chat_member's) Must be freed by the client
[9034ba0]266 *      fd      - the object where the connection is coming from (for tracking)
[b7d3cc34]267 */
[c36f73b]268        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join) (int id, const char *me,
[5ebff60]269                                                       const char *room, const char *topic, YList *members, void *fd);
[b7d3cc34]270
271/*
272 * Name: ext_yahoo_chat_userjoin
[5ebff60]273 *      Called when someone joins the chatroom.
[b7d3cc34]274 * Params:
[5ebff60]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
[b7d3cc34]279 */
[c36f73b]280        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin) (int id,
[5ebff60]281                                                           const char *me, const char *room,
282                                                           struct yahoo_chat_member *who);
[b7d3cc34]283
284/*
285 * Name: ext_yahoo_chat_userleave
[5ebff60]286 *      Called when someone leaves the chatroom.
[b7d3cc34]287 * Params:
[5ebff60]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)
[b7d3cc34]292 */
[c36f73b]293        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave) (int id,
[5ebff60]294                                                            const char *me, const char *room, const char *who);
[b7d3cc34]295
296/*
297 * Name: ext_yahoo_chat_message
[5ebff60]298 *      Called when someone messages in the chatroom.
[b7d3cc34]299 * Params:
[5ebff60]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
[b7d3cc34]308 */
[c36f73b]309        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message) (int id,
[5ebff60]310                                                          const char *me, const char *who, const char *room,
311                                                          const char *msg, int msgtype, int utf8);
[b7d3cc34]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
[5ebff60]318 *      requested. Care should be taken to make sure you know the origin
[b7d3cc34]319 *      of the disconnect request before doing anything here (auto-join's etc)
320 * Params:
321 *      id   - the id that identifies this connection
[5ebff60]322 *      me   - the identity in the chatroom
[b7d3cc34]323 * Returns:
324 *      nothing.
325 */
[c36f73b]326        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout) (int id,
[5ebff60]327                                                              const char *me);
[b7d3cc34]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)
[5ebff60]335 *      Care should be taken to make sure you know the origin
[b7d3cc34]336 *      of the error before doing anything about it.
337 * Params:
338 *      id   - the id that identifies this connection
[5ebff60]339 *      me   - the identity in the chatroom
[b7d3cc34]340 * Returns:
341 *      nothing.
342 */
[c36f73b]343        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror) (int id,
[5ebff60]344                                                             const char *me);
[b7d3cc34]345
346/*
347 * Name: ext_yahoo_conf_message
[5ebff60]348 *      Called when someone messages in the conference.
[b7d3cc34]349 * Params:
[5ebff60]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
[b7d3cc34]356 */
[c36f73b]357        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message) (int id,
[5ebff60]358                                                          const char *me, const char *who, const char *room,
359                                                          const char *msg, int utf8);
[b7d3cc34]360
361/*
362 * Name: ext_yahoo_got_file
[5ebff60]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
[9034ba0]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
[b7d3cc34]377 */
[9034ba0]378        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file) (int id, const char *me,
[5ebff60]379                                                      const char *who, const char *msg, const char *fname,
380                                                      unsigned long fesize, char *trid);
[b7d3cc34]381
[ba16895]382/*
[9034ba0]383 * Name: ext_yahoo_got_ft_data
[5ebff60]384 *      Called multiple times when parts of the file are received
[ba16895]385 * Params:
[5ebff60]386 *      id   - the id that identifies the server connection
387 *      in   - The data
388 *      len  - Length of the data
389 *      data - callback data
[ba16895]390 */
[9034ba0]391        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ft_data) (int id,
[5ebff60]392                                                         const unsigned char *in, int len, void *data);
[ba16895]393
[9034ba0]394/*
395 * Name: ext_yahoo_file_transfer_done
[5ebff60]396 *      File transfer is done
[9034ba0]397 * Params:
[5ebff60]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
[9034ba0]401 */
402        void YAHOO_CALLBACK_TYPE(ext_yahoo_file_transfer_done) (int id,
[5ebff60]403                                                                int result, void *data);
[ba16895]404
[b7d3cc34]405/*
406 * Name: ext_yahoo_contact_added
[5ebff60]407 *      Called when a contact is added to your list
[b7d3cc34]408 * Params:
[5ebff60]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
[b7d3cc34]413 */
[c36f73b]414        void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added) (int id,
[5ebff60]415                                                           const char *myid, const char *who, const char *msg);
[b7d3cc34]416
417/*
418 * Name: ext_yahoo_rejected
[5ebff60]419 *      Called when a contact rejects your add
[b7d3cc34]420 * Params:
[5ebff60]421 *      id   - the id that identifies the server connection
422 *      who  - who rejected you
423 *      msg  - any message sent
[b7d3cc34]424 */
[c36f73b]425        void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected) (int id, const char *who,
[5ebff60]426                                                      const char *msg);
[b7d3cc34]427
428/*
429 * Name: ext_yahoo_typing_notify
[5ebff60]430 *      Called when remote user starts or stops typing.
[b7d3cc34]431 * Params:
[5ebff60]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
[b7d3cc34]436 */
[c36f73b]437        void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify) (int id,
[5ebff60]438                                                           const char *me, const char *who, int stat);
[b7d3cc34]439
440/*
441 * Name: ext_yahoo_game_notify
[5ebff60]442 *      Called when remote user starts or stops a game.
[b7d3cc34]443 * Params:
[5ebff60]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
[b7d3cc34]449 */
[9034ba0]450        void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify) (int id, const char *me,
[5ebff60]451                                                         const char *who, int stat, const char *msg);
[b7d3cc34]452
453/*
454 * Name: ext_yahoo_mail_notify
[5ebff60]455 *      Called when you receive mail, or with number of messages
[b7d3cc34]456 * Params:
[5ebff60]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
[b7d3cc34]461 */
[c36f73b]462        void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify) (int id,
[5ebff60]463                                                         const char *from, const char *subj, int cnt);
[b7d3cc34]464
465/*
466 * Name: ext_yahoo_system_message
[5ebff60]467 *      System message
[b7d3cc34]468 * Params:
[5ebff60]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
[b7d3cc34]473 */
[9034ba0]474        void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message) (int id,
[5ebff60]475                                                            const char *me, const char *who, const char *msg);
[b7d3cc34]476
[cfc8d58]477/*
478 * Name: ext_yahoo_got_buddyicon
[5ebff60]479 *      Buddy icon received
[cfc8d58]480 * Params:
[5ebff60]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
[cfc8d58]486 */
[c36f73b]487        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon) (int id,
[5ebff60]488                                                           const char *me, const char *who, const char *url,
489                                                           int checksum);
[b7d3cc34]490
[cfc8d58]491/*
492 * Name: ext_yahoo_got_buddyicon_checksum
[5ebff60]493 *      Buddy icon checksum received
[cfc8d58]494 * Params:
[5ebff60]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
[cfc8d58]499 */
[c36f73b]500        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum) (int id,
[5ebff60]501                                                                    const char *me, const char *who, int checksum);
[b7d3cc34]502
[cfc8d58]503/*
504 * Name: ext_yahoo_got_buddyicon_request
[5ebff60]505 *      Buddy icon request received
[cfc8d58]506 * Params:
[5ebff60]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
[cfc8d58]510 */
[c36f73b]511        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request) (int id,
[5ebff60]512                                                                   const char *me, const char *who);
[b7d3cc34]513
[cfc8d58]514/*
515 * Name: ext_yahoo_got_buddyicon_request
[5ebff60]516 *      Buddy icon request received
[cfc8d58]517 * Params:
[5ebff60]518 *      id - the id that identifies the server connection
519 *      url - remote url, the uploaded buddy icon can be fetched from
[cfc8d58]520 */
[c36f73b]521        void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded) (int id,
[5ebff60]522                                                                const char *url);
[b7d3cc34]523
524/*
525 * Name: ext_yahoo_got_webcam_image
[5ebff60]526 *      Called when you get a webcam update
[b7d3cc34]527 *      An update can either be receiving an image, a part of an image or
528 *      just an update with a timestamp
529 * Params:
[5ebff60]530 *      id         - the id that identifies the server connection
531 *      who        - the user who's webcam we're viewing
[b7d3cc34]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 */
[c36f73b]547        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image) (int id,
[5ebff60]548                                                              const char *who, const unsigned char *image,
549                                                              unsigned int image_size, unsigned int real_size,
550                                                              unsigned int timestamp);
[b7d3cc34]551
552/*
553 * Name: ext_yahoo_webcam_invite
[5ebff60]554 *      Called when you get a webcam invitation
[b7d3cc34]555 * Params:
[5ebff60]556 *      id   - the id that identifies the server connection
557 *      me   - identity the invitation is to
558 *      from - who the invitation is from
[b7d3cc34]559 */
[c36f73b]560        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite) (int id,
[5ebff60]561                                                           const char *me, const char *from);
[b7d3cc34]562
563/*
564 * Name: ext_yahoo_webcam_invite_reply
[5ebff60]565 *      Called when you get a response to a webcam invitation
[b7d3cc34]566 * Params:
[5ebff60]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
[b7d3cc34]570 *      accept - 0 (decline), 1 (accept)
571 */
[c36f73b]572        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply) (int id,
[5ebff60]573                                                                 const char *me, const char *from, int accept);
[b7d3cc34]574
575/*
576 * Name: ext_yahoo_webcam_closed
[5ebff60]577 *      Called when the webcam connection closed
[b7d3cc34]578 * Params:
[5ebff60]579 *      id   - the id that identifies the server connection
580 *      who  - the user who we where connected to
[b7d3cc34]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 */
[c36f73b]587        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed) (int id,
[5ebff60]588                                                           const char *who, int reason);
[b7d3cc34]589
590/*
591 * Name: ext_yahoo_got_search_result
592 *      Called when the search result received from server
593 * Params:
[5ebff60]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
[b7d3cc34]601 */
[c36f73b]602        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result) (int id,
[5ebff60]603                                                               int found, int start, int total, YList *contacts);
[b7d3cc34]604
605/*
606 * Name: ext_yahoo_error
[5ebff60]607 *      Called on error.
[b7d3cc34]608 * Params:
[5ebff60]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
[b7d3cc34]613 */
[c36f73b]614        void YAHOO_CALLBACK_TYPE(ext_yahoo_error) (int id, const char *err,
[5ebff60]615                                                   int fatal, int num);
[b7d3cc34]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 */
[c36f73b]625        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer) (int id,
[5ebff60]626                                                           const char *who, int connect);
[b7d3cc34]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 */
[c36f73b]635        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request) (int id,
[5ebff60]636                                                                 int send);
[b7d3cc34]637
638/*
639 * Name: ext_yahoo_log
[5ebff60]640 *      Called to log a message.
[b7d3cc34]641 * Params:
[5ebff60]642 *      fmt  - the printf formatted message
[b7d3cc34]643 * Returns:
[5ebff60]644 *      0
[b7d3cc34]645 */
[c36f73b]646        int YAHOO_CALLBACK_TYPE(ext_yahoo_log) (const char *fmt, ...);
[b7d3cc34]647
648/*
649 * Name: ext_yahoo_add_handler
[5ebff60]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 *
[b7d3cc34]659 * Returns: a tag to be used when removing the handler
660 */
[9034ba0]661        int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, void *fd,
[5ebff60]662                                                        yahoo_input_condition cond, void *data);
[b7d3cc34]663
664/*
665 * Name: ext_yahoo_remove_handler
[5ebff60]666 *      Remove the listener for the fd.
[b7d3cc34]667 * Params:
[5ebff60]668 *      id   - the id that identifies the connection
669 *      tag  - the handler tag to remove
[b7d3cc34]670 */
[c36f73b]671        void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler) (int id, int tag);
[b7d3cc34]672
673/*
674 * Name: ext_yahoo_connect
[5ebff60]675 *      Connect to a host:port
[b7d3cc34]676 * Params:
[5ebff60]677 *      host - the host to connect to
678 *      port - the port to connect on
[b7d3cc34]679 * Returns:
[5ebff60]680 *      a unix file descriptor to the socket
[b7d3cc34]681 */
[3cd37d7]682//      int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);
[b7d3cc34]683
684/*
685 * Name: ext_yahoo_connect_async
[5ebff60]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
[b7d3cc34]700 * Returns:
[5ebff60]701 *      a tag signifying the connection attempt
[b7d3cc34]702 */
[c36f73b]703        int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async) (int id,
[5ebff60]704                                                          const char *host, int port, yahoo_connect_callback callback,
705                                                          void *callback_data, int use_ssl);
[9034ba0]706
707/*
708 * Name: ext_yahoo_get_ip_addr
[5ebff60]709 *      get IP Address for a domain name
[9034ba0]710 * Params:
[5ebff60]711 *      domain - Domain name
[9034ba0]712 * Returns:
[5ebff60]713 *      Newly allocated string containing the IP Address in IPv4 notation
[9034ba0]714 */
715        char *YAHOO_CALLBACK_TYPE(ext_yahoo_get_ip_addr) (const char *domain);
716
717/*
718 * Name: ext_yahoo_write
[5ebff60]719 *      Write data from the buffer into the socket for the specified connection
[9034ba0]720 * Params:
[5ebff60]721 *      fd  - the file descriptor object that identifies this connection
722 *      buf - Buffer to write the data from
723 *      len - Length of the data
[9034ba0]724 * Returns:
[5ebff60]725 *      Number of bytes written or -1 for error
[9034ba0]726 */
727        int YAHOO_CALLBACK_TYPE(ext_yahoo_write) (void *fd, char *buf, int len);
728
729/*
730 * Name: ext_yahoo_read
[5ebff60]731 *      Read data into a buffer from socket for the specified connection
[9034ba0]732 * Params:
[5ebff60]733 *      fd  - the file descriptor object that identifies this connection
734 *      buf - Buffer to read the data into
735 *      len - Max length to read
[9034ba0]736 * Returns:
[5ebff60]737 *      Number of bytes read or -1 for error
[9034ba0]738 */
739        int YAHOO_CALLBACK_TYPE(ext_yahoo_read) (void *fd, char *buf, int len);
740
741/*
742 * Name: ext_yahoo_close
[5ebff60]743 *      Close the file descriptor object and free its resources. Libyahoo2 will not
744 *      use this object again.
[9034ba0]745 * Params:
[5ebff60]746 *      fd  - the file descriptor object that identifies this connection
[9034ba0]747 * Returns:
[5ebff60]748 *      Nothing
[9034ba0]749 */
750        void YAHOO_CALLBACK_TYPE(ext_yahoo_close) (void *fd);
751
752/*
753 * Name: ext_yahoo_got_buddy_change_group
[5ebff60]754 *      Acknowledgement of buddy changing group
[9034ba0]755 * Params:
[5ebff60]756 *      id: client id
757 *      me: The user
758 *      who: Buddy name
759 *      old_group: Old group name
760 *      new_group: New group name
[9034ba0]761 * Returns:
[5ebff60]762 *      Nothing
[9034ba0]763 */
764        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddy_change_group) (int id,
[5ebff60]765                                                                    const char *me, const char *who,
766                                                                    const char *old_group,
767                                                                    const char *new_group);
[b7d3cc34]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 */
[c36f73b]776void yahoo_register_callbacks(struct yahoo_callbacks *tyc);
[cfc8d58]777
[b7d3cc34]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.