comparison libpurple/ft.h @ 27872:4a4e9d309fc0

ft: Allow the UI to overloadthe use of fread/fwrite. Closes #9844. Patch from Jan "HanzZ" Kaluza with a few changes by darkrain42. committer: Paul Aurich <paul@darkrain42.org>
author hanzz@soc.pidgin.im
date Mon, 10 Aug 2009 15:57:35 +0000
parents b99d6d21cd79
children 6adbdd4b2963
comparison
equal deleted inserted replaced
27871:2075b5cb608e 27872:4a4e9d309fc0
75 void (*add_xfer)(PurpleXfer *xfer); 75 void (*add_xfer)(PurpleXfer *xfer);
76 void (*update_progress)(PurpleXfer *xfer, double percent); 76 void (*update_progress)(PurpleXfer *xfer, double percent);
77 void (*cancel_local)(PurpleXfer *xfer); 77 void (*cancel_local)(PurpleXfer *xfer);
78 void (*cancel_remote)(PurpleXfer *xfer); 78 void (*cancel_remote)(PurpleXfer *xfer);
79 79
80 /**
81 * UI op to write data received from the prpl. The UI must deal with the
82 * entire buffer and return size, or it is treated as an error.
83 *
84 * @param xfer The file transfer structure
85 * @param buffer The buffer to write
86 * @param size The size of the buffer
87 *
88 * @return size if the write was successful, or a value between 0 and
89 * size on error.
90 * @since 2.6.0
91 */
92 gssize (*write)(PurpleXfer *xfer, const guchar *buffer, gssize size);
93
94 /**
95 * UI op to read data to send to the prpl for a file transfer.
96 *
97 * @param xfer The file transfer structure
98 * @param buffer A pointer to a buffer. The UI must allocate this buffer.
99 * libpurple will free the data.
100 * @param size The maximum amount of data to put in the buffer.
101 *
102 * @returns The amount of data in the buffer, 0 if nothing is available,
103 * and a negative value if an error occurred and the transfer
104 * should be cancelled (libpurple will cancel).
105 * @since 2.6.0
106 */
107 gssize (*read)(PurpleXfer *xfer, guchar **buffer, gssize size);
108
109 /**
110 * Op to notify the UI that not all the data read in was written. The UI
111 * should re-enqueue this data and return it the next time read is called.
112 *
113 * This MUST be implemented if read and write are implemented.
114 *
115 * @param xfer The file transfer structure
116 * @param buffer A pointer to the beginning of the unwritten data.
117 * @param size The amount of unwritten data.
118 *
119 * @since 2.6.0
120 */
121 void (*data_not_sent)(PurpleXfer *xfer, const guchar *buffer, gsize size);
122
80 void (*_purple_reserved1)(void); 123 void (*_purple_reserved1)(void);
81 void (*_purple_reserved2)(void);
82 void (*_purple_reserved3)(void);
83 void (*_purple_reserved4)(void);
84 } PurpleXferUiOps; 124 } PurpleXferUiOps;
85 125
86 /** 126 /**
87 * A core representation of a file transfer. 127 * A core representation of a file transfer.
88 */ 128 */
130 void (*cancel_send)(PurpleXfer *xfer); 170 void (*cancel_send)(PurpleXfer *xfer);
131 void (*cancel_recv)(PurpleXfer *xfer); 171 void (*cancel_recv)(PurpleXfer *xfer);
132 gssize (*read)(guchar **buffer, PurpleXfer *xfer); 172 gssize (*read)(guchar **buffer, PurpleXfer *xfer);
133 gssize (*write)(const guchar *buffer, size_t size, PurpleXfer *xfer); 173 gssize (*write)(const guchar *buffer, size_t size, PurpleXfer *xfer);
134 void (*ack)(PurpleXfer *xfer, const guchar *buffer, size_t size); 174 void (*ack)(PurpleXfer *xfer, const guchar *buffer, size_t size);
135
136 } ops; 175 } ops;
137 176
138 PurpleXferUiOps *ui_ops; /**< UI-specific operations. */ 177 PurpleXferUiOps *ui_ops; /**< UI-specific operations. */
139 void *ui_data; /**< UI-specific data. */ 178 void *ui_data; /**< UI-specific data. */
140 179
615 * @param message The message to display. 654 * @param message The message to display.
616 * @param is_error Is this an error message?. 655 * @param is_error Is this an error message?.
617 */ 656 */
618 void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error); 657 void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error);
619 658
659 /**
660 * Allows the UI to signal it's ready to send/receive data (depending on
661 * the direction of the file transfer.
662 *
663 * @param xfer The file transfer for which data is ready.
664 *
665 * @since 2.6.0
666 */
667 void purple_xfer_ui_ready(PurpleXfer *xfer);
668
620 /*@}*/ 669 /*@}*/
621 670
622 /**************************************************************************/ 671 /**************************************************************************/
623 /** @name UI Registration Functions */ 672 /** @name UI Registration Functions */
624 /**************************************************************************/ 673 /**************************************************************************/