Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/yahoo2_callbacks.h

    r9034ba0 rba16895  
    3030 */
    3131
     32
    3233#ifndef YAHOO2_CALLBACKS_H
    3334#define YAHOO2_CALLBACKS_H
     
    4546 */
    4647
    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;
     48typedef enum {
     49        YAHOO_INPUT_READ = 1 << 0,
     50        YAHOO_INPUT_WRITE = 1 << 1,
     51        YAHOO_INPUT_EXCEPTION = 1 << 2
     52} yahoo_input_condition;
    5253
    5354/*
     
    5556 *
    5657 * Params:
    57  *     fd    - The file descriptor object that has been connected, or NULL on
    58  *             error
     58 *     fd    - The file descriptor that has been connected, or -1 on 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) (void *fd, int error,
    66                 void *callback_data);
     65typedef void (*yahoo_connect_callback)(int fd, int error, void *callback_data);
     66
    6767
    6868/*
     
    9494 *      url  - url to reactivate account if locked
    9595 */
    96         void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response) (int id, int succ,
    97                 const char *url);
     96void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response)(int id, int succ, const char *url);
     97
    9898
    9999/*
     
    104104 *      buds - the buddy list
    105105 */
    106         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies) (int id, YList *buds);
     106void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies)(int id, YList * buds);
     107
    107108
    108109/*
     
    113114 *      igns - the ignore list
    114115 */
    115         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);
     116void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore)(int id, YList * igns);
     117
    116118
    117119/*
     
    122124 *      ids  - the identity list
    123125 */
    124         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities) (int id, YList *ids);
     126void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities)(int id, YList * ids);
     127
    125128
    126129/*
     
    130133 *      id   - the id that identifies the server connection
    131134 */
    132         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies) (int id);
     135void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies)(int id);
     136
    133137
    134138/*
     
    139143 *  errormsg - optional error message
    140144 */
    141         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping) (int id,
    142                 const char *errormsg);
     145void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping)(int id, const char *errormsg);
     146
    143147
    144148/*
     
    155159 *      TODO: add support for pager, chat, and game states
    156160 */
    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);
     161void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed)(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile);
     162
    172163
    173164/*
     
    186177 *      utf8 - whether the message is encoded as utf8 or not
    187178 */
    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);
     179void 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
    190181
    191182/*
     
    200191 *      members - the initial members of the conference (null terminated list)
    201192 */
    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);
     193void 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
    205195
    206196/*
     
    214204 *      msg  - the declining message
    215205 */
    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);
     206void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline)(int id, const char *me, const char *who, const char *room, const char *msg);
     207
    219208
    220209/*
     
    227216 *      room - the room joined
    228217 */
    229         void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin) (int id,
    230                 const char *me, const char *who, const char *room);
     218void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin)(int id, const char *me, const char *who, const char *room);
     219
    231220
    232221/*
     
    239228 *      room - the room left
    240229 */
    241         void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave) (int id,
    242                 const char *me, const char *who, const char *room);
     230void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave)(int id, const char *me, const char *who, const char *room);
     231
    243232
    244233/*
     
    249238 *      xml     - ?
    250239 */
    251         void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml) (int id,
    252                 const char *xml);
     240void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml)(int id, const char *xml);
     241
    253242
    254243/*
     
    263252 *      members - the initial members of the chatroom (null terminated YList
    264253 *                of yahoo_chat_member's) Must be freed by the client
    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);
     254 *      fd      - the socket where the connection is coming from (for tracking)
     255 */
     256void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join)(int id, const char *me, const char *room, const char *topic, YList *members, int fd);
     257
    269258
    270259/*
     
    277266 *      who  - the user who has joined, Must be freed by the client
    278267 */
    279         void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin) (int id,
    280                 const char *me, const char *room,
    281                 struct yahoo_chat_member *who);
     268void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin)(int id, const char *me, const char *room, struct yahoo_chat_member *who);
     269
    282270
    283271/*
     
    290278 *      who  - the user who has left (Just the User ID)
    291279 */
    292         void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave) (int id,
    293                 const char *me, const char *room, const char *who);
     280void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave)(int id, const char *me, const char *room, const char *who);
     281
    294282
    295283/*
     
    306294 *      utf8 - whether the message is utf8 encoded or not
    307295 */
    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);
     296void 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
    311298
    312299/*
     
    323310 *      nothing.
    324311 */
    325         void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout) (int id,
    326                 const char *me);
     312void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout)(int id, const char *me);
     313
    327314
    328315/*
     
    340327 *      nothing.
    341328 */
    342         void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror) (int id,
    343                 const char *me);
     329void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror)(int id, const char *me);
     330
    344331
    345332/*
     
    354341 *      utf8 - whether the message is utf8 encoded or not
    355342 */
    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);
     343void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message)(int id, const char *me, const char *who, const char *room, const char *msg, int utf8);
     344
    359345
    360346/*
     
    365351 *      me   - the identity the file was sent to
    366352 *      who  - the user who sent the file
     353 *      url  - the file url
     354 *      expires  - the expiry date of the file on the server (timestamp)
    367355 *      msg  - the message
    368356 *      fname- the file name if direct transfer
    369357 *      fsize- the file size if direct transfer
    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);
     358 */
     359void 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 */
     371void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg);
     372
    403373
    404374/*
     
    411381 *      msg  - any message sent
    412382 */
    413         void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added) (int id,
    414                 const char *myid, const char *who, const char *msg);
     383void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added)(int id, const char *myid, const char *who, const char *msg);
     384
    415385
    416386/*
     
    422392 *      msg  - any message sent
    423393 */
    424         void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected) (int id, const char *who,
    425                 const char *msg);
     394void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected)(int id, const char *who, const char *msg);
     395
    426396
    427397/*
     
    434404 *      stat - 1 if typing, 0 if stopped typing
    435405 */
    436         void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify) (int id,
    437                 const char *me, const char *who, int stat);
     406void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify)(int id, const char *me, const char *who, int stat);
     407
    438408
    439409/*
     
    445415 *      who  - the handle of the remote user
    446416 *      stat - 1 if game, 0 if stopped gaming
    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);
     417 */
     418void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, const char *me, const char *who, int stat);
     419
    451420
    452421/*
     
    459428 *      cnt  - mail count - 0 if new mail notification
    460429 */
    461         void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify) (int id,
    462                 const char *from, const char *subj, int cnt);
     430void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify)(int id, const char *from, const char *subj, int cnt);
     431
    463432
    464433/*
     
    467436 * Params:
    468437 *      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)
    471438 *      msg  - the message
    472439 */
    473         void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message) (int id,
    474                 const char *me, const char *who, const char *msg);
     440void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *msg);
    475441
    476442/*
     
    484450 *      checksum - the checksum of the icon content
    485451 */
    486         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon) (int id,
    487                 const char *me, const char *who, const char *url, int checksum);
     452void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon)(int id, const char *me, const char *who, const char *url, int checksum);
    488453
    489454/*
     
    496461 *      checksum - the checksum of the icon content
    497462 */
    498         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum) (int id,
    499                 const char *me, const char *who, int checksum);
     463void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum)(int id, const char *me,const char *who, int checksum);
    500464
    501465/*
     
    507471 *      who - the yahoo id of the buddy that requested the buddy icon
    508472 */
    509         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request) (int id,
    510                 const char *me, const char *who);
     473void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request)(int id, const char *me, const char *who);
    511474
    512475/*
     
    517480 *      url - remote url, the uploaded buddy icon can be fetched from
    518481 */
    519         void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded) (int id,
    520                 const char *url);
     482void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded)(int id, const char *url);
    521483
    522484/*
     
    543505 *      a timestamp to stay in sync
    544506 */
    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,
     507void 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,
    548509                unsigned int timestamp);
     510
    549511
    550512/*
     
    556518 *      from - who the invitation is from
    557519 */
    558         void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite) (int id,
    559                 const char *me, const char *from);
     520void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite)(int id, const char *me, const char *from);
     521
    560522
    561523/*
     
    568530 *      accept - 0 (decline), 1 (accept)
    569531 */
    570         void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply) (int id,
    571                 const char *me, const char *from, int accept);
     532void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply)(int id, const char *me, const char *from, int accept);
     533
    572534
    573535/*
     
    583545 *               4 = user does not have webcam online
    584546 */
    585         void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed) (int id,
    586                 const char *who, int reason);
     547void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed)(int id, const char *who, int reason);
     548
    587549
    588550/*
     
    598560 *                 if you need to use the information, make a copy
    599561 */
    600         void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result) (int id,
    601                 int found, int start, int total, YList *contacts);
     562void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result)(int id, int found, int start, int total, YList *contacts);
     563
    602564
    603565/*
     
    610572 *      num  - Which error is this
    611573 */
    612         void YAHOO_CALLBACK_TYPE(ext_yahoo_error) (int id, const char *err,
    613                 int fatal, int num);
     574void YAHOO_CALLBACK_TYPE(ext_yahoo_error)(int id, const char *err, int fatal, int num);
     575
    614576
    615577/*
     
    621583 *      connect - 0=disconnect 1=connect 2=request
    622584 */
    623         void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer) (int id,
    624                 const char *who, int connect);
     585void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer)(int id, const char *who, int connect);
     586
    625587
    626588/*
     
    631593 *      send - whether to send images or not
    632594 */
    633         void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request) (int id,
    634                 int send);
     595void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request)(int id, int send);
     596
    635597
    636598/*
     
    642604 *      0
    643605 */
    644         int YAHOO_CALLBACK_TYPE(ext_yahoo_log) (const char *fmt, ...);
     606int YAHOO_CALLBACK_TYPE(ext_yahoo_log)(const char *fmt, ...);
     607
    645608
    646609/*
     
    651614 * Params:
    652615 *      id   - the id that identifies the server connection
    653  *      fd   - the fd object on which to listen
     616 *      fd   - the fd on which to listen
    654617 *      cond - the condition on which to call the callback
    655618 *      data - callback data to pass to yahoo_*_ready
     
    657620 * Returns: a tag to be used when removing the handler
    658621 */
    659         int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, void *fd,
    660                 yahoo_input_condition cond, void *data);
     622int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler)(int id, int fd, yahoo_input_condition cond, void *data);
     623
    661624
    662625/*
     
    667630 *      tag  - the handler tag to remove
    668631 */
    669         void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler) (int id, int tag);
     632void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler)(int id, int tag);
     633
    670634
    671635/*
     
    678642 *      a unix file descriptor to the socket
    679643 */
    680         int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);
     644int YAHOO_CALLBACK_TYPE(ext_yahoo_connect)(const char *host, int port);
     645
    681646
    682647/*
    683648 * Name: ext_yahoo_connect_async
    684  *      Connect to a host:port asynchronously. This function should return
     649 *      Connect to a host:port asynchronously.  This function should return
    685650 *      immediately returing a tag used to identify the connection handler,
    686651 *      or a pre-connect error (eg: host name lookup failure).
     
    695660 *      callback - function to call when connect completes
    696661 *      callback_data - data to pass to the callback function
    697  *      use_ssl - Whether we need an SSL connection
    698662 * 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);
     663 *      a unix file descriptor to the socket
     664 */
     665int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async)(int id, const char *host, int port,
     666                yahoo_connect_callback callback, void *callback_data);
    765667
    766668#ifdef USE_STRUCT_CALLBACKS
     
    771673 * before doing anything else
    772674 */
    773 void yahoo_register_callbacks(struct yahoo_callbacks *tyc);
     675void yahoo_register_callbacks(struct yahoo_callbacks * tyc);
    774676
    775677#undef YAHOO_CALLBACK_TYPE
     
    782684
    783685#endif
     686
Note: See TracChangeset for help on using the changeset viewer.