Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/yahoo2_callbacks.h

    rba16895 r9034ba0  
    3030 */
    3131
    32 
    3332#ifndef YAHOO2_CALLBACKS_H
    3433#define YAHOO2_CALLBACKS_H
     
    4645 */
    4746
    48 typedef enum {
    49         YAHOO_INPUT_READ = 1 << 0,
    50         YAHOO_INPUT_WRITE = 1 << 1,
    51         YAHOO_INPUT_EXCEPTION = 1 << 2
    52 } yahoo_input_condition;
     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;
    5352
    5453/*
     
    5655 *
    5756 * Params:
    58  *     fd    - The file descriptor that has been connected, or -1 on error
     57 *     fd    - The file descriptor object that has been connected, or NULL on
     58 *             error
    5959 *     error - The value of errno set by the call to connect or 0 if no error
    6060 *             Set both fd and error to 0 if the connect was cancelled by the
     
    6363 *             function
    6464 */
    65 typedef void (*yahoo_connect_callback)(int fd, int error, void *callback_data);
    66 
     65        typedef void (*yahoo_connect_callback) (void *fd, int error,
     66                void *callback_data);
    6767
    6868/*
     
    9494 *      url  - url to reactivate account if locked
    9595 */
    96 void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response)(int id, int succ, const char *url);
    97 
     96        void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response) (int id, int succ,
     97                const char *url);
    9898
    9999/*
     
    104104 *      buds - the buddy list
    105105 */
    106 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies)(int id, YList * buds);
    107 
     106        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies) (int id, YList *buds);
    108107
    109108/*
     
    114113 *      igns - the ignore list
    115114 */
    116 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore)(int id, YList * igns);
    117 
     115        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);
    118116
    119117/*
     
    124122 *      ids  - the identity list
    125123 */
    126 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities)(int id, YList * ids);
    127 
     124        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities) (int id, YList *ids);
    128125
    129126/*
     
    133130 *      id   - the id that identifies the server connection
    134131 */
    135 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies)(int id);
    136 
     132        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies) (int id);
    137133
    138134/*
     
    143139 *  errormsg - optional error message
    144140 */
    145 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping)(int id, const char *errormsg);
    146 
     141        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping) (int id,
     142                const char *errormsg);
    147143
    148144/*
     
    159155 *      TODO: add support for pager, chat, and game states
    160156 */
    161 void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed)(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile);
    162 
     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);
     160
     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);
    163172
    164173/*
     
    177186 *      utf8 - whether the message is encoded as utf8 or not
    178187 */
    179 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im)(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8);
    180 
     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);
    181190
    182191/*
     
    191200 *      members - the initial members of the conference (null terminated list)
    192201 */
    193 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite)(int id, const char *me, const char *who, const char *room, const char *msg, YList *members);
    194 
     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);
    195205
    196206/*
     
    204214 *      msg  - the declining message
    205215 */
    206 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline)(int id, const char *me, const char *who, const char *room, const char *msg);
    207 
     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);
    208219
    209220/*
     
    216227 *      room - the room joined
    217228 */
    218 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin)(int id, const char *me, const char *who, const char *room);
    219 
     229        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin) (int id,
     230                const char *me, const char *who, const char *room);
    220231
    221232/*
     
    228239 *      room - the room left
    229240 */
    230 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave)(int id, const char *me, const char *who, const char *room);
    231 
     241        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave) (int id,
     242                const char *me, const char *who, const char *room);
    232243
    233244/*
     
    238249 *      xml     - ?
    239250 */
    240 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml)(int id, const char *xml);
    241 
     251        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml) (int id,
     252                const char *xml);
    242253
    243254/*
     
    252263 *      members - the initial members of the chatroom (null terminated YList
    253264 *                of yahoo_chat_member's) Must be freed by the client
    254  *      fd      - the socket where the connection is coming from (for tracking)
    255  */
    256 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join)(int id, const char *me, const char *room, const char *topic, YList *members, int fd);
    257 
     265 *      fd      - the object where the connection is coming from (for tracking)
     266 */
     267        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join) (int id, const char *me,
     268                const char *room, const char *topic, YList *members, void *fd);
    258269
    259270/*
     
    266277 *      who  - the user who has joined, Must be freed by the client
    267278 */
    268 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin)(int id, const char *me, const char *room, struct yahoo_chat_member *who);
    269 
     279        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin) (int id,
     280                const char *me, const char *room,
     281                struct yahoo_chat_member *who);
    270282
    271283/*
     
    278290 *      who  - the user who has left (Just the User ID)
    279291 */
    280 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave)(int id, const char *me, const char *room, const char *who);
    281 
     292        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave) (int id,
     293                const char *me, const char *room, const char *who);
    282294
    283295/*
     
    294306 *      utf8 - whether the message is utf8 encoded or not
    295307 */
    296 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message)(int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8);
    297 
     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);
    298311
    299312/*
     
    310323 *      nothing.
    311324 */
    312 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout)(int id, const char *me);
    313 
     325        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout) (int id,
     326                const char *me);
    314327
    315328/*
     
    327340 *      nothing.
    328341 */
    329 void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror)(int id, const char *me);
    330 
     342        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror) (int id,
     343                const char *me);
    331344
    332345/*
     
    341354 *      utf8 - whether the message is utf8 encoded or not
    342355 */
    343 void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message)(int id, const char *me, const char *who, const char *room, const char *msg, int utf8);
    344 
     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);
    345359
    346360/*
     
    351365 *      me   - the identity the file was sent to
    352366 *      who  - the user who sent the file
    353  *      url  - the file url
    354  *      expires  - the expiry date of the file on the server (timestamp)
    355367 *      msg  - the message
    356368 *      fname- the file name if direct transfer
    357369 *      fsize- the file size if direct transfer
    358  */
    359 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file)(int id, const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize);
    360 
    361 
    362 /*
    363  * Name: ext_yahoo_contact_auth_request
    364  *      Called when a contact wants to add you to his/her contact list
    365  * Params:
    366  *      id   - the id that identifies the server connection
    367  *      myid - the identity s/he added
    368  *      who  - who did it
    369  *      msg  - any message sent
    370  */
    371 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg);
    372 
     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
     376 */
     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);
     380
     381/*
     382 * Name: ext_yahoo_got_ft_data
     383 *      Called multiple times when parts of the file are received
     384 * Params:
     385 *      id   - the id that identifies the server connection
     386 *      in   - The data
     387 *      len  - Length of the data
     388 *      data - callback data
     389 */
     390        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ft_data) (int id,
     391                const unsigned char *in, int len, void *data);
     392
     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);
    373403
    374404/*
     
    381411 *      msg  - any message sent
    382412 */
    383 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added)(int id, const char *myid, const char *who, const char *msg);
    384 
     413        void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added) (int id,
     414                const char *myid, const char *who, const char *msg);
    385415
    386416/*
     
    392422 *      msg  - any message sent
    393423 */
    394 void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected)(int id, const char *who, const char *msg);
    395 
     424        void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected) (int id, const char *who,
     425                const char *msg);
    396426
    397427/*
     
    404434 *      stat - 1 if typing, 0 if stopped typing
    405435 */
    406 void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify)(int id, const char *me, const char *who, int stat);
    407 
     436        void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify) (int id,
     437                const char *me, const char *who, int stat);
    408438
    409439/*
     
    415445 *      who  - the handle of the remote user
    416446 *      stat - 1 if game, 0 if stopped gaming
    417  */
    418 void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, const char *me, const char *who, int stat);
    419 
     447 *      msg  - game description and/or other text
     448 */
     449        void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify) (int id, const char *me,
     450                const char *who, int stat, const char *msg);
    420451
    421452/*
     
    428459 *      cnt  - mail count - 0 if new mail notification
    429460 */
    430 void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify)(int id, const char *from, const char *subj, int cnt);
    431 
     461        void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify) (int id,
     462                const char *from, const char *subj, int cnt);
    432463
    433464/*
     
    436467 * Params:
    437468 *      id   - the id that identifies the server connection
     469 *      me   - the handle of the identity the notification is sent to
     470 *      who  - the source of the system message (there are different types)
    438471 *      msg  - the message
    439472 */
    440 void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *msg);
     473        void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message) (int id,
     474                const char *me, const char *who, const char *msg);
    441475
    442476/*
     
    450484 *      checksum - the checksum of the icon content
    451485 */
    452 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon)(int id, const char *me, const char *who, const char *url, int checksum);
     486        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon) (int id,
     487                const char *me, const char *who, const char *url, int checksum);
    453488
    454489/*
     
    461496 *      checksum - the checksum of the icon content
    462497 */
    463 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum)(int id, const char *me,const char *who, int checksum);
     498        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum) (int id,
     499                const char *me, const char *who, int checksum);
    464500
    465501/*
     
    471507 *      who - the yahoo id of the buddy that requested the buddy icon
    472508 */
    473 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request)(int id, const char *me, const char *who);
     509        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request) (int id,
     510                const char *me, const char *who);
    474511
    475512/*
     
    480517 *      url - remote url, the uploaded buddy icon can be fetched from
    481518 */
    482 void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded)(int id, const char *url);
     519        void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded) (int id,
     520                const char *url);
    483521
    484522/*
     
    505543 *      a timestamp to stay in sync
    506544 */
    507 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image)(int id, const char * who,
    508                 const unsigned char *image, unsigned int image_size, unsigned int real_size,
     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,
    509548                unsigned int timestamp);
    510 
    511549
    512550/*
     
    518556 *      from - who the invitation is from
    519557 */
    520 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite)(int id, const char *me, const char *from);
    521 
     558        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite) (int id,
     559                const char *me, const char *from);
    522560
    523561/*
     
    530568 *      accept - 0 (decline), 1 (accept)
    531569 */
    532 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply)(int id, const char *me, const char *from, int accept);
    533 
     570        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply) (int id,
     571                const char *me, const char *from, int accept);
    534572
    535573/*
     
    545583 *               4 = user does not have webcam online
    546584 */
    547 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed)(int id, const char *who, int reason);
    548 
     585        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed) (int id,
     586                const char *who, int reason);
    549587
    550588/*
     
    560598 *                 if you need to use the information, make a copy
    561599 */
    562 void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result)(int id, int found, int start, int total, YList *contacts);
    563 
     600        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result) (int id,
     601                int found, int start, int total, YList *contacts);
    564602
    565603/*
     
    572610 *      num  - Which error is this
    573611 */
    574 void YAHOO_CALLBACK_TYPE(ext_yahoo_error)(int id, const char *err, int fatal, int num);
    575 
     612        void YAHOO_CALLBACK_TYPE(ext_yahoo_error) (int id, const char *err,
     613                int fatal, int num);
    576614
    577615/*
     
    583621 *      connect - 0=disconnect 1=connect 2=request
    584622 */
    585 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer)(int id, const char *who, int connect);
    586 
     623        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer) (int id,
     624                const char *who, int connect);
    587625
    588626/*
     
    593631 *      send - whether to send images or not
    594632 */
    595 void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request)(int id, int send);
    596 
     633        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request) (int id,
     634                int send);
    597635
    598636/*
     
    604642 *      0
    605643 */
    606 int YAHOO_CALLBACK_TYPE(ext_yahoo_log)(const char *fmt, ...);
    607 
     644        int YAHOO_CALLBACK_TYPE(ext_yahoo_log) (const char *fmt, ...);
    608645
    609646/*
     
    614651 * Params:
    615652 *      id   - the id that identifies the server connection
    616  *      fd   - the fd on which to listen
     653 *      fd   - the fd object on which to listen
    617654 *      cond - the condition on which to call the callback
    618655 *      data - callback data to pass to yahoo_*_ready
     
    620657 * Returns: a tag to be used when removing the handler
    621658 */
    622 int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler)(int id, int fd, yahoo_input_condition cond, void *data);
    623 
     659        int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, void *fd,
     660                yahoo_input_condition cond, void *data);
    624661
    625662/*
     
    630667 *      tag  - the handler tag to remove
    631668 */
    632 void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler)(int id, int tag);
    633 
     669        void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler) (int id, int tag);
    634670
    635671/*
     
    642678 *      a unix file descriptor to the socket
    643679 */
    644 int YAHOO_CALLBACK_TYPE(ext_yahoo_connect)(const char *host, int port);
    645 
     680        int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);
    646681
    647682/*
    648683 * Name: ext_yahoo_connect_async
    649  *      Connect to a host:port asynchronously.  This function should return
     684 *      Connect to a host:port asynchronously. This function should return
    650685 *      immediately returing a tag used to identify the connection handler,
    651686 *      or a pre-connect error (eg: host name lookup failure).
     
    660695 *      callback - function to call when connect completes
    661696 *      callback_data - data to pass to the callback function
    662  * Returns:
    663  *      a unix file descriptor to the socket
    664  */
    665 int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async)(int id, const char *host, int port,
    666                 yahoo_connect_callback callback, void *callback_data);
     697 *      use_ssl - Whether we need an SSL connection
     698 * Returns:
     699 *      a tag signifying the connection attempt
     700 */
     701        int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async) (int id,
     702                const char *host, int port, yahoo_connect_callback callback,
     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);
    667765
    668766#ifdef USE_STRUCT_CALLBACKS
     
    673771 * before doing anything else
    674772 */
    675 void yahoo_register_callbacks(struct yahoo_callbacks * tyc);
     773void yahoo_register_callbacks(struct yahoo_callbacks *tyc);
    676774
    677775#undef YAHOO_CALLBACK_TYPE
     
    684782
    685783#endif
    686 
Note: See TracChangeset for help on using the changeset viewer.