PageRenderTime 49ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/centerim-4.22.10/libyahoo2/yahoo2_callbacks.h

#
C Header | 788 lines | 128 code | 69 blank | 591 comment | 0 complexity | 63c0e2c049cdc0fa72119d13e1b3fca2 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. /*
  2. * libyahoo2: yahoo2_callbacks.h
  3. *
  4. * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. /*
  22. * The functions in this file *must* be defined in your client program
  23. * If you want to use a callback structure instead of direct functions,
  24. * then you must define USE_STRUCT_CALLBACKS in all files that #include
  25. * this one.
  26. *
  27. * Register the callback structure by calling yahoo_register_callbacks -
  28. * declared in this file and defined in libyahoo2.c
  29. */
  30. #ifndef YAHOO2_CALLBACKS_H
  31. #define YAHOO2_CALLBACKS_H
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #include "yahoo2_types.h"
  36. /*
  37. * yahoo2_callbacks.h
  38. *
  39. * Callback interface for libyahoo2
  40. */
  41. typedef enum {
  42. YAHOO_INPUT_READ = 1 << 0,
  43. YAHOO_INPUT_WRITE = 1 << 1,
  44. YAHOO_INPUT_EXCEPTION = 1 << 2
  45. } yahoo_input_condition;
  46. /*
  47. * A callback function called when an asynchronous connect completes.
  48. *
  49. * Params:
  50. * fd - The file descriptor object that has been connected, or NULL on
  51. * error
  52. * error - The value of errno set by the call to connect or 0 if no error
  53. * Set both fd and error to 0 if the connect was cancelled by the
  54. * user
  55. * callback_data - the callback_data passed to the ext_yahoo_connect_async
  56. * function
  57. */
  58. typedef void (*yahoo_connect_callback) (void *fd, int error,
  59. void *callback_data);
  60. /*
  61. * The following functions need to be implemented in the client
  62. * interface. They will be called by the library when each
  63. * event occurs.
  64. */
  65. /*
  66. * should we use a callback structure or directly call functions
  67. * if you want the structure, you *must* define USE_STRUCT_CALLBACKS
  68. * both when you compile the library, and when you compile your code
  69. * that uses the library
  70. */
  71. #define YAHOO_CALLBACK_TYPE(x) (*x)
  72. struct yahoo_callbacks {
  73. /*
  74. * Name: ext_yahoo_login_response
  75. * Called when the login process is complete
  76. * Params:
  77. * id - the id that identifies the server connection
  78. * succ - enum yahoo_login_status
  79. * url - url to reactivate account if locked
  80. */
  81. void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response) (int id, int succ,
  82. const char *url);
  83. /*
  84. * Name: ext_yahoo_got_buddies
  85. * Called when the contact list is got from the server
  86. * Params:
  87. * id - the id that identifies the server connection
  88. * buds - the buddy list
  89. */
  90. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies) (int id, YList *buds);
  91. /*
  92. * Name: ext_yahoo_got_ignore
  93. * Called when the ignore list is got from the server
  94. * Params:
  95. * id - the id that identifies the server connection
  96. * igns - the ignore list
  97. */
  98. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);
  99. /*
  100. * Name: ext_yahoo_got_identities
  101. * Called when the contact list is got from the server
  102. * Params:
  103. * id - the id that identifies the server connection
  104. * ids - the identity list
  105. */
  106. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities) (int id, YList *ids);
  107. /*
  108. * Name: ext_yahoo_got_cookies
  109. * Called when the cookie list is got from the server
  110. * Params:
  111. * id - the id that identifies the server connection
  112. */
  113. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies) (int id);
  114. /*
  115. * Name: ext_yahoo_got_ping
  116. * Called when the ping packet is received from the server
  117. * Params:
  118. * id - the id that identifies the server connection
  119. * errormsg - optional error message
  120. */
  121. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping) (int id,
  122. const char *errormsg);
  123. /*
  124. * Name: ext_yahoo_status_changed
  125. * Called when remote user's status changes.
  126. * Params:
  127. * id - the id that identifies the server connection
  128. * who - the handle of the remote user
  129. * stat - status code (enum yahoo_status)
  130. * msg - the message if stat == YAHOO_STATUS_CUSTOM
  131. * away - whether the contact is away or not (YAHOO_STATUS_CUSTOM)
  132. * idle - this is the number of seconds he is idle [if he is idle]
  133. * mobile - this is set for mobile users/buddies
  134. * TODO: add support for pager, chat, and game states
  135. */
  136. void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed) (int id,
  137. const char *who, int stat, const char *msg, int away, int idle,
  138. int mobile);
  139. /*
  140. * Name: ext_yahoo_got_buzz
  141. * Called when remote user sends you a buzz.
  142. * Params:
  143. * id - the id that identifies the server connection
  144. * me - the identity the message was sent to
  145. * who - the handle of the remote user
  146. * tm - timestamp of message if offline
  147. */
  148. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buzz) (int id, const char *me,
  149. const char *who, long tm);
  150. /*
  151. * Name: ext_yahoo_got_im
  152. * Called when remote user sends you a message.
  153. * Params:
  154. * id - the id that identifies the server connection
  155. * me - the identity the message was sent to
  156. * who - the handle of the remote user
  157. * msg - the message - NULL if stat == 2
  158. * tm - timestamp of message if offline
  159. * stat - message status - 0
  160. * 1
  161. * 2 == error sending message
  162. * 5
  163. * utf8 - whether the message is encoded as utf8 or not
  164. */
  165. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im) (int id, const char *me,
  166. const char *who, const char *msg, long tm, int stat, int utf8);
  167. /*
  168. * Name: ext_yahoo_got_conf_invite
  169. * Called when remote user sends you a conference invitation.
  170. * Params:
  171. * id - the id that identifies the server connection
  172. * me - the identity the invitation was sent to
  173. * who - the user inviting you
  174. * room - the room to join
  175. * msg - the message
  176. * members - the initial members of the conference (null terminated list)
  177. */
  178. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite) (int id,
  179. const char *me, const char *who, const char *room,
  180. const char *msg, YList *members);
  181. /*
  182. * Name: ext_yahoo_conf_userdecline
  183. * Called when someone declines to join the conference.
  184. * Params:
  185. * id - the id that identifies the server connection
  186. * me - the identity in the conference
  187. * who - the user who has declined
  188. * room - the room
  189. * msg - the declining message
  190. */
  191. void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline) (int id,
  192. const char *me, const char *who, const char *room,
  193. const char *msg);
  194. /*
  195. * Name: ext_yahoo_conf_userjoin
  196. * Called when someone joins the conference.
  197. * Params:
  198. * id - the id that identifies the server connection
  199. * me - the identity in the conference
  200. * who - the user who has joined
  201. * room - the room joined
  202. */
  203. void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin) (int id,
  204. const char *me, const char *who, const char *room);
  205. /*
  206. * Name: ext_yahoo_conf_userleave
  207. * Called when someone leaves the conference.
  208. * Params:
  209. * id - the id that identifies the server connection
  210. * me - the identity in the conference
  211. * who - the user who has left
  212. * room - the room left
  213. */
  214. void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave) (int id,
  215. const char *me, const char *who, const char *room);
  216. /*
  217. * Name: ext_yahoo_chat_cat_xml
  218. * Called when ?
  219. * Params:
  220. * id - the id that identifies the server connection
  221. * xml - ?
  222. */
  223. void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml) (int id,
  224. const char *xml);
  225. /*
  226. * Name: ext_yahoo_chat_join
  227. * Called when joining the chatroom.
  228. * Params:
  229. * id - the id that identifies the server connection
  230. * me - the identity in the chatroom
  231. * room - the room joined, used in all other chat calls, freed by
  232. * library after call
  233. * topic - the topic of the room, freed by library after call
  234. * members - the initial members of the chatroom (null terminated YList
  235. * of yahoo_chat_member's) Must be freed by the client
  236. * fd - the object where the connection is coming from (for tracking)
  237. */
  238. void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join) (int id, const char *me,
  239. const char *room, const char *topic, YList *members, void *fd);
  240. /*
  241. * Name: ext_yahoo_chat_userjoin
  242. * Called when someone joins the chatroom.
  243. * Params:
  244. * id - the id that identifies the server connection
  245. * me - the identity in the chatroom
  246. * room - the room joined
  247. * who - the user who has joined, Must be freed by the client
  248. */
  249. void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin) (int id,
  250. const char *me, const char *room,
  251. struct yahoo_chat_member *who);
  252. /*
  253. * Name: ext_yahoo_chat_userleave
  254. * Called when someone leaves the chatroom.
  255. * Params:
  256. * id - the id that identifies the server connection
  257. * me - the identity in the chatroom
  258. * room - the room left
  259. * who - the user who has left (Just the User ID)
  260. */
  261. void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave) (int id,
  262. const char *me, const char *room, const char *who);
  263. /*
  264. * Name: ext_yahoo_chat_message
  265. * Called when someone messages in the chatroom.
  266. * Params:
  267. * id - the id that identifies the server connection
  268. * me - the identity in the chatroom
  269. * room - the room
  270. * who - the user who messaged (Just the user id)
  271. * msg - the message
  272. * msgtype - 1 = Normal message
  273. * 2 = /me type message
  274. * utf8 - whether the message is utf8 encoded or not
  275. */
  276. void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message) (int id,
  277. const char *me, const char *who, const char *room,
  278. const char *msg, int msgtype, int utf8);
  279. /*
  280. *
  281. * Name: ext_yahoo_chat_yahoologout
  282. * called when yahoo disconnects your chat session
  283. * Note this is called whenver a disconnect happens, client or server
  284. * requested. Care should be taken to make sure you know the origin
  285. * of the disconnect request before doing anything here (auto-join's etc)
  286. * Params:
  287. * id - the id that identifies this connection
  288. * me - the identity in the chatroom
  289. * Returns:
  290. * nothing.
  291. */
  292. void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout) (int id,
  293. const char *me);
  294. /*
  295. *
  296. * Name: ext_yahoo_chat_yahooerror
  297. * called when yahoo sends back an error to you
  298. * Note this is called whenver chat message is sent into a room
  299. * in error (fd not connected, room doesn't exists etc)
  300. * Care should be taken to make sure you know the origin
  301. * of the error before doing anything about it.
  302. * Params:
  303. * id - the id that identifies this connection
  304. * me - the identity in the chatroom
  305. * Returns:
  306. * nothing.
  307. */
  308. void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror) (int id,
  309. const char *me);
  310. /*
  311. * Name: ext_yahoo_conf_message
  312. * Called when someone messages in the conference.
  313. * Params:
  314. * id - the id that identifies the server connection
  315. * me - the identity the conf message was sent to
  316. * who - the user who messaged
  317. * room - the room
  318. * msg - the message
  319. * utf8 - whether the message is utf8 encoded or not
  320. */
  321. void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message) (int id,
  322. const char *me, const char *who, const char *room,
  323. const char *msg, int utf8);
  324. /*
  325. * Name: ext_yahoo_got_file
  326. * Called when someone sends you a file
  327. * Params:
  328. * id - the id that identifies the server connection
  329. * me - the identity the file was sent to
  330. * who - the user who sent the file
  331. * msg - the message
  332. * fname- the file name if direct transfer
  333. * fsize- the file size if direct transfer
  334. * trid - transfer id. Unique for this transfer
  335. *
  336. * NOTE: Subsequent callbacks for file transfer do not send all of this
  337. * information again since it is wasteful. Implementations are expected to
  338. * save this information and supply it as callback data when the file or
  339. * confirmation is sent
  340. */
  341. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file) (int id, const char *me,
  342. const char *who, const char *msg, const char *fname,
  343. unsigned long fesize, char *trid);
  344. /*
  345. * Name: ext_yahoo_got_ft_data
  346. * Called multiple times when parts of the file are received
  347. * Params:
  348. * id - the id that identifies the server connection
  349. * in - The data
  350. * len - Length of the data
  351. * data - callback data
  352. */
  353. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ft_data) (int id,
  354. const unsigned char *in, int len, void *data);
  355. /*
  356. * Name: ext_yahoo_file_transfer_done
  357. * File transfer is done
  358. * Params:
  359. * id - the id that identifies the server connection
  360. * result - To notify if it finished successfully or with a failure
  361. * data - callback data
  362. */
  363. void YAHOO_CALLBACK_TYPE(ext_yahoo_file_transfer_done) (int id,
  364. int result, void *data);
  365. /*
  366. * Name: ext_yahoo_contact_added
  367. * Called when a contact is added to your list
  368. * Params:
  369. * id - the id that identifies the server connection
  370. * myid - the identity he was added to
  371. * who - who was added
  372. * msg - any message sent
  373. */
  374. void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added) (int id,
  375. const char *myid, const char *who, const char *msg);
  376. /*
  377. * Name: ext_yahoo_auth_request
  378. * Called when a contact tries to add us to their list
  379. * Params:
  380. * id - the id that identifies the server connection
  381. * who - who tried to add us
  382. * msg - any message sent
  383. */
  384. void YAHOO_CALLBACK_TYPE(ext_yahoo_auth_request) (int id,
  385. const char *who, const char *msg);
  386. /*
  387. * Name: ext_yahoo_rejected
  388. * Called when a contact rejects your add
  389. * Params:
  390. * id - the id that identifies the server connection
  391. * who - who rejected you
  392. * msg - any message sent
  393. */
  394. void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected) (int id, const char *who,
  395. const char *msg);
  396. /*
  397. * Name: ext_yahoo_typing_notify
  398. * Called when remote user starts or stops typing.
  399. * Params:
  400. * id - the id that identifies the server connection
  401. * me - the handle of the identity the notification is sent to
  402. * who - the handle of the remote user
  403. * stat - 1 if typing, 0 if stopped typing
  404. */
  405. void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify) (int id,
  406. const char *me, const char *who, int stat);
  407. /*
  408. * Name: ext_yahoo_game_notify
  409. * Called when remote user starts or stops a game.
  410. * Params:
  411. * id - the id that identifies the server connection
  412. * me - the handle of the identity the notification is sent to
  413. * who - the handle of the remote user
  414. * stat - 1 if game, 0 if stopped gaming
  415. * msg - game description and/or other text
  416. */
  417. void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify) (int id, const char *me,
  418. const char *who, int stat, const char *msg);
  419. /*
  420. * Name: ext_yahoo_mail_notify
  421. * Called when you receive mail, or with number of messages
  422. * Params:
  423. * id - the id that identifies the server connection
  424. * from - who the mail is from - NULL if only mail count
  425. * subj - the subject of the mail - NULL if only mail count
  426. * cnt - mail count - 0 if new mail notification
  427. */
  428. void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify) (int id,
  429. const char *from, const char *subj, int cnt);
  430. /*
  431. * Name: ext_yahoo_system_message
  432. * System message
  433. * Params:
  434. * id - the id that identifies the server connection
  435. * me - the handle of the identity the notification is sent to
  436. * who - the source of the system message (there are different types)
  437. * msg - the message
  438. */
  439. void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message) (int id,
  440. const char *me, const char *who, const char *msg);
  441. /*
  442. * Name: ext_yahoo_got_buddyicon
  443. * Buddy icon received
  444. * Params:
  445. * id - the id that identifies the server connection
  446. * me - the handle of the identity the notification is sent to
  447. * who - the person the buddy icon is for
  448. * url - the url to use to load the icon
  449. * checksum - the checksum of the icon content
  450. */
  451. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon) (int id,
  452. const char *me, const char *who, const char *url, int checksum);
  453. /*
  454. * Name: ext_yahoo_got_buddyicon_checksum
  455. * Buddy icon checksum received
  456. * Params:
  457. * id - the id that identifies the server connection
  458. * me - the handle of the identity the notification is sent to
  459. * who - the yahoo id of the buddy icon checksum is for
  460. * checksum - the checksum of the icon content
  461. */
  462. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum) (int id,
  463. const char *me, const char *who, int checksum);
  464. /*
  465. * Name: ext_yahoo_got_buddyicon_request
  466. * Buddy icon request received
  467. * Params:
  468. * id - the id that identifies the server connection
  469. * me - the handle of the identity the notification is sent to
  470. * who - the yahoo id of the buddy that requested the buddy icon
  471. */
  472. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request) (int id,
  473. const char *me, const char *who);
  474. /*
  475. * Name: ext_yahoo_got_buddyicon_request
  476. * Buddy icon request received
  477. * Params:
  478. * id - the id that identifies the server connection
  479. * url - remote url, the uploaded buddy icon can be fetched from
  480. */
  481. void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded) (int id,
  482. const char *url);
  483. /*
  484. * Name: ext_yahoo_got_webcam_image
  485. * Called when you get a webcam update
  486. * An update can either be receiving an image, a part of an image or
  487. * just an update with a timestamp
  488. * Params:
  489. * id - the id that identifies the server connection
  490. * who - the user who's webcam we're viewing
  491. * image - image data
  492. * image_size - length of the image in bytes
  493. * real_size - actual length of image data
  494. * timestamp - milliseconds since the webcam started
  495. *
  496. * If the real_size is smaller then the image_size then only part of
  497. * the image has been read. This function will keep being called till
  498. * the total amount of bytes in image_size has been read. The image
  499. * received is in JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1).
  500. * The size of the image will be either 160x120 or 320x240.
  501. * Each webcam image contains a timestamp. This timestamp should be
  502. * used to keep the image in sync since some images can take longer
  503. * to transport then others. When image_size is 0 we can still receive
  504. * a timestamp to stay in sync
  505. */
  506. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image) (int id,
  507. const char *who, const unsigned char *image,
  508. unsigned int image_size, unsigned int real_size,
  509. unsigned int timestamp);
  510. /*
  511. * Name: ext_yahoo_webcam_invite
  512. * Called when you get a webcam invitation
  513. * Params:
  514. * id - the id that identifies the server connection
  515. * me - identity the invitation is to
  516. * from - who the invitation is from
  517. */
  518. void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite) (int id,
  519. const char *me, const char *from);
  520. /*
  521. * Name: ext_yahoo_webcam_invite_reply
  522. * Called when you get a response to a webcam invitation
  523. * Params:
  524. * id - the id that identifies the server connection
  525. * me - identity the invitation response is to
  526. * from - who the invitation response is from
  527. * accept - 0 (decline), 1 (accept)
  528. */
  529. void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply) (int id,
  530. const char *me, const char *from, int accept);
  531. /*
  532. * Name: ext_yahoo_webcam_closed
  533. * Called when the webcam connection closed
  534. * Params:
  535. * id - the id that identifies the server connection
  536. * who - the user who we where connected to
  537. * reason - reason why the connection closed
  538. * 1 = user stopped broadcasting
  539. * 2 = user cancelled viewing permission
  540. * 3 = user declines permission
  541. * 4 = user does not have webcam online
  542. */
  543. void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed) (int id,
  544. const char *who, int reason);
  545. /*
  546. * Name: ext_yahoo_got_search_result
  547. * Called when the search result received from server
  548. * Params:
  549. * id - the id that identifies the server connection
  550. * found - total number of results returned in the current result set
  551. * start - offset from where the current result set starts
  552. * total - total number of results available (start + found <= total)
  553. * contacts - the list of results as a YList of yahoo_found_contact
  554. * these will be freed after this function returns, so
  555. * if you need to use the information, make a copy
  556. */
  557. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result) (int id,
  558. int found, int start, int total, YList *contacts);
  559. /*
  560. * Name: ext_yahoo_error
  561. * Called on error.
  562. * Params:
  563. * id - the id that identifies the server connection
  564. * err - the error message
  565. * fatal- whether this error is fatal to the connection or not
  566. * num - Which error is this
  567. */
  568. void YAHOO_CALLBACK_TYPE(ext_yahoo_error) (int id, const char *err,
  569. int fatal, int num);
  570. /*
  571. * Name: ext_yahoo_webcam_viewer
  572. * Called when a viewer disconnects/connects/requests to connect
  573. * Params:
  574. * id - the id that identifies the server connection
  575. * who - the viewer
  576. * connect - 0=disconnect 1=connect 2=request
  577. */
  578. void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer) (int id,
  579. const char *who, int connect);
  580. /*
  581. * Name: ext_yahoo_webcam_data_request
  582. * Called when you get a request for webcam images
  583. * Params:
  584. * id - the id that identifies the server connection
  585. * send - whether to send images or not
  586. */
  587. void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request) (int id,
  588. int send);
  589. /*
  590. * Name: ext_yahoo_log
  591. * Called to log a message.
  592. * Params:
  593. * fmt - the printf formatted message
  594. * Returns:
  595. * 0
  596. */
  597. int YAHOO_CALLBACK_TYPE(ext_yahoo_log) (const char *fmt, ...);
  598. /*
  599. * Name: ext_yahoo_add_handler
  600. * Add a listener for the fd. Must call yahoo_read_ready
  601. * when a YAHOO_INPUT_READ fd is ready and yahoo_write_ready
  602. * when a YAHOO_INPUT_WRITE fd is ready.
  603. * Params:
  604. * id - the id that identifies the server connection
  605. * fd - the fd object on which to listen
  606. * cond - the condition on which to call the callback
  607. * data - callback data to pass to yahoo_*_ready
  608. *
  609. * Returns: a tag to be used when removing the handler
  610. */
  611. int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, void *fd,
  612. yahoo_input_condition cond, void *data);
  613. /*
  614. * Name: ext_yahoo_remove_handler
  615. * Remove the listener for the fd.
  616. * Params:
  617. * id - the id that identifies the connection
  618. * tag - the handler tag to remove
  619. */
  620. void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler) (int id, int tag);
  621. /*
  622. * Name: ext_yahoo_connect
  623. * Connect to a host:port
  624. * Params:
  625. * host - the host to connect to
  626. * port - the port to connect on
  627. * Returns:
  628. * a unix file descriptor to the socket
  629. */
  630. int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);
  631. /*
  632. * Name: ext_yahoo_connect_async
  633. * Connect to a host:port asynchronously. This function should return
  634. * immediately returing a tag used to identify the connection handler,
  635. * or a pre-connect error (eg: host name lookup failure).
  636. * Once the connect completes (successfully or unsuccessfully), callback
  637. * should be called (see the signature for yahoo_connect_callback).
  638. * The callback may safely be called before this function returns, but
  639. * it should not be called twice.
  640. * Params:
  641. * id - the id that identifies this connection
  642. * host - the host to connect to
  643. * port - the port to connect on
  644. * callback - function to call when connect completes
  645. * callback_data - data to pass to the callback function
  646. * use_ssl - Whether we need an SSL connection
  647. * Returns:
  648. * a tag signifying the connection attempt
  649. */
  650. int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async) (int id,
  651. const char *host, int port, yahoo_connect_callback callback,
  652. void *callback_data, int use_ssl);
  653. /*
  654. * Name: ext_yahoo_get_ip_addr
  655. * get IP Address for a domain name
  656. * Params:
  657. * domain - Domain name
  658. * Returns:
  659. * Newly allocated string containing the IP Address in IPv4 notation
  660. */
  661. char *YAHOO_CALLBACK_TYPE(ext_yahoo_get_ip_addr) (const char *domain);
  662. /*
  663. * Name: ext_yahoo_write
  664. * Write data from the buffer into the socket for the specified connection
  665. * Params:
  666. * fd - the file descriptor object that identifies this connection
  667. * buf - Buffer to write the data from
  668. * len - Length of the data
  669. * Returns:
  670. * Number of bytes written or -1 for error
  671. */
  672. int YAHOO_CALLBACK_TYPE(ext_yahoo_write) (void *fd, char *buf, int len);
  673. /*
  674. * Name: ext_yahoo_read
  675. * Read data into a buffer from socket for the specified connection
  676. * Params:
  677. * fd - the file descriptor object that identifies this connection
  678. * buf - Buffer to read the data into
  679. * len - Max length to read
  680. * Returns:
  681. * Number of bytes read or -1 for error
  682. */
  683. int YAHOO_CALLBACK_TYPE(ext_yahoo_read) (void *fd, char *buf, int len);
  684. /*
  685. * Name: ext_yahoo_close
  686. * Close the file descriptor object and free its resources. Libyahoo2 will not
  687. * use this object again.
  688. * Params:
  689. * fd - the file descriptor object that identifies this connection
  690. * Returns:
  691. * Nothing
  692. */
  693. void YAHOO_CALLBACK_TYPE(ext_yahoo_close) (void *fd);
  694. /*
  695. * Name: ext_yahoo_got_buddy_change_group
  696. * Acknowledgement of buddy changing group
  697. * Params:
  698. * id: client id
  699. * me: The user
  700. * who: Buddy name
  701. * old_group: Old group name
  702. * new_group: New group name
  703. * Returns:
  704. * Nothing
  705. */
  706. void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddy_change_group) (int id,
  707. const char *me, const char *who, const char *old_group,
  708. const char *new_group);
  709. };
  710. /*
  711. * if using a callback structure, call yahoo_register_callbacks
  712. * before doing anything else
  713. */
  714. void yahoo_register_callbacks(struct yahoo_callbacks *tyc);
  715. #undef YAHOO_CALLBACK_TYPE
  716. #ifdef __cplusplus
  717. }
  718. #endif
  719. #endif