comparison libpurple/ft.h @ 29298:fb99a0067812

propagate from branch 'im.pidgin.pidgin' (head 70d69397ed952b26b453423c381c70d6783eb66d) to branch 'im.pidgin.cpw.attention_ui' (head 1cf0dea282a0d0e4aeac4770e0150d6d0c10830a)
author Marcus Lundblad <ml@update.uu.se>
date Thu, 13 Aug 2009 17:42:44 +0000
parents dad4cb8f81df
children 583a2f6ae576 52cb819c6668
comparison
equal deleted inserted replaced
29297:338d6a211055 29298:fb99a0067812
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 (*ui_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 (*ui_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
546 * 585 *
547 * Either @a fd must be specified <i>or</i> @a ip and @a port on a 586 * Either @a fd must be specified <i>or</i> @a ip and @a port on a
548 * file receive transfer. On send, @a fd must be specified, and 587 * file receive transfer. On send, @a fd must be specified, and
549 * @a ip and @a port are ignored. 588 * @a ip and @a port are ignored.
550 * 589 *
590 * Prior to libpurple 2.6.0, passing '0' to @a fd was special-cased to
591 * allow the protocol plugin to facilitate the file transfer itself. As of
592 * 2.6.0, this is supported (for backward compatibility), but will be
593 * removed in libpurple 3.0.0. If a prpl detects that the running libpurple
594 * is running 2.6.0 or higher, it should use the invalid fd '-1'.
595 *
551 * @param xfer The file transfer. 596 * @param xfer The file transfer.
552 * @param fd The file descriptor for the socket. 597 * @param fd The file descriptor for the socket.
553 * @param ip The IP address to connect to. 598 * @param ip The IP address to connect to.
554 * @param port The port to connect to. 599 * @param port The port to connect to.
555 */ 600 */
615 * @param message The message to display. 660 * @param message The message to display.
616 * @param is_error Is this an error message?. 661 * @param is_error Is this an error message?.
617 */ 662 */
618 void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error); 663 void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error);
619 664
665 /**
666 * Allows the UI to signal it's ready to send/receive data (depending on
667 * the direction of the file transfer. Used when the UI is providing
668 * read/write/data_not_sent UI ops.
669 *
670 * @param xfer The file transfer which is ready.
671 *
672 * @since 2.6.0
673 */
674 void purple_xfer_ui_ready(PurpleXfer *xfer);
675
676 /**
677 * Allows the prpl to signal it's readh to send/receive data (depending on
678 * the direction of the file transfer. Used when the prpl provides read/write
679 * ops and cannot/does not provide a raw fd to the core.
680 *
681 * @param xfer The file transfer which is ready.
682 *
683 * @since 2.6.0
684 */
685 void purple_xfer_prpl_ready(PurpleXfer *xfer);
686
620 /*@}*/ 687 /*@}*/
621 688
622 /**************************************************************************/ 689 /**************************************************************************/
623 /** @name UI Registration Functions */ 690 /** @name UI Registration Functions */
624 /**************************************************************************/ 691 /**************************************************************************/