diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-24 12:57:08 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-24 12:57:08 +0200 |
commit | 9034ba002b8945aee0f905b928bb0f60da9afe9f (patch) | |
tree | b736ffa7ee8ec53fc5aadf75ac8539b605e76b27 /protocols/yahoo/yahoo2_callbacks.h | |
parent | c36f73bd317dd55d7e70275a6425faa4be7bfd8c (diff) |
Merge complete. It still logs in...
Diffstat (limited to 'protocols/yahoo/yahoo2_callbacks.h')
-rw-r--r-- | protocols/yahoo/yahoo2_callbacks.h | 128 |
1 files changed, 105 insertions, 23 deletions
diff --git a/protocols/yahoo/yahoo2_callbacks.h b/protocols/yahoo/yahoo2_callbacks.h index 19060a22..0dccf188 100644 --- a/protocols/yahoo/yahoo2_callbacks.h +++ b/protocols/yahoo/yahoo2_callbacks.h @@ -54,15 +54,16 @@ extern "C" { * A callback function called when an asynchronous connect completes. * * Params: - * fd - The file descriptor that has been connected, or -1 on error + * fd - The file descriptor object that has been connected, or NULL on + * error * error - The value of errno set by the call to connect or 0 if no error * Set both fd and error to 0 if the connect was cancelled by the * user * callback_data - the callback_data passed to the ext_yahoo_connect_async * function */ -typedef void (*yahoo_connect_callback)(int fd, int error, void *callback_data); - + typedef void (*yahoo_connect_callback) (void *fd, int error, + void *callback_data); /* * The following functions need to be implemented in the client @@ -261,10 +262,10 @@ struct yahoo_callbacks { * topic - the topic of the room, freed by library after call * members - the initial members of the chatroom (null terminated YList * of yahoo_chat_member's) Must be freed by the client - * fd - the socket where the connection is coming from (for tracking) + * fd - the object where the connection is coming from (for tracking) */ void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join) (int id, const char *me, - const char *room, const char *topic, YList *members, int fd); + const char *room, const char *topic, YList *members, void *fd); /* * Name: ext_yahoo_chat_userjoin @@ -363,26 +364,42 @@ struct yahoo_callbacks { * id - the id that identifies the server connection * me - the identity the file was sent to * who - the user who sent the file - * url - the file url - * expires - the expiry date of the file on the server (timestamp) * msg - the message * fname- the file name if direct transfer * fsize- the file size if direct transfer + * trid - transfer id. Unique for this transfer + * + * NOTE: Subsequent callbacks for file transfer do not send all of this + * information again since it is wasteful. Implementations are expected to + * save this information and supply it as callback data when the file or + * confirmation is sent */ -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); - + void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file) (int id, const char *me, + const char *who, const char *msg, const char *fname, + unsigned long fesize, char *trid); /* - * Name: ext_yahoo_contact_auth_request - * Called when a contact wants to add you to his/her contact list + * Name: ext_yahoo_got_ft_data + * Called multiple times when parts of the file are received * Params: * id - the id that identifies the server connection - * myid - the identity s/he added - * who - who did it - * msg - any message sent + * in - The data + * len - Length of the data + * data - callback data */ -void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg); + void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ft_data) (int id, + const unsigned char *in, int len, void *data); +/* + * Name: ext_yahoo_file_transfer_done + * File transfer is done + * Params: + * id - the id that identifies the server connection + * result - To notify if it finished successfully or with a failure + * data - callback data + */ + void YAHOO_CALLBACK_TYPE(ext_yahoo_file_transfer_done) (int id, + int result, void *data); /* * Name: ext_yahoo_contact_added @@ -427,9 +444,10 @@ void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myi * me - the handle of the identity the notification is sent to * who - the handle of the remote user * stat - 1 if game, 0 if stopped gaming + * msg - game description and/or other text */ -void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, const char *me, const char *who, int stat); - + void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify) (int id, const char *me, + const char *who, int stat, const char *msg); /* * Name: ext_yahoo_mail_notify @@ -448,9 +466,12 @@ void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, const char *me, const ch * System message * Params: * id - the id that identifies the server connection + * me - the handle of the identity the notification is sent to + * who - the source of the system message (there are different types) * msg - the message */ -void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *msg); + void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message) (int id, + const char *me, const char *who, const char *msg); /* * Name: ext_yahoo_got_buddyicon @@ -629,13 +650,13 @@ void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *msg); * when a YAHOO_INPUT_WRITE fd is ready. * Params: * id - the id that identifies the server connection - * fd - the fd on which to listen + * fd - the fd object on which to listen * cond - the condition on which to call the callback * data - callback data to pass to yahoo_*_ready * * Returns: a tag to be used when removing the handler */ - int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, int fd, + int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, void *fd, yahoo_input_condition cond, void *data); /* @@ -673,12 +694,74 @@ void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *msg); * port - the port to connect on * callback - function to call when connect completes * callback_data - data to pass to the callback function + * use_ssl - Whether we need an SSL connection * Returns: - * a unix file descriptor to the socket + * a tag signifying the connection attempt */ int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async) (int id, const char *host, int port, yahoo_connect_callback callback, - void *callback_data); + void *callback_data, int use_ssl); + +/* + * Name: ext_yahoo_get_ip_addr + * get IP Address for a domain name + * Params: + * domain - Domain name + * Returns: + * Newly allocated string containing the IP Address in IPv4 notation + */ + char *YAHOO_CALLBACK_TYPE(ext_yahoo_get_ip_addr) (const char *domain); + +/* + * Name: ext_yahoo_write + * Write data from the buffer into the socket for the specified connection + * Params: + * fd - the file descriptor object that identifies this connection + * buf - Buffer to write the data from + * len - Length of the data + * Returns: + * Number of bytes written or -1 for error + */ + int YAHOO_CALLBACK_TYPE(ext_yahoo_write) (void *fd, char *buf, int len); + +/* + * Name: ext_yahoo_read + * Read data into a buffer from socket for the specified connection + * Params: + * fd - the file descriptor object that identifies this connection + * buf - Buffer to read the data into + * len - Max length to read + * Returns: + * Number of bytes read or -1 for error + */ + int YAHOO_CALLBACK_TYPE(ext_yahoo_read) (void *fd, char *buf, int len); + +/* + * Name: ext_yahoo_close + * Close the file descriptor object and free its resources. Libyahoo2 will not + * use this object again. + * Params: + * fd - the file descriptor object that identifies this connection + * Returns: + * Nothing + */ + void YAHOO_CALLBACK_TYPE(ext_yahoo_close) (void *fd); + +/* + * Name: ext_yahoo_got_buddy_change_group + * Acknowledgement of buddy changing group + * Params: + * id: client id + * me: The user + * who: Buddy name + * old_group: Old group name + * new_group: New group name + * Returns: + * Nothing + */ + void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddy_change_group) (int id, + const char *me, const char *who, const char *old_group, + const char *new_group); #ifdef USE_STRUCT_CALLBACKS }; @@ -698,4 +781,3 @@ void yahoo_register_callbacks(struct yahoo_callbacks *tyc); #endif #endif - |